X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fhyperbox.h;h=b9fad33d620d205f1a5043e002cb88556cbc6e32;hb=818f9df5f383adad815f6f3276bfc1fa30c25681;hp=da500910e4f100d57f865b644bd719d71a3ee34c;hpb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;p=libs%2Fmath.git diff --git a/source/geometry/hyperbox.h b/source/geometry/hyperbox.h index da50091..b9fad33 100644 --- a/source/geometry/hyperbox.h +++ b/source/geometry/hyperbox.h @@ -5,10 +5,7 @@ #include #include #include -#include "boundingbox.h" -#include "ray.h" #include "shape.h" -#include "surfacepoint.h" namespace Msp { namespace Geometry { @@ -115,13 +112,23 @@ inline unsigned HyperBox::get_intersections(const Ray &ray, SurfaceP { if(points) { - points[n].position = p; - points[n].normal = LinAl::Vector(); - points[n].normal[i] = j; - points[n].distance = x; - - if(n==1 && x0 && entry!=points[0].entry) + { + if(entry) + points[1] = points[0]; + else + ++k; + } + if(k(); + points[k].normal[i] = j; + points[k].distance = x; + points[k].entry = (T(j)*ray.get_direction()[i]