21 template <
typename Real>
34 template <
typename Real>
43 std::array<Vector3<Real>, 2>
point;
56 template <
typename Real>
73 Real a2 =
Dot(line.direction, matDir);
74 Real a1 =
Dot(line.direction, matDiff);
75 Real a0 =
Dot(diff, matDiff) - (Real)1;
78 Real discr = a1*a1 - a0*a2;
79 result.intersect = (discr >= (Real)0);
83 template <
typename Real>
89 DoQuery(line.origin, line.direction, ellipsoid, result);
90 for (
int i = 0; i < result.numIntersections; ++i)
92 result.point[i] = line.origin + result.parameter[i] * line.direction;
97 template <
typename Real>
112 Real a2 =
Dot(lineDirection, matDir);
113 Real a1 =
Dot(lineDirection, matDiff);
114 Real a0 =
Dot(diff, matDiff) - (Real)1;
117 Real discr = a1*a1 - a0*a2;
120 result.intersect =
true;
121 result.numIntersections = 2;
122 Real root = sqrt(discr);
123 Real inv = ((Real)1) / a2;
124 result.parameter[0] = (-a1 - root)*inv;
125 result.parameter[1] = (-a1 + root)*inv;
127 else if (discr < (Real)0)
129 result.intersect =
false;
130 result.numIntersections = 0;
134 result.intersect =
true;
135 result.numIntersections = 1;
136 result.parameter[0] = -a1 / a2;
void GetM(Matrix< N, N, Real > &M) const
std::array< Vector3< Real >, 2 > point
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
std::array< Real, 2 > parameter
Result operator()(Type0 const &primitive0, Type1 const &primitive1)