46 template <
typename Real>
53 Result(Real inEpsilon = (Real)0);
65 template <
typename Real>
67 Result(Real inEpsilon)
69 if (inEpsilon >= (Real)0)
79 template <
typename Real>
89 box0.GetCenteredForm(C0, E0);
96 Real
const cutoff = (Real)1 - result.epsilon;
97 bool existsParallelPair =
false;
108 for (
int i = 0; i < 3; ++i)
110 dot01[0][i] = A1[i][0];
111 absDot01[0][i] =
std::abs(A1[i][0]);
112 if (absDot01[0][i] >= cutoff)
114 existsParallelPair =
true;
118 r1 = E1[0] * absDot01[0][0] + E1[1] * absDot01[0][1] + E1[2] * absDot01[0][2];
122 result.intersect =
false;
123 result.separating[0] = 0;
124 result.separating[1] = -1;
129 for (
int i = 0; i < 3; ++i)
131 dot01[1][i] = A1[i][1];
132 absDot01[1][i] =
std::abs(A1[i][1]);
133 if (absDot01[1][i] >= cutoff)
135 existsParallelPair =
true;
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] = A1[i][2];
153 absDot01[2][i] =
std::abs(A1[i][2]);
154 if (absDot01[2][i] >= cutoff)
156 existsParallelPair =
true;
160 r1 = E1[0] * absDot01[2][0] + E1[1] * absDot01[2][1] + E1[2] * absDot01[2][2];
164 result.intersect =
false;
165 result.separating[0] = 2;
166 result.separating[1] = -1;
172 r0 = E0[0] * absDot01[0][0] + E0[1] * absDot01[1][0] + E0[2] * absDot01[2][0];
176 result.intersect =
false;
177 result.separating[0] = -1;
178 result.separating[1] = 0;
184 r0 = E0[0] * absDot01[0][1] + E0[1] * absDot01[1][1] + E0[2] * absDot01[2][1];
188 result.intersect =
false;
189 result.separating[0] = -1;
190 result.separating[1] = 1;
196 r0 = E0[0] * absDot01[0][2] + E0[1] * absDot01[1][2] + E0[2] * absDot01[2][2];
200 result.intersect =
false;
201 result.separating[0] = -1;
202 result.separating[1] = 2;
208 if (existsParallelPair)
210 result.intersect =
true;
215 r =
std::abs(D[2] * dot01[1][0] - D[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(D[2] * dot01[1][1] - D[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(D[2] * dot01[1][2] - D[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(D[0] * dot01[2][0] - D[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(D[0] * dot01[2][1] - D[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(D[0] * dot01[2][2] - D[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(D[1] * dot01[0][0] - D[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(D[1] * dot01[0][1] - D[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(D[1] * dot01[0][2] - D[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)