22 template <
typename Real>
35 template <
typename Real>
55 template <
typename Real>
65 for (
int i = 0; i < 2; ++i)
67 s[i] =
Dot(halfspace.normal, segment.p[i]) - halfspace.constant;
72 result.intersect = (std::max(s[0], s[1]) >= (Real)0);
76 template <
typename Real>
95 int numPositive = 0, numNegative = 0, numZero = 0;
96 for (
int i = 0; i < 2; ++i)
98 s[i] =
Dot(halfspace.normal, segment.p[i]) - halfspace.constant;
103 else if (s[i] < (Real)0)
115 if (numNegative == 0)
118 result.intersect =
true;
119 result.numPoints = 2;
120 result.point[0] = segment.p[0];
121 result.point[1] = segment.p[1];
123 else if (numNegative == 1)
125 result.intersect =
true;
126 result.numPoints = 1;
127 if (numPositive == 1)
130 result.point[0] = segment.p[0] +
131 (s[0] / (s[0] - s[1]))*(segment.p[1] - segment.p[0]);
138 result.point[0] = segment.p[0];
142 result.point[0] = segment.p[1];
149 result.intersect =
false;
150 result.numPoints = 0;
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)