X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fray.h;h=d8eb7d8405ec75f799226572c5135d08260b978b;hb=7d43d93ac2d701bb3de87cdf81e44c03e64c35c3;hp=99f447bcd62edc2a640039d1ad7ad1eea54bb8c2;hpb=24f239e418599c13a9d0bdc4942c188ccf0a8437;p=libs%2Fmath.git diff --git a/source/geometry/ray.h b/source/geometry/ray.h index 99f447b..d8eb7d8 100644 --- a/source/geometry/ray.h +++ b/source/geometry/ray.h @@ -7,6 +7,9 @@ namespace Msp { namespace Geometry { +/** +A directed line segment. Can be used to point at things. +*/ template class Ray { @@ -30,7 +33,7 @@ template inline Ray::Ray(): limit(0) { - direction[0] = 1; + direction[0] = T(1); } template @@ -46,14 +49,14 @@ inline Ray::Ray(const LinAl::Vector &s, const LinAl::Vector &d direction(normalize(d)), limit(l) { - if(l<0) + if(l inline bool Ray::check_limits(T x) const { - return x>=0 && (!limit || x<=limit); + return x>=T(0) && (!limit || x<=limit); } } // namespace Geometry