MATH problem....

Started by
1 comment, last by _dragon_ 23 years, 4 months ago
hi folks! i have three 3d points (p1, p2, p3) which form a triangle and i want to know if the points are ordered in clockwise order. if not how can i resort/swap them to clockwise order? example: float p1[3]; float p2[3]; float p3[3]; // the 3 points are inited with external data ... // testing if points clockwise ??? // if not resort/swap them ??? // so that the order is now correct (clockwise) // when adding the points poly_add_point(p1); poly_add_point(p2); poly_add_point(p3); thanks!
Advertisement
The cw/ccw ordering of 3 vertices only make sense when you define a particular viewpoint. They are always ordered clockwise if you are viewing from one side of the triangle.

To change the winding of the triangle (the ordering of vertices) you can simply exchange any 2 of the vertices, e.g. p1 and p2.

Depending on the handedness (made up word?) of your coordinate system (left/right), a clockwise winding will define either the front or back face of the triangle.

What are you trying to achieve?
Whether handedness is a real word or not, I''ve heard it use it that exact context several times.

I think he wants his triangle to be visible
You can disable backface culling, which will always render the triangles.

Or you can look into Vertex Buffers, which are more efficent that triangle strips.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement