19 template <
typename Real>
32 template <
typename Real>
51 template <
typename Real>
69 Real DdN =
Dot(line.direction, normal);
75 else if (DdN < (Real)0)
84 result.intersect =
false;
88 Real DdQxE2 = sign*
DotCross(line.direction, diff, edge2);
89 if (DdQxE2 >= (Real)0)
91 Real DdE1xQ = sign*
DotCross(line.direction, edge1, diff);
92 if (DdE1xQ >= (Real)0)
94 if (DdQxE2 + DdE1xQ <= DdN)
97 result.intersect =
true;
106 result.intersect =
false;
110 template <
typename Real>
115 triangleBary[0] = (Real)0;
116 triangleBary[1] = (Real)0;
117 triangleBary[2] = (Real)0;
120 template <
typename Real>
138 Real DdN =
Dot(line.direction, normal);
144 else if (DdN < (Real)0)
153 result.intersect =
false;
157 Real DdQxE2 = sign*
DotCross(line.direction, diff, edge2);
158 if (DdQxE2 >= (Real)0)
160 Real DdE1xQ = sign*
DotCross(line.direction, edge1, diff);
161 if (DdE1xQ >= (Real)0)
163 if (DdQxE2 + DdE1xQ <= DdN)
166 Real QdN = -sign*
Dot(diff, normal);
167 Real inv = ((Real)1) / DdN;
169 result.intersect =
true;
170 result.parameter = QdN*inv;
171 result.triangleBary[1] = DdQxE2*inv;
172 result.triangleBary[2] = DdE1xQ*inv;
173 result.triangleBary[0] = (Real)1 - result.triangleBary[1]
174 - result.triangleBary[2];
175 result.point = line.origin +
176 result.parameter * line.direction;
185 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)