45 template <
typename Real>
52 Result(Real inEpsilon = (Real)0);
64 template <
typename Real>
66 Result(Real inEpsilon)
68 if (inEpsilon >= (Real)0)
78 template <
typename Real>
93 const Real cutoff = (Real)1 - result.epsilon;
94 bool existsParallelPair =
false;
106 for (
int i = 0; i < 3; ++i)
108 dot01[0][i] =
Dot(A0[0], A1[i]);
109 absDot01[0][i] =
std::abs(dot01[0][i]);
110 if (absDot01[0][i] > cutoff)
112 existsParallelPair =
true;
115 dotDA0[0] =
Dot(D, A0[0]);
117 r1 = E1[0] * absDot01[0][0] + E1[1] * absDot01[0][1] + E1[2] * absDot01[0][2];
121 result.intersect =
false;
122 result.separating[0] = 0;
123 result.separating[1] = -1;
128 for (
int i = 0; i < 3; ++i)
130 dot01[1][i] =
Dot(A0[1], A1[i]);
131 absDot01[1][i] =
std::abs(dot01[1][i]);
132 if (absDot01[1][i] > cutoff)
134 existsParallelPair =
true;
137 dotDA0[1] =
Dot(D, A0[1]);
139 r1 = E1[0] * absDot01[1][0] + E1[1] * absDot01[1][1] + E1[2] * absDot01[1][2];
143 result.intersect =
false;
144 result.separating[0] = 1;
145 result.separating[1] = -1;
150 for (
int i = 0; i < 3; ++i)
152 dot01[2][i] =
Dot(A0[2], A1[i]);
153 absDot01[2][i] =
std::abs(dot01[2][i]);
154 if (absDot01[2][i] > cutoff)
156 existsParallelPair =
true;
159 dotDA0[2] =
Dot(D, A0[2]);
161 r1 = E1[0] * absDot01[2][0] + E1[1] * absDot01[2][1] + E1[2] * absDot01[2][2];
165 result.intersect =
false;
166 result.separating[0] = 2;
167 result.separating[1] = -1;
173 r0 = E0[0] * absDot01[0][0] + E0[1] * absDot01[1][0] + E0[2] * absDot01[2][0];
177 result.intersect =
false;
178 result.separating[0] = -1;
179 result.separating[1] = 0;
185 r0 = E0[0] * absDot01[0][1] + E0[1] * absDot01[1][1] + E0[2] * absDot01[2][1];
189 result.intersect =
false;
190 result.separating[0] = -1;
191 result.separating[1] = 1;
197 r0 = E0[0] * absDot01[0][2] + E0[1] * absDot01[1][2] + E0[2] * absDot01[2][2];
201 result.intersect =
false;
202 result.separating[0] = -1;
203 result.separating[1] = 2;
209 if (existsParallelPair)
215 r =
std::abs(dotDA0[2] * dot01[1][0] - dotDA0[1] * dot01[2][0]);
216 r0 = E0[1] * absDot01[2][0] + E0[2] * absDot01[1][0];
217 r1 = E1[1] * absDot01[0][2] + E1[2] * absDot01[0][1];
221 result.intersect =
false;
222 result.separating[0] = 0;
223 result.separating[1] = 0;
228 r =
std::abs(dotDA0[2] * dot01[1][1] - dotDA0[1] * dot01[2][1]);
229 r0 = E0[1] * absDot01[2][1] + E0[2] * absDot01[1][1];
230 r1 = E1[0] * absDot01[0][2] + E1[2] * absDot01[0][0];
234 result.intersect =
false;
235 result.separating[0] = 0;
236 result.separating[1] = 1;
241 r =
std::abs(dotDA0[2] * dot01[1][2] - dotDA0[1] * dot01[2][2]);
242 r0 = E0[1] * absDot01[2][2] + E0[2] * absDot01[1][2];
243 r1 = E1[0] * absDot01[0][1] + E1[1] * absDot01[0][0];
247 result.intersect =
false;
248 result.separating[0] = 0;
249 result.separating[1] = 2;
254 r =
std::abs(dotDA0[0] * dot01[2][0] - dotDA0[2] * dot01[0][0]);
255 r0 = E0[0] * absDot01[2][0] + E0[2] * absDot01[0][0];
256 r1 = E1[1] * absDot01[1][2] + E1[2] * absDot01[1][1];
260 result.intersect =
false;
261 result.separating[0] = 1;
262 result.separating[1] = 0;
267 r =
std::abs(dotDA0[0] * dot01[2][1] - dotDA0[2] * dot01[0][1]);
268 r0 = E0[0] * absDot01[2][1] + E0[2] * absDot01[0][1];
269 r1 = E1[0] * absDot01[1][2] + E1[2] * absDot01[1][0];
273 result.intersect =
false;
274 result.separating[0] = 1;
275 result.separating[1] = 1;
280 r =
std::abs(dotDA0[0] * dot01[2][2] - dotDA0[2] * dot01[0][2]);
281 r0 = E0[0] * absDot01[2][2] + E0[2] * absDot01[0][2];
282 r1 = E1[0] * absDot01[1][1] + E1[1] * absDot01[1][0];
286 result.intersect =
false;
287 result.separating[0] = 1;
288 result.separating[1] = 2;
293 r =
std::abs(dotDA0[1] * dot01[0][0] - dotDA0[0] * dot01[1][0]);
294 r0 = E0[0] * absDot01[1][0] + E0[1] * absDot01[0][0];
295 r1 = E1[1] * absDot01[2][2] + E1[2] * absDot01[2][1];
299 result.intersect =
false;
300 result.separating[0] = 2;
301 result.separating[1] = 0;
306 r =
std::abs(dotDA0[1] * dot01[0][1] - dotDA0[0] * dot01[1][1]);
307 r0 = E0[0] * absDot01[1][1] + E0[1] * absDot01[0][1];
308 r1 = E1[0] * absDot01[2][2] + E1[2] * absDot01[2][0];
312 result.intersect =
false;
313 result.separating[0] = 2;
314 result.separating[1] = 1;
319 r =
std::abs(dotDA0[1] * dot01[0][2] - dotDA0[0] * dot01[1][2]);
320 r0 = E0[0] * absDot01[1][2] + E0[1] * absDot01[0][2];
321 r1 = E1[0] * absDot01[2][1] + E1[1] * absDot01[2][0];
325 result.intersect =
false;
326 result.separating[0] = 2;
327 result.separating[1] = 2;
331 result.intersect =
true;
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)