Commit ecd0fd4c authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

ACG::Geometry::triangleIntersection has way too large epsilon on the

area of the triangle causing it to find no intersections in settings
with moderately small triangles.

Choosing an epsilon relative to the underlying floating point type now.

Fixes #84.
parent 45ba92b7
......@@ -1337,8 +1337,10 @@ triangleIntersection( const Vec& _o,
//if determinant is near zero, the ray lies in plane of triangle
det = edge1 | pvec;
if (det > -0.000001 && det < 0.000001)
static const typename Vec::value_type EPSILON = std::numeric_limits<typename Vec::value_type>::epsilon() * 1e2;
if (det > -EPSILON && det < EPSILON) {
return false;
inv_det = typename Vec::value_type(1.0) / det;
//calculate distance from vert0 to ray origin
Supports Markdown
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