line: use aabb for box intersect

This commit is contained in:
Danny Robson 2015-03-07 03:19:48 +11:00
parent 50f1e79ed9
commit a2055b30bf
2 changed files with 6 additions and 6 deletions

View File

@ -53,10 +53,10 @@ util::line<S,T>::intersect (plane<S,T> q) const
/// returns -ve if behind
template <size_t S, typename T>
T
util::line<S,T>::intersect (region<S,T> r) const
util::line<S,T>::intersect (AABB<S,T> r) const
{
auto t1 = (r.base () - p) / d;
auto t2 = (r.away () - p) / d;
auto t1 = (r.p0 - p) / d;
auto t2 = (r.p1 - p) / d;
auto vmin = min (t1, t2);
auto vmax = max (t1, t2);

View File

@ -23,16 +23,16 @@
#include "point.hpp"
#include "vector.hpp"
#include "plane.hpp"
#include "region.hpp"
#include "aabb.hpp"
namespace util {
template <size_t S, typename T>
struct line {
line (util::point<S,T> place,
line (util::point<S,T> origin,
util::vector<S,T> direction);
T intersect (plane<S,T>) const;
T intersect (region<S,T>) const;
T intersect (AABB<S,T>) const;
T closest (point<S,T>) const;