# Point in degenerate triangle?

This topic is 3833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 11
• 11
• 15
• 11
• 11
• ### Forum Statistics

• Total Topics
634149
• Total Posts
3015834
×