1
$\begingroup$

This is my first question in math and if I cannot get it right for the first time, please forgive me. I'm working on a simulation and I need to order vertices of a triangle in counter-clockwise manner.

I'm reading these vertices from an STL file, which provides the three vertices and pre-calculated normals of the triangles that define an object. IOW, I have triangulation data for a 3D solid.

I can do the ordering with calculating the normal of the triangle using the vertices and trying to equalize the signs of the normal vector with the provided one in the file.

I wonder whether there's another way to find the correct order using nothing but the vertices.

Thanks in advance.

  • 0
    However, if by "using nothing but the vertices" you mean *all* the vertices, not just the ones for this triangle, and if you know that the solid is convex, *then* you could take any other vertex of the solid as a fourth vertex (one that isn't coplanar with the triangle, in case that's a possibility), compute the [scalar triple product](http://en.wikipedia.org/wiki/Triple_product#Scalar_triple_product) of the three vectors from the three vertices to the fourth, and determine the order according to its sign.2012-02-15

1 Answers 1

0

If you know from the start that the triangles form a triangulation of an orientable surface (i.e. any two triangles are either disjoint, have a vertex in common, or have an edge in common, and the triangles having a given vertex in common share edges in a cyclic way) then you can pick one of the triangles, say $\Delta:=\{a,b,c\}$, and orient it at will. By orienting I mean that one cyclic order, e.g., $a\to b\to c\to a$, of the vertices is declared positive, the other negative. Starting from this seed orient all other triangles coherently. This means the following: When two triangles $\Delta_1:=\{a,b,c\}$ and $\Delta_2:=\{a,b,d\}$ with $c\ne d$ share an edge $\{a,b\}$ then the orientation of this edge in $\Delta_1$ should be opposite to its orientation in $\Delta_2$.

  • 0
    It helped a lot, thanks.2012-02-15