19 template <
typename Real>
32 template <
typename Real>
51 template <
typename Real>
60 segment.GetCenteredForm(segOrigin, segDirection, segExtent);
73 Real DdN =
Dot(segDirection, normal);
79 else if (DdN < (Real)0)
88 result.intersect =
false;
92 Real DdQxE2 = sign*
DotCross(segDirection, diff, edge2);
93 if (DdQxE2 >= (Real)0)
95 Real DdE1xQ = sign*
DotCross(segDirection, edge1, diff);
96 if (DdE1xQ >= (Real)0)
98 if (DdQxE2 + DdE1xQ <= DdN)
101 Real QdN = -sign*
Dot(diff, normal);
102 Real extDdN = segExtent*DdN;
103 if (-extDdN <= QdN && QdN <= extDdN)
106 result.intersect =
true;
117 result.intersect =
false;
121 template <
typename Real>
126 triangleBary[0] = (Real)0;
127 triangleBary[1] = (Real)0;
128 triangleBary[2] = (Real)0;
131 template <
typename Real>
140 segment.GetCenteredForm(segOrigin, segDirection, segExtent);
153 Real DdN =
Dot(segDirection, normal);
159 else if (DdN < (Real)0)
168 result.intersect =
false;
172 Real DdQxE2 = sign*
DotCross(segDirection, diff, edge2);
173 if (DdQxE2 >= (Real)0)
175 Real DdE1xQ = sign*
DotCross(segDirection, edge1, diff);
176 if (DdE1xQ >= (Real)0)
178 if (DdQxE2 + DdE1xQ <= DdN)
181 Real QdN = -sign*
Dot(diff, normal);
182 Real extDdN = segExtent*DdN;
183 if (-extDdN <= QdN && QdN <= extDdN)
186 result.intersect =
true;
187 Real inv = ((Real)1) / DdN;
188 result.parameter = QdN*inv;
189 result.triangleBary[1] = DdQxE2*inv;
190 result.triangleBary[2] = DdE1xQ*inv;
191 result.triangleBary[0] = (Real)1 - result.triangleBary[1]
192 - result.triangleBary[2];
193 result.point = segOrigin +
194 result.parameter * segDirection;
205 result.intersect =
false;
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
DualQuaternion< Real > Cross(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real DotCross(Vector< N, Real > const &v0, Vector< N, Real > const &v1, Vector< N, Real > const &v2)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)