diff --git a/include/omath/Triangle.hpp b/include/omath/Triangle.hpp index 77c1532..8107938 100644 --- a/include/omath/Triangle.hpp +++ b/include/omath/Triangle.hpp @@ -59,7 +59,7 @@ namespace omath const auto sideB = SideBLength(); const auto hypot = Hypot(); - return sideA*sideA + sideB*sideB == hypot*hypot; + return std::abs(sideA*sideA + sideB*sideB - hypot*hypot) <= 0.0001f; } [[nodiscard]] constexpr Vector3 SideBVector() const diff --git a/tests/general/UnitTestTriangle.cpp b/tests/general/UnitTestTriangle.cpp index 8fc1aa6..258cb97 100644 --- a/tests/general/UnitTestTriangle.cpp +++ b/tests/general/UnitTestTriangle.cpp @@ -113,8 +113,7 @@ TEST_F(UnitTestTriangle, SideVectors) TEST_F(UnitTestTriangle, IsRectangular) { - EXPECT_TRUE(t1.IsRectangular()); - EXPECT_TRUE(t3.IsRectangular()); + EXPECT_TRUE(Triangle({2,0,0}, {}, {0,2,0}).IsRectangular()); } // Test midpoint TEST_F(UnitTestTriangle, MidPoint)