MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_triangle_area_2d

Function test_triangle_area_2d

tests/geometry/test-mensuration.cpp:35–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#include <geode/tests/common.hpp>
34
35void 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
56void test_triangle_area_3d()
57{

Callers 1

test_triangle_areaFunction · 0.85

Calls 2

triangle_areaFunction · 0.85
testFunction · 0.70

Tested by

no test coverage detected