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

Function test_triangle_area_3d

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

Source from the content-addressed store, hash-verified

54}
55
56void test_triangle_area_3d()
57{
58 const geode::Point3D a{ { 0.0, 0., 0.0 } };
59 const geode::Point3D b{ { 1.0, 0.0, 0.0 } };
60 const geode::Point3D c{ { 1.0, 1.0, 0.0 } };
61
62 const geode::Triangle3D triangle3D_1{ a, b, c };
63 const auto area1 = geode::triangle_area( triangle3D_1 );
64 geode::OpenGeodeGeometryException::test(
65 std::fabs( area1 - 0.5 ) < geode::GLOBAL_EPSILON,
66 "Wrong result for triangle_area "
67 "with query triangle triangle3D_1" );
68
69 const geode::Triangle3D triangle3D_2{ a, b, a };
70 const auto area2 = geode::triangle_area( triangle3D_2 );
71 geode::OpenGeodeGeometryException::test(
72 std::fabs( area2 ) < geode::GLOBAL_EPSILON,
73 "Wrong result for triangle_area "
74 "with query triangle triangle3D_2" );
75
76 const geode::Point3D d{ { 1, 1, -0.300000011920929 } };
77 const geode::Point3D e{ { 0, 0, -0.300000011920929 } };
78 const geode::Point3D f{ { 0.555555555555556, 0.555555555555555,
79 -0.300000011920929 } };
80 const geode::Triangle3D triangle3D_3{ d, e, f };
81 const auto area3 = geode::triangle_area( triangle3D_3 );
82 geode::OpenGeodeGeometryException::test(
83 std::fabs( area3 ) < geode::GLOBAL_EPSILON,
84 "Wrong result for triangle_area "
85 "with query triangle triangle3D_3" );
86}
87
88void test_triangle_area()
89{

Callers 1

test_triangle_areaFunction · 0.85

Calls 2

triangle_areaFunction · 0.85
testFunction · 0.70

Tested by

no test coverage detected