17 template <
typename Real>
29 template <
typename Real>
32 public FIQuery<Real, Line3<Real>, Sphere3<Real>>
37 public FIQuery<Real, Line3<Real>, Sphere3<Real>>::Result
51 template <
typename Real>
63 Real a0 =
Dot(diff, diff) - sphere.radius * sphere.radius;
67 result.intersect =
true;
72 Real a1 =
Dot(ray.direction, diff);
75 result.intersect =
false;
80 Real discr = a1*a1 - a0;
81 result.intersect = (discr >= (Real)0);
85 template <
typename Real>
91 DoQuery(ray.origin, ray.direction, sphere, result);
92 for (
int i = 0; i < result.numIntersections; ++i)
94 result.point[i] = ray.origin + result.parameter[i] * ray.direction;
99 template <
typename Real>
105 rayDirection, sphere, result);
107 if (result.intersect)
112 std::array<Real, 2> rayInterval =
113 { (Real)0, std::numeric_limits<Real>::max() };
115 auto iiResult = iiQuery(result.parameter, rayInterval);
116 if (iiResult.intersect)
118 result.numIntersections = iiResult.numIntersections;
119 result.parameter = iiResult.overlap;
123 result.intersect =
false;
124 result.numIntersections = 0;
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)