X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fhyperbox.h;h=9a161f35fb0fdbc5ff604735d51eb6e1d060eeaf;hb=827b227ae53884109b6885ccd1424dda8c0b3725;hp=0e4efd81995508de416d37cffd6ad12e3bbf2184;hpb=cc51208545c3941fcfdb078ad0c70c7fd607614e;p=libs%2Fmath.git diff --git a/source/geometry/hyperbox.h b/source/geometry/hyperbox.h index 0e4efd8..9a161f3 100644 --- a/source/geometry/hyperbox.h +++ b/source/geometry/hyperbox.h @@ -72,7 +72,7 @@ inline bool HyperBox::contains(const LinAl::Vector &point) const using std::abs; for(unsigned i=0; idimensions[i]/2) + if(abs(point[i])>dimensions[i]/T(2)) return false; return true; } @@ -88,14 +88,17 @@ inline unsigned HyperBox::get_intersections(const Ray &ray, SurfaceP { using std::abs; + if(size>2) + size = 2; + LinAl::Vector half_dim = dimensions/T(2); unsigned n = 0; - for(unsigned i=0; i::get_intersections(const Ray &ray, SurfaceP for(unsigned k=0; (inside && k::get_intersections(const Ray &ray, SurfaceP } ++n; - if(n==size || n==2) - return n; } } }