2024-05-29 16:29:08 +10:00
|
|
|
#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>
|
2015-02-19 13:28:56 +11:00
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
using cruft::geom::ray2f;
|
|
|
|
using cruft::geom::ray3f;
|
2015-10-13 18:19:47 +11:00
|
|
|
|
2015-03-07 03:20:50 +11:00
|
|
|
|
2015-04-13 21:47:37 +10:00
|
|
|
//-----------------------------------------------------------------------------
|
2015-03-07 03:20:50 +11:00
|
|
|
void
|
2018-08-05 14:42:02 +10:00
|
|
|
test_intersect_plane (cruft::TAP::logger &tap)
|
2015-02-19 13:28:56 +11:00
|
|
|
{
|
2015-03-11 22:31:35 +11:00
|
|
|
// trivial case: origin ray facing z, plane at unit z facing -z.
|
2018-08-05 14:42:02 +10:00
|
|
|
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});
|
2015-02-19 13:28:56 +11:00
|
|
|
|
2018-03-13 23:27:37 +11:00
|
|
|
tap.expect_eq (distance (l, p), 1.f, "ray-plane intersect");
|
2015-02-19 13:28:56 +11:00
|
|
|
}
|
2015-03-07 03:20:50 +11:00
|
|
|
|
|
|
|
|
2015-04-13 21:47:37 +10:00
|
|
|
//-----------------------------------------------------------------------------
|
2015-03-07 03:20:50 +11:00
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
2018-08-05 14:42:02 +10:00
|
|
|
cruft::TAP::logger tap;
|
2015-04-13 21:47:37 +10:00
|
|
|
|
|
|
|
test_intersect_plane (tap);
|
|
|
|
|
|
|
|
return tap.status ();
|
2015-03-07 03:20:50 +11:00
|
|
|
}
|