#### Archived

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

# Ray-Triangle Intersection failure on edge

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

## Recommended Posts

I tried plenty of algorithms for ray-triangle intersection but all of them fail when intersection point lies on triangle edge. Does anybody know algorithm which works in such case? Thanks, Eddie

##### Share on other sites
do an if before dividing by 0!!.
Or make sure that the intersection is inside before trying to compute the uv.

##### Share on other sites
I meant that those algorithms returns false in some cases when intersection point is on triangle edge...maybe there is problem with precision, although all computations are done in double precision.

##### Share on other sites
it is a precision problem.
it cannot be solve whatever precision you choose.
Howver, you can have a seamless alogorithm in the sense that errors compensate, so that if two triangles share an edge, no rays will slip through the seam, and no rays will hit both triangles.

if you only test individual triangles, try adding an small edge around it

##### Share on other sites
Have you tried plucker coordinates?

##### Share on other sites
typically you have to add a tolerance variable, which is equivalent to adding an ''edge'' to the triangle.

For example,
if you want to do the TWOPi method, where you sum angles and the angles must be TWOPI, well, they are rarely equal to TWOPI the closer you get to an edge.

Subsequently, your angle must be greater than TWOPI - Tolerance and less than TWOPI + Tolerance.

• 36
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631359
• Total Posts
2999539
×