33 lines
851 B
C++
33 lines
851 B
C++
#include <cruft/util/geom/aabb.hpp>
|
|
#include <cruft/util/geom/plane.hpp>
|
|
#include <cruft/util/geom/ray.hpp>
|
|
#include <cruft/util/geom/iostream.hpp>
|
|
#include <cruft/util/tap.hpp>
|
|
|
|
using cruft::geom::ray2f;
|
|
using cruft::geom::ray3f;
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void
|
|
test_intersect_plane (cruft::TAP::logger &tap)
|
|
{
|
|
// trivial case: origin ray facing z, plane at unit z facing -z.
|
|
const cruft::geom::ray3f l { .origin = 0, .direction = {0, 0, 1} };
|
|
const cruft::geom::plane3f p (cruft::point3f {0,0,1}, cruft::vector3f {0,0,-1});
|
|
|
|
tap.expect_eq (distance (l, p), 1.f, "ray-plane intersect");
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
main (void)
|
|
{
|
|
cruft::TAP::logger tap;
|
|
|
|
test_intersect_plane (tap);
|
|
|
|
return tap.status ();
|
|
}
|