Jump to content
  • Advertisement

Archived

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

_dragon_

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!