#### Archived

This topic is now archived and is closed to further replies.

# MATH problem....

This topic is 6593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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!

##### Share on other sites
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?

##### Share on other sites
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.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633701
• Total Posts
3013445
×