148 int inside_point_count = 0;
152 if (inside_point_count == 2) {
156 }
else if (inside_point_count == 1) {
184 float box_proj,p0_proj,dp_proj;
252 int inside_point_count = 0;
256 if (inside_point_count == 2) {
260 }
else if (inside_point_count == 1) {
269 Vector3 boxmin,boxmax;
273 float candidateplane[3];
282 for (
int i=0; i<3; i++) {
283 if (line.
Get_P0()[i] < boxmin[i]) {
285 candidateplane[i] = boxmin[i];
286 }
else if (line.
Get_P0()[i] > boxmax[i]) {
288 candidateplane[i] = boxmax[i];
295 for (i=0; i<3; i++) {
297 maxt[i] = (candidateplane[i] - line.
Get_P0()[i]) / line.
Get_DP()[i];
304 int intersection_plane = 0;
305 for (i=1; i<3; i++) {
306 if (maxt[i] > maxt[intersection_plane]) {
307 intersection_plane = i;
312 if (maxt[intersection_plane] < 0.0f) {
317 if (maxt[intersection_plane] > 1.0f) {
324 for (i=0; i<3; i++) {
326 if (intersection_plane != i) {
328 coord[i] = line.
Get_P0()[i] + maxt[intersection_plane] * line.
Get_DP()[i];
329 if ((coord[i] < boxmin[i]) || (coord[i] > boxmax[i])) {
335 coord[i] = candidateplane[i];
361 return eval_overlap_collision(res);
392 if (dist + move > extent) {
397 frac = (extent - dist) / move;
400 }
else if (dist < -extent) {
401 if (dist + move < -extent) {
406 frac = (-extent - dist) / move;
415 if (frac < result->Fraction) {
486static inline bool aab_separation_test
498 float u0 = context.
C[axis];
499 float u1 = u0 + context.
M[axis];
510 tmp = (rsum-u0)/(u1-u0);
523 tmp = (-rsum-u0)/(u1-u0);
562 if (aab_separation_test(context,0)) {
566 if (aab_separation_test(context,1)) {
570 if (aab_separation_test(context,2)) {
590 WWDEBUG_SAY((
"AABox-AABox collision does not currently support contact point computation\r\n"));
float Project_To_Axis(const Vector3 &axis) const
static bool Collide(const LineSegClass &line, const AAPlaneClass &plane, CastResultStruct *result)
static OverlapType Overlap_Test(const AAPlaneClass &plane, const Vector3 &point)
static bool Intersection_Test(const AABoxClass &box, const TriClass &tri)
const Vector3 & Get_Dir() const
const Vector3 & Get_P1() const
const Vector3 & Get_DP() const
const Vector3 & Get_P0() const
static WWINLINE float Dot_Product(const Vector3 &a, const Vector3 &b)
static WWINLINE void Subtract(const Vector3 &a, const Vector3 &b, Vector3 *c)
static WWINLINE void Add(const Vector3 &a, const Vector3 &b, Vector3 *c)
WWINLINE void Set(float x, float y, float z)
static float Max(float a, float b)
static float Min(float a, float b)
static WWINLINE float Fabs(float val)
AABCollisionStruct(const AABoxClass &box0, const Vector3 &move0, const AABoxClass &box1, const Vector3 &move1)