Skip to main content
GameDev.net gamedev.net
🔒 Locked

Determining whether an edge on a mesh is convex or concave

Started by _swx_ Sep 16, 2008 at 7:21 AM 2 replies 7k views
Original Post
_swx_
_swx_
Can anyone suggest a robust way of determining whether an edge on a mesh is convex or concave? An edge is concave if the interior angle between the triangles connected by the edge is > 180 degrees, so any suggestion how to get that (or the exterior angle) would solve the problem.
haegarr
haegarr
If na and nb are the normals of the both adjacent faces, and pa and pb vertices of the both faces that are not connected to the edge in question, wherein na and pa belongs to the face A, and nb and pb to the face B, then

( pb - pa ) . na <= 0 => ridge edge

as well as

( pb - pa ) . na > 0 => valley edge

where "ridge edge" denotes what you have named convex edge, and "valley edge" denotes what you've named concave edge.

You can avoid numerical inaccuracies in nearly flat connections to be classified if you compute the dot-product of the both normals and compare that with a defined threshold, and do the above decision only of the threshold is exceeded.
oliii
oliii
check if opposite vertex on one of the triangle is back-facing the other triangle's plane.

e.g. triangle A, B, C, and C, B, D are linked by edge BC.

check if A is back facing or front facing the plane of [C, B, D].
Everything is better with Metal.
_swx_
_swx_
Thanks, gonna try it out when I get the time :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.