X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fhypersphere.h;h=6bb4352f4016840ca331ebfd2034f35a7090e7d2;hb=65b26478a62b8d715ec415164fff25fafcb35fc1;hp=3c0412564fcc1cf055842c9d325943935812746a;hpb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;p=libs%2Fmath.git diff --git a/source/geometry/hypersphere.h b/source/geometry/hypersphere.h index 3c04125..6bb4352 100644 --- a/source/geometry/hypersphere.h +++ b/source/geometry/hypersphere.h @@ -4,10 +4,7 @@ #include #include #include -#include "boundingbox.h" -#include "ray.h" #include "shape.h" -#include "surfacepoint.h" namespace Msp { namespace Geometry { @@ -73,7 +70,7 @@ inline unsigned HyperSphere::get_intersections(const Ray &ray, Surfa T mid = -inner_product(ray.get_direction(), ray.get_start()); LinAl::Vector nearest = ray.get_start()+ray.get_direction()*mid; T offset_sq = radius*radius-inner_product(nearest, nearest); - if(offset_sq<0) + if(offset_sq::get_intersections(const Ray &ray, Surfa points[n].position = ray.get_start()+ray.get_direction()*x; points[n].normal = normalize(points[n].position); points[n].distance = x; + points[n].entry = (i<0); } ++n;