Skip to content

Commit

Permalink
BUG: fix ray quadric intersection for tangent rays
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rit committed Oct 1, 2021
1 parent 1ccea89 commit 25567c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rtkQuadricShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ QuadricShape ::IsIntersectedByRay(const PointType & rayOrigin,
else
{
ScalarType discriminant = Bq * Bq - 4 * Aq * Cq;
if (discriminant <= zero)
// The epsilon value allows detection of very close intersections, i.e., a
// ray tangent to the quadric
static constexpr ScalarType eps = 1e5 * itk::NumericTraits<ScalarType>::epsilon();
if (discriminant <= eps)
{
// No intersection but one might be dealing with an infinite line
// in the quadric, e.g. a line parallel to and in a cylinder.
Expand Down

0 comments on commit 25567c6

Please sign in to comment.