| 33 | #include <geode/tests/common.hpp> |
| 34 | |
| 35 | void test_triangle_area_2d() |
| 36 | { |
| 37 | const geode::Point2D a{ { 0.0, 0.0 } }; |
| 38 | const geode::Point2D b{ { 1.0, 0.0 } }; |
| 39 | const geode::Point2D c{ { 1.0, 1.0 } }; |
| 40 | |
| 41 | const geode::Triangle2D triangle2D_1{ a, b, c }; |
| 42 | const auto area1 = geode::triangle_area( triangle2D_1 ); |
| 43 | geode::OpenGeodeGeometryException::test( |
| 44 | std::fabs( area1 - 0.5 ) < geode::GLOBAL_EPSILON, |
| 45 | "Wrong result for triangle_area " |
| 46 | "with query triangle triangle2D_1" ); |
| 47 | |
| 48 | const geode::Triangle2D triangle2D_2{ a, b, a }; |
| 49 | const auto area2 = geode::triangle_area( triangle2D_2 ); |
| 50 | geode::OpenGeodeGeometryException::test( |
| 51 | std::fabs( area2 ) < geode::GLOBAL_EPSILON, |
| 52 | "Wrong result for triangle_area " |
| 53 | "with query triangle triangle2D_2" ); |
| 54 | } |
| 55 | |
| 56 | void test_triangle_area_3d() |
| 57 | { |
no test coverage detected