PDA

View Full Version : create surface / poly's

 pix3l07-12-2009, 08:54 PMHello scripterz i'm working on something and have a question on how to create a surface/polys what i have now is a script that reads a txt file and create a empty poly filled with vertex points. from the top view is something like this: ........... ........... ...... .... .... .... ..... ..... ........... now i want create a surface or create polys for my object and well i'm a bit stuck. the reference : polyop.createPolygon But how do i get a vertex array? i would like to do something like this: for each vert in obj: get surrounding vert points make poly perhaps any of you have done this or has some pointers. i searched this forum and on scriptspot but i could not find anything helpfull.... is a bit in the direction of pointcloud meshing/visualizing.... oh yeah in this particular case the vertex are 1m for each other in x and y. the z changes. but a sollution that is more general is better :) Well hope any1 has some ideas! Thx in advance
Dave Black
07-15-2009, 04:07 PM
Well, what you want to do is not particularly easy. If your mesh is regular, ie, if the verts are paired in columns and rows, or the distance between the verts is similar, then there are some ways to achieve it with a high degree of precision. If the grid of vertex points is not regular, then it becomes more difficult, and the chance of errors is increased. The z component of the points are not important, providing that the x and y components are similar. I would probably approach this as a 2.5D solution.

If the data is in a grid then you could simply start at the vert at (row1, column1) and walk through the points shifting down one, then over one, then up one, then back to the first position, collecting the vert IDs as you go, then move to the next cluster. This will then give you an array that you can pass into the polyOp.createPolygon method. Note that polys must be defined in counter-clockwise order if you want the normals to be in the correct direction.

If the data is not in rows and columns(which I will assume is true) then you have an n-squared problem(which can be slow when working with large data sets). That is, you will have to check each vertex against each other vertex to determine which is closest in a given axis in order to traverse the point cloud. With a little more information, I may be able to offer some better assistance. Screen shots always help.

-Dave

CGTalk Moderation
07-15-2009, 04:07 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.