Intentando arreglar las normales de malla 3D

I have triangle collection that define mesh surface of my 3D shape, I would like to fix normal of each triangle to point outshape.

I was trying the following (pseudo):

1. define that first triangle normal direction is right direction
2. go over the mesh using kind of DFS like this:
3. triangle = first triangle
4. foreach neigbour in triangle.getNeighbours
5. if angle between neighbor and triangle greater then 180 do neighbor.flip()
6. triangle = neighbor
7. if neighbor already picked then continue to next neighbor
8. continue recursively to 4.

But step 5 in algorithm does not work because cant know if the angle is greater then 180, because i need to know in witch direction (clockwise or counter clockwise).

Could you please help me to understand how to fix the algorithm?

preguntado el 27 de agosto de 11 a las 17:08

1 Respuestas

There is no need to calculate angle between neighbours. If triangle ABC is oriented (A->B->C), and if neighbour on edge AB is triangle ABD, than it has to have opposite orientation on edge AB. That means, neigbouring triangle has to be orientated B->A->D.

Respondido 27 ago 11, 22:08

It is solving all the cases, something is wrong with this method, please visit my question here… and guide me what to do now... thanks. - maxpayne

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.