37 Point RelPoint = p - mCenter;
42 float f = mRot.m[0][0] * RelPoint.x + mRot.m[0][1] * RelPoint.y + mRot.m[0][2] * RelPoint.z;
43 if(
f >= mExtents.x ||
f <= -mExtents.x)
return false;
45 f = mRot.m[1][0] * RelPoint.x + mRot.m[1][1] * RelPoint.y + mRot.m[1][2] * RelPoint.z;
46 if(
f >= mExtents.y ||
f <= -mExtents.y)
return false;
48 f = mRot.m[2][0] * RelPoint.x + mRot.m[2][1] * RelPoint.y + mRot.m[2][2] * RelPoint.z;
49 if(
f >= mExtents.z ||
f <= -mExtents.z)
return false;
85 if(!planes)
return false;
87 Point Axis0 = mRot[0];
88 Point Axis1 = mRot[1];
89 Point Axis2 = mRot[2];
100 Point p0 = mCenter + Axis0 * mExtents.x;
101 Point p1 = mCenter - Axis0 * mExtents.x;
102 Point p2 = mCenter + Axis1 * mExtents.y;
103 Point p3 = mCenter - Axis1 * mExtents.y;
104 Point p4 = mCenter + Axis2 * mExtents.z;
105 Point p5 = mCenter - Axis2 * mExtents.z;
108 planes[0].
d = -(planes[0].
n|p0);
109 planes[1].
d = -(planes[1].
n|p1);
110 planes[2].
d = -(planes[2].
n|p2);
111 planes[3].
d = -(planes[3].
n|p3);
112 planes[4].
d = -(planes[4].
n|p4);
113 planes[5].
d = -(planes[5].
n|p5);
128 if(!pts)
return false;
130 Point Axis0 = mRot[0];
131 Point Axis1 = mRot[1];
132 Point Axis2 = mRot[2];
147 pts[0] = mCenter - Axis0 - Axis1 - Axis2;
148 pts[1] = mCenter + Axis0 - Axis1 - Axis2;
149 pts[2] = mCenter + Axis0 + Axis1 - Axis2;
150 pts[3] = mCenter - Axis0 + Axis1 - Axis2;
151 pts[4] = mCenter - Axis0 - Axis1 + Axis2;
152 pts[5] = mCenter + Axis0 - Axis1 + Axis2;
153 pts[6] = mCenter + Axis0 + Axis1 + Axis2;
154 pts[7] = mCenter - Axis0 + Axis1 + Axis2;
168 static float VertexNormals[] =
180 if(!pts)
return false;
182 const Point* VN = (
const Point*)VertexNormals;
185 pts[
i] = VN[
i] * mRot;
199 static udword Indices[] = {
200 0, 1, 1, 2, 2, 3, 3, 0,
201 7, 6, 6, 5, 5, 4, 4, 7,
216 static float EdgeNormals[] =
233 return (
const Point*)EdgeNormals;
246 world_normal = GetLocalEdgeNormals()[edge_index] * mRot;
257 Point Axis0 = mRot[0];
258 Point Axis1 = mRot[1];
259 Point Axis2 = mRot[2];
261 switch(mExtents.LargestAxis())
264 lss.
mRadius = (mExtents.y + mExtents.z)*0.5
f;
265 lss.
mP0 = mCenter + Axis0 * (mExtents.x - lss.
mRadius);
266 lss.
mP1 = mCenter - Axis0 * (mExtents.x - lss.
mRadius);
269 lss.
mRadius = (mExtents.x + mExtents.z)*0.5
f;
270 lss.
mP0 = mCenter + Axis1 * (mExtents.y - lss.
mRadius);
271 lss.
mP1 = mCenter - Axis1 * (mExtents.y - lss.
mRadius);
274 lss.
mRadius = (mExtents.x + mExtents.y)*0.5
f;
275 lss.
mP0 = mCenter + Axis2 * (mExtents.z - lss.
mRadius);
276 lss.
mP1 = mCenter - Axis2 * (mExtents.z - lss.
mRadius);
300 Rotate(M0Inv, _1in0);
310 float f = fabsf(mtx.
m[0][0] * mExtents.x) + fabsf(mtx.
m[1][0] * mExtents.y) + fabsf(mtx.
m[2][0] * mExtents.z) -
box.mExtents.x;
314 f = fabsf(mtx.
m[0][1] * mExtents.x) + fabsf(mtx.
m[1][1] * mExtents.y) + fabsf(mtx.
m[2][1] * mExtents.z) -
box.mExtents.y;
318 f = fabsf(mtx.
m[0][2] * mExtents.x) + fabsf(mtx.
m[1][2] * mExtents.y) + fabsf(mtx.
m[2][2] * mExtents.z) -
box.mExtents.z;