Jump to content
• Advertisement

Is a polygon convex or concave?

This topic is 3793 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! I wonder how I can check wether a 3d polygon is convex or concave. Is there a way without projecting the polygon into 2d space? Thank you! Christian

Share this post

Share on other sites
Advertisement
Iterate through all your vertices. For each vertex you take the cross product of the two vectors pointing to the adjacent points (connected by the two adjoining edges), and checking that the sign of these cross products are all the same. They should all have the same direction if convex, otherwise some will point in the opposite direction.

In general, you can just check the sign for each component of the cross product. It is often sufficient to just use (and therefore compute) one component, but this assumes that the plane of the polygon is not parallel to the associated axis.

For efficiency, I would take the first 3 vertices, compute normal of their triangle, and find the largest component. For the rest of the vertices, I would only compute the component of the cross product associated wit this component. This is roughly equivalent to choosing a non-degenerate projection plane and projecting it to 2D and searching for reflex angles.

Share this post

Share on other sites
Thank you for your detailed explanations, this helped me a lot.
Christian

Share this post

Share on other sites

• Advertisement
• Advertisement

• Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5
• Advertisement

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×

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!