Commit c1dd67b8 authored by mattijs's avatar mattijs
Browse files

if miss calculate triangle-plane intersection

parent 42082f42
......@@ -376,16 +376,29 @@ inline pointHit triangle<Point, PointRef>::ray
return ray(p, q1 - n, alg, intersection::VECTOR);
}
// Intersection point with triangle plane
point pInter;
// Is intersection point inside triangle
bool hit;
{
// Reuse the fast ray intersection routine below in FULL_RAY
// mode since the original intersection routine has rounding problems.
pointHit fastInter = intersection(p, q1, intersection::FULL_RAY);
pInter = fastInter.rawPoint();
hit = fastInter.hit();
if (hit)
{
pInter = fastInter.rawPoint();
}
else
{
// Calculate intersection of ray with triangle plane
vector v = a_ - p;
pInter = p + (q1&v)*q1;
}
}
// Distance to intersection point
scalar dist = q1 & (pInter - p);
const scalar planarPointTol =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment