31 #define FINDMINMAX(x0, x1, x2, minV, maxV) \
43 #define AXISTEST_X01(a, b, fa, fb) \
44 minV = a * v0[1] - b * v0[2]; \
45 maxV = a * v2[1] - b * v2[2]; \
46 if (maxV < minV) std::swap(minV, maxV); \
47 rad = fa * boxhalfSize.y + fb * boxhalfSize.z; \
48 if (minV > rad || maxV < -rad) return 0;
49 #define AXISTEST_X2(a, b, fa, fb) \
50 minV = a * v0[1] - b * v0[2]; \
51 maxV = a * v1[1] - b * v1[2]; \
52 if (maxV < minV) std::swap(minV, maxV); \
53 rad = fa * boxhalfSize.y + fb * boxhalfSize.z; \
54 if (minV > rad || maxV < -rad) return 0;
57 #define AXISTEST_Y02(a, b, fa, fb) \
58 minV = -a * v0[0] + b * v0[2]; \
59 maxV = -a * v2[0] + b * v2[2]; \
60 if (maxV < minV) std::swap(minV, maxV); \
61 rad = fa * boxhalfSize.x + fb * boxhalfSize.z; \
62 if (minV > rad || maxV < -rad) return 0;
63 #define AXISTEST_Y1(a, b, fa, fb) \
64 minV = -a * v0[0] + b * v0[2]; \
65 maxV = -a * v1[0] + b * v1[2]; \
66 if (maxV < minV) std::swap(minV, maxV); \
67 rad = fa * boxhalfSize.x + fb * boxhalfSize.z; \
68 if (minV > rad || maxV < -rad) return 0;
71 #define AXISTEST_Z12(a, b, fa, fb) \
72 minV = a * v1[0] - b * v1[1]; \
73 maxV = a * v2[0] - b * v2[1]; \
74 if (maxV < minV) std::swap(minV, maxV); \
75 rad = fa * boxhalfSize.x + fb * boxhalfSize.y; \
76 if (minV > rad || maxV < -rad) return 0;
77 #define AXISTEST_Z0(a, b, fa, fb) \
78 minV = a * v0[0] - b * v0[1]; \
79 maxV = a * v1[0] - b * v1[1]; \
80 if (maxV < minV) std::swap(minV, maxV); \
81 rad = fa * boxhalfSize.x + fb * boxhalfSize.y; \
82 if (minV > rad || maxV < -rad) return 0;
90 double enlargeFactor ) {
100 if (enlargeFactor > 0)
102 (1.0 + enlargeFactor));
110 dimMax = dimMin + dd;
122 dimMax = dimMin + dd;
198 if (minV > boxhalfSize.
x || maxV < -boxhalfSize.
x)
return false;
202 if (minV > boxhalfSize.
y || maxV < -boxhalfSize.
y)
return false;
206 if (minV > boxhalfSize.
z || maxV < -boxhalfSize.
z)
return false;
219 e0[0] = -boxhalfSize.
x - v0[0];
220 e1[0] = boxhalfSize.
x - v0[0];
222 e0[0] = boxhalfSize.
x - v0[0];
223 e1[0] = -boxhalfSize.
x - v0[0];
226 e0[1] = -boxhalfSize.
y - v0[1];
227 e1[1] = boxhalfSize.
y - v0[1];
229 e0[1] = boxhalfSize.
y - v0[1];
230 e1[1] = -boxhalfSize.
y - v0[1];
233 e0[2] = -boxhalfSize.
z - v0[2];
234 e1[2] = boxhalfSize.
z - v0[2];
236 e0[2] = boxhalfSize.
z - v0[2];
237 e1[2] = -boxhalfSize.
z - v0[2];
263 double v0[3], v1[3], v2[3];
274 double rad, fex, fey, fez;
319 if (minV > boxhalfSize.
x || maxV < -boxhalfSize.
x)
return false;
323 if (minV > boxhalfSize.
y || maxV < -boxhalfSize.
y)
return false;
327 if (minV > boxhalfSize.
z || maxV < -boxhalfSize.
z)
return false;
340 e0[0] = -boxhalfSize.
x - v0[0];
341 e1[0] = boxhalfSize.
x - v0[0];
343 e0[0] = boxhalfSize.
x - v0[0];
344 e1[0] = -boxhalfSize.
x - v0[0];
347 e0[1] = -boxhalfSize.
y - v0[1];
348 e1[1] = boxhalfSize.
y - v0[1];
350 e0[1] = boxhalfSize.
y - v0[1];
351 e1[1] = -boxhalfSize.
y - v0[1];
354 e0[2] = -boxhalfSize.
z - v0[2];
355 e1[2] = boxhalfSize.
z - v0[2];
357 e0[2] = boxhalfSize.
z - v0[2];
358 e1[2] = -boxhalfSize.
z - v0[2];
float PointCoordinateType
Type of the coordinates of a (N-D) point.
void normalize()
Sets vector norm to unity.
Vector3Tpl orthogonal() const
Returns a normalized vector which is orthogonal to this one.
Vector3Tpl cross(const Vector3Tpl &v) const
Cross product.
static void vsubstract(const PointCoordinateType p[], const PointCoordinateType q[], PointCoordinateType r[])
static PointCoordinateType vdot(const PointCoordinateType p[], const PointCoordinateType q[])
static void vcross(const PointCoordinateType p[], const PointCoordinateType q[], PointCoordinateType r[])
__host__ __device__ int2 abs(int2 v)
Generic file read and write utility for python interface.