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

Function test_ray_intersections

tests/geometry/test-bounding-box.cpp:112–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void test_ray_intersections()
113{
114 geode::BoundingBox3D bbox;
115 bbox.add_point( geode::Point3D{ { -1, -1, -1 } } );
116 bbox.add_point( geode::Point3D{ { 1, 1, 1 } } );
117
118 const geode::OwnerRay3D ray_inside{ geode::Vector3D{ { 0, 0, 1 } },
119 geode::Point3D{ { 0, 0, 0 } } };
120 geode::OpenGeodeGeometryException::test(
121 bbox.intersects( ray_inside ), "Wrong result with ray_inside" );
122
123 const geode::OwnerRay3D ray_up{ geode::Vector3D{ { 0, 0, 1 } },
124 geode::Point3D{ { 0, 0, 2 } } };
125 geode::OpenGeodeGeometryException::test(
126 !bbox.intersects( ray_up ), "Wrong result with ray_up" );
127
128 const geode::OwnerRay3D ray_down{ geode::Vector3D{ { 0, 0, 1 } },
129 geode::Point3D{ { 0, 0, -2 } } };
130 geode::OpenGeodeGeometryException::test(
131 bbox.intersects( ray_down ), "Wrong result with ray_down" );
132}
133
134void test_line_intersections()
135{

Callers 1

testFunction · 0.85

Calls 3

intersectsMethod · 0.80
testFunction · 0.70
add_pointMethod · 0.45

Tested by

no test coverage detected