module Tests; import Core.Plane; import Core.Test; import Core.Vector; static const float eps = 0.0001f; using V3 = Core::Vector3; static void testToString() { Core::Plane p(V3(3, 6, 8), V3(7, 6, 2), V3(4, 4, 4)); Core::testString("(-0.684 x + 0.570 y + -0.456 z + 2.279)", p); Core::testString("(0.000 x + 0.000 y + 0.000 z + 0.000)", Core::Plane()); } static void testSignedDistance() { V3 a(3, 6, 8); V3 b(7, 6, 2); V3 c(4, 4, 4); Core::Plane p(a, b, c); Core::testFloat(0.0f, p.signedDistance(a), eps); Core::testFloat(0.0f, p.signedDistance(b), eps); Core::testFloat(0.0f, p.signedDistance(c), eps); Core::testFloat(-1.13960576f, p.signedDistance(V3(5, 8, 10)), eps); Core::testFloat(0.911684612f, p.signedDistance(V3(3, 2, 1)), eps); } void testPlane() { testToString(); testSignedDistance(); }