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