17 #ifdef WITH_CXX_GUARDEDALLOC
36 {{{0, 0}, {0, 1}, {1, 1}}, {{0, 2}, {0, 3}, {1, 3}}, {{2, 2}, {2, 3}, {3, 3}}},
38 {{{0, 4}, {0, 5}, {1, 5}}, {{0, 6}, {0, 7}, {1, 7}}, {{2, 6}, {2, 7}, {3, 7}}},
40 {{{4, 4}, {4, 5}, {5, 5}}, {{4, 6}, {4, 7}, {5, 7}}, {{6, 6}, {6, 7}, {7, 7}}}};
71 res[0] =
a[1] * b[2] -
a[2] * b[1];
72 res[1] =
a[2] * b[0] -
a[0] * b[2];
73 res[2] =
a[0] * b[1] -
a[1] * b[0];
76 static void crossProduct(
double res[3],
const double a[3],
const double b[3])
78 res[0] =
a[1] * b[2] -
a[2] * b[1];
79 res[1] =
a[2] * b[0] -
a[0] * b[2];
80 res[2] =
a[0] * b[1] -
a[1] * b[0];
88 return a[0] * b[0] +
a[1] * b[1] +
a[2] * b[2];
93 double mag =
a[0] *
a[0] +
a[1] *
a[1] +
a[2] *
a[2];
127 for (
int i = 0; i < 3; i++) {
128 for (
int j = 0; j < 3; j++)
129 tri_edges[i][j] = tri[(i + 1) % 3][j] - tri[i][j];
137 for (
int i = 0; i < 3; i++) {
138 for (
int j = 0; j < 3; j++) {
161 double dedge1[] = {(
double)tri[1][0] - (
double)tri[0][0],
162 (
double)tri[1][1] - (
double)tri[0][1],
163 (
double)tri[1][2] - (
double)tri[0][2]};
164 double dedge2[] = {(
double)tri[2][0] - (
double)tri[1][0],
165 (
double)tri[2][1] - (
double)tri[1][1],
166 (
double)tri[2][2] - (
double)tri[1][2]};
171 for (i = 0; i < 3; i++) {
172 for (
int j = 0; j < 3; j++) {
175 cubeedge[i][i] =
cube[1][i] -
cube[0][i];
179 for (
int axis = 0; axis <
NUM_AXES; axis++) {
186 for (i = 0; i < 3; i++)
192 for (i = 1; i < 8; i++) {
207 for (
int axis = 0; axis <
NUM_AXES; axis++) {
215 for (i = 1; i < 3; i++) {
235 for (
int i = 0; i <
NUM_AXES; i++) {
238 for (
int j = 0; j < 3; j++)
249 int bmask[3][2] = {{0, 0}, {0, 0}, {0, 0}};
250 unsigned char boxmask = 0;
253 for (i = 0; i < 3; i++) {
260 if (mid < inherit->tri_proj[i][1]) {
267 for (i = 0; i < 2; i++) {
268 for (j = 0; j < 2; j++) {
269 for (k = 0; k < 2; k++) {
270 boxmask |= ((bmask[0][i] & bmask[1][j] & bmask[2][k]) << ct);
285 for (
int i = 0; i <
NUM_AXES; i++) {
296 for (
int i = 0; i <
NUM_AXES; i++) {
311 if (proj0 >
inherit->
tri_proj[i][1] || proj1 < inherit->tri_proj[i][0]) {
321 for (
int i = 0; i <
NUM_AXES; i++) {
327 if (proj0 >
inherit->
tri_proj[i][1] || proj1 < inherit->tri_proj[i][0]) {
332 if (proj1 >
inherit->
tri_proj[i][1] || proj0 < inherit->tri_proj[i][0]) {
357 if (alpha < 0 || alpha > 1)
typedef double(DMatrix)[4][4]
Read Guarded memory(de)allocation.
const int centmap[3][3][3][2]
static int64_t dotProduct(const int64_t a[3], const int64_t b[3])
static void create_projection_axes(int64_t axes[NUM_AXES][3], const int64_t tri[3][3])
static void crossProduct(int64_t res[3], const int64_t a[3], const int64_t b[3])
static void normalize(double a[3])
int isIntersecting() const
int isIntersectingPrimary(int edgeInd) const
CubeProjection cubeProj[NUM_AXES]
Projections of the cube vertices.
unsigned char getBoxMask()
TriangleProjection * inherit
Inheritable portion.
float getIntersectionPrimary(int edgeInd) const
static CCL_NAMESPACE_BEGIN const double alpha
int64_t tri_proj[NUM_AXES][2]
Projections of triangle (min and max)
double norm[3]
Normal of the triangle.
int index
Index of polygon.