|
|
|
|
@ -18,18 +18,23 @@
|
|
|
|
|
#include "Math/Constants.h" |
|
|
|
|
#include "Math/Matrix4.h" |
|
|
|
|
#include "Physics/AxisAlignedBox.h" |
|
|
|
|
#include "Physics/Point.h" |
|
|
|
|
|
|
|
|
|
#include "ShapeTestBase.h" |
|
|
|
|
|
|
|
|
|
namespace Magnum { namespace Physics { namespace Test { |
|
|
|
|
|
|
|
|
|
class AxisAlignedBoxTest: public Corrade::TestSuite::Tester { |
|
|
|
|
class AxisAlignedBoxTest: public Corrade::TestSuite::Tester, ShapeTestBase { |
|
|
|
|
public: |
|
|
|
|
AxisAlignedBoxTest(); |
|
|
|
|
|
|
|
|
|
void applyTransformation(); |
|
|
|
|
void collisionPoint(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
AxisAlignedBoxTest::AxisAlignedBoxTest() { |
|
|
|
|
addTests(&AxisAlignedBoxTest::applyTransformation); |
|
|
|
|
addTests(&AxisAlignedBoxTest::applyTransformation, |
|
|
|
|
&AxisAlignedBoxTest::collisionPoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AxisAlignedBoxTest::applyTransformation() { |
|
|
|
|
@ -40,6 +45,19 @@ void AxisAlignedBoxTest::applyTransformation() {
|
|
|
|
|
CORRADE_COMPARE(box.transformedMax(), Vector3(3.0f, -1.0f, 5.5f)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AxisAlignedBoxTest::collisionPoint() { |
|
|
|
|
Physics::AxisAlignedBox3D box({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f}); |
|
|
|
|
Physics::Point3D point1({-1.5f, -1.0f, 2.0f}); |
|
|
|
|
Physics::Point3D point2({0.5f, 1.0f, -2.5f}); |
|
|
|
|
|
|
|
|
|
randomTransformation(box); |
|
|
|
|
randomTransformation(point1); |
|
|
|
|
randomTransformation(point2); |
|
|
|
|
|
|
|
|
|
VERIFY_NOT_COLLIDES(box, point1); |
|
|
|
|
VERIFY_COLLIDES(box, point2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}}} |
|
|
|
|
|
|
|
|
|
CORRADE_TEST_MAIN(Magnum::Physics::Test::AxisAlignedBoxTest) |
|
|
|
|
|