diff options
author | Mattes D <github@xoft.cz> | 2016-06-19 14:57:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-19 14:57:14 +0200 |
commit | 5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7 (patch) | |
tree | 083bbf9029b971dbf7b74353c9c62c22de9c78c7 /src/BoundingBox.cpp | |
parent | Merge pull request #3224 from QUSpilPrgm/master (diff) | |
parent | cNetwork: Fixed possible hang when terminating immediately after init. (diff) | |
download | cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar.gz cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar.bz2 cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar.lz cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar.xz cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.tar.zst cuberite-5ee6643804aa9cf5bc2a98b983ef7c453e78b8c7.zip |
Diffstat (limited to 'src/BoundingBox.cpp')
-rw-r--r-- | src/BoundingBox.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/BoundingBox.cpp b/src/BoundingBox.cpp index bd236bbd7..ecf810fa8 100644 --- a/src/BoundingBox.cpp +++ b/src/BoundingBox.cpp @@ -5,72 +5,6 @@ #include "Globals.h" #include "BoundingBox.h" #include "Defines.h" -#include "SelfTests.h" - - - - - -#ifdef SELF_TEST - -/** A simple self-test that is executed on program start, used to verify bbox functionality */ -static class SelfTest_BoundingBox -{ -public: - SelfTest_BoundingBox(void) - { - cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&Test), "Bounding box intersections"); - } - - static void Test(void) - { - Vector3d Min(1, 1, 1); - Vector3d Max(2, 2, 2); - Vector3d LineDefs[] = - { - Vector3d(1.5, 4, 1.5), Vector3d(1.5, 3, 1.5), // Should intersect at 2, face 1 (YP) - Vector3d(1.5, 0, 1.5), Vector3d(1.5, 4, 1.5), // Should intersect at 0.25, face 0 (YM) - Vector3d(0, 0, 0), Vector3d(2, 2, 2), // Should intersect at 0.5, face 0, 3 or 5 (anyM) - Vector3d(0.999, 0, 1.5), Vector3d(0.999, 4, 1.5), // Should not intersect - Vector3d(1.999, 0, 1.5), Vector3d(1.999, 4, 1.5), // Should intersect at 0.25, face 0 (YM) - Vector3d(2.001, 0, 1.5), Vector3d(2.001, 4, 1.5), // Should not intersect - } ; - bool Results[] = {true, true, true, false, true, false}; - double LineCoeffs[] = {2, 0.25, 0.5, 0, 0.25, 0}; - - for (size_t i = 0; i < ARRAYCOUNT(LineDefs) / 2; i++) - { - double LineCoeff; - eBlockFace Face; - Vector3d Line1 = LineDefs[2 * i]; - Vector3d Line2 = LineDefs[2 * i + 1]; - bool res = cBoundingBox::CalcLineIntersection(Min, Max, Line1, Line2, LineCoeff, Face); - if (res != Results[i]) - { - LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d", - Line1.x, Line1.y, Line1.z, - Line2.x, Line2.y, Line2.z, - res ? 1 : 0, LineCoeff, Face - ); - abort(); - } - if (res) - { - if (LineCoeff != LineCoeffs[i]) - { - LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d", - Line1.x, Line1.y, Line1.z, - Line2.x, Line2.y, Line2.z, - res ? 1 : 0, LineCoeff, Face - ); - abort(); - } - } - } // for i - LineDefs[] - } -} g_BoundingBoxTest; - -#endif |