|
I am trying to figure out how to make the output of the vertices to come out consistently Clockwise or Counterclockwise when getting vertices from faces in a mesh. Use this as an example:
themeshes = #()
--array containing a couple boxes turned to meshes
themeshes = #((convertToMesh (Box pos:[0,0,0] width: 30 height:30 length:30)),(convertToMesh (Box pos:[100,100,100] width:30 height:30 length:30)))
--iterate through an array containing EditableMesh objects
for myMesh in themeshes do (
--iterate over all the faces in the mesh
for index = 1 to myMesh.numfaces do (
--get the vertices in each face
local verts = meshop.getVertsUsingFace myMesh #{index}
--iterate over the vertices
for vert in verts do (
--get the coordinates of each vertex
vertinfo = meshop.getVert myMesh vert
print vertinfo
)
)
)
You cannot use the ordering of the vertices for writing mesh data because some are clockwise and some are counter-clockwise. My question is how to efficiently get the vertices in a consistent pattern.
I originally tried to cheat by reversing the order of the verts array above every iteration through the outter loop… but that hack failed… though it is “better” than the default ordering.
______________________________
Shawn Olson’s Creative Arts
Developer of the Wall Worm Model Tools for Source
And my Favorite Unsung Plugin: Convexity for Level Design
Max 4/Gmax, 2008 - 2013
Mudbox 2009-2011
Win 7 x64 (x4)
Geforce 480x2 | Geforce 275x1 | ATI Radeon HD 3200 | Intel Generic chip
8GB | 12GB | 4GB | 4GB
Intel Quad 6700 | i7 930 | Athlon QL-65 | Intel Quad 6700
|