Archived

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

detecting if 2 triangles are concave or convex.

This topic is 5579 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

Let''s say I have 2 triangles in 3d space that share an edge. I have each ones normal. How can I tell if they are concave or convex?
  
side view:

    ___|___     \
   /             \/
 \/               \
 /                 \___|___
/

  [concave]       [convex]
  
What if they share only a vertex? Thanks you, wolfman8k

Share this post


Link to post
Share on other sites
quote:
Original post by Hybrid
Couldn''t you just check the angles between the two edges.

That picture looks like some 2D trigonometry, so thats why I suggest an angle checking method as a possible solution


Ok, but first of all, how do I check the angle between the two edges? Second, even if I could, how would I explicitly check the angle on the correct side of the edges(the one where the normals are pointing)?

Thank you.

Share this post


Link to post
Share on other sites
Just testing the angle between the normals isn''t enough. For example, just by moving the triangles from the examples above without changing there normals:

  
side view:

|
B |
___|___ | \ A
A / | \/
\/ | \ B
/ | \___|___
/ |
|
[concave] | [convex]
|
| | |
\|/ | \|/
|
| B
A / | ___|___
\/ | \ A
B / | \/
___|___/ | \
| \
[convex] | [concave]
|

Share this post


Link to post
Share on other sites
I presume A and B are supposed to indicate the surface normals? I''ll ut the non-orthogonality of the pictures down to the limitations of ascii art!

There may indeed be an easier method, but here is one answer to your problem. First, impose an ordering of traversal along the edge. Call A the first triangle edge and B the second triangle edge.

1) Compute the tangent vector (T) to B, so that T.NB = 0. Additionally, choose the positive direction for the tangent vector to be away from A (i.e., in the positive traversal direction)

2) Compute the components of the normal NA in the directions of T and NB, so that NA = a1T + a2NB

A is concave if a1 < 0 and convex if a1 > 0.

As I said though, there may be an easier way... I just cannot think of it at this time.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
Using the below image as a guide:



Take the cross-product of N1 with the line AB, call this vector V. Choose V s.t. V dot BC is < 0 (if it > 0, simply negate it). Take the dot-product of this vector with N2. If that''s < 0 then the triangles are concave.

Actually this looks similar to Timkin''s method, but mine had pictures

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Share this post


Link to post
Share on other sites