Sign in to follow this  
rosewell

Point in degenerate triangle?

Recommended Posts

I'm testing this point in triangle test, and it doesn't seem to work for degenerate or very thin triangles: http://jgt.akpeters.com/papers/MollerTrumbore97/ It thinks the ray lies in the plane of the triangle, which is of course correct depending on how you look at it. Just wondering if there's an acceptable way to let this test return TRUE if the ray hits a degenerate triangle.

Share this post


Link to post
Share on other sites
A degenerate triangle is either a line segment or a single point. So, one way of looking at the "point in degenerate triangle" test is that the point must be on the line segment, or be coincident with the point, that the line segment degenerates to. Problem is, point-on-segment and point-equals-point tests also are subject to floating point precision issues, so these aren't perfect alternate tests either.

So, it can be tricky. My recommendation is to look at Christer Ericson's discussion of achieving robust geometric tests using "thick" primitives. You can find the discussin in his excellent book, Real-Time Collision Detection, or (perhaps in less detail) in his lecture that is part of Jim van Verth's game physics series, presented at the Game Developer's Conference each year and available in powerpoint form here:

GDC Tutorial on game math/physics

Share this post


Link to post
Share on other sites
Thanks. I should also mention I'm only using this for the 2D case, so if a ray hits a degenerate triangle, it will never lie in the plane,
because all triangles are assumed to be perfectly perpendicular to the ray.

I suppose if the test returns zero, then I will have to default to a PointOnLine test or something.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this