The attached file demonstrates that the AABox/AABox sweep intersection test returns a false positive if any component of the relative velocity of the two boxes is zero.
The proposed patch causes a test case in the test suite to fail. Specifically, it breaks gmtlTest::IntersectionTest::testIntersectAABoxSweep() (see Test/TestSuite/TestCases/IntersectionTest.cpp). Does that mean that that test is incorrect or that the patch is incorrect?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ignore my question. I didn't realize that the bug tracker showed comments in reverse chronological order. I now understand that the proposed change was incorrect.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Source file with failing test
Here's the patch that I am using to correct this problem. Sorry about the formatting -- I don't have a Sourceforge account, so I can't attach files.
*** Intersection.h.orig 2011-03-22 20:54:30.198177237 -0700
--- /usr/include/gmtl-0.5.2/gmtl/Intersection.h 2011-03-22 20:54:36.771836476 -0700
***************
*** 152,157 ****
--- 152,161 ----
{
overlap1[i] = (box1.getMin()[i] - box2.getMax()[i]) / path[i];
}
+ else
+ {
+ return false;
+ }
if ((box2.getMax()[i] > box1.getMin()[i]) && (path[i] < DATA_TYPE(0)))
{
***************
*** 161,166 ****
--- 165,174 ----
{
overlap2[i] = (box1.getMax()[i] - box2.getMin()[i]) / path[i];
}
+ else
+ {
+ return false;
+ }
}
// Calculate the first time of overlap
Eek! I just looked at the patch I added and it is _wrong_. Really wrong. Sorry for the noise. If I come up with a better patch, I'll post it later.
The proposed patch causes a test case in the test suite to fail. Specifically, it breaks gmtlTest::IntersectionTest::testIntersectAABoxSweep() (see Test/TestSuite/TestCases/IntersectionTest.cpp). Does that mean that that test is incorrect or that the patch is incorrect?
Ignore my question. I didn't realize that the bug tracker showed comments in reverse chronological order. I now understand that the proposed change was incorrect.
I have posted a possible fix in my bug report. http://sourceforge.net/tracker/?func=detail&aid=3187564&group_id=43735&atid=437247