19 template <
typename Real>
31 template <
typename Real>
49 template <
typename Real>
67 Real DdN =
Dot(ray.direction, normal);
73 else if (DdN < (Real)0)
82 result.intersect =
false;
86 Real DdQxE2 = sign*
DotCross(ray.direction, diff, edge2);
87 if (DdQxE2 >= (Real)0)
89 Real DdE1xQ = sign*
DotCross(ray.direction, edge1, diff);
90 if (DdE1xQ >= (Real)0)
92 if (DdQxE2 + DdE1xQ <= DdN)
95 Real QdN = -sign*
Dot(diff, normal);
99 result.intersect =
true;
110 result.intersect =
false;
114 template <
typename Real>
119 triangleBary[0] = (Real)0;
120 triangleBary[1] = (Real)0;
121 triangleBary[2] = (Real)0;
124 template <
typename Real>
142 Real DdN =
Dot(ray.direction, normal);
148 else if (DdN < (Real)0)
157 result.intersect =
false;
161 Real DdQxE2 = sign*
DotCross(ray.direction, diff, edge2);
162 if (DdQxE2 >= (Real)0)
164 Real DdE1xQ = sign*
DotCross(ray.direction, edge1, diff);
165 if (DdE1xQ >= (Real)0)
167 if (DdQxE2 + DdE1xQ <= DdN)
170 Real QdN = -sign*
Dot(diff, normal);
174 result.intersect =
true;
175 Real inv = ((Real)1) / DdN;
176 result.parameter = QdN*inv;
177 result.triangleBary[1] = DdQxE2*inv;
178 result.triangleBary[2] = DdE1xQ*inv;
179 result.triangleBary[0] = (Real)1 - result.triangleBary[1]
180 - result.triangleBary[2];
181 result.point = ray.origin +
182 result.parameter * ray.direction;
193 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)