]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/ray.h
Rename AffineTransformation to AffineTransform
[libs/math.git] / source / geometry / ray.h
index 99f447bcd62edc2a640039d1ad7ad1eea54bb8c2..d8eb7d8405ec75f799226572c5135d08260b978b 100644 (file)
@@ -7,6 +7,9 @@
 namespace Msp {
 namespace Geometry {
 
+/**
+A directed line segment.  Can be used to point at things.
+*/
 template<typename T, unsigned D>
 class Ray
 {
@@ -30,7 +33,7 @@ template<typename T, unsigned D>
 inline Ray<T, D>::Ray():
        limit(0)
 {
-       direction[0] = 1;
+       direction[0] = T(1);
 }
 
 template<typename T, unsigned D>
@@ -46,14 +49,14 @@ inline Ray<T, D>::Ray(const LinAl::Vector<T, D> &s, const LinAl::Vector<T, D> &d
        direction(normalize(d)),
        limit(l)
 {
-       if(l<0)
+       if(l<T(0))
                throw std::invalid_argument("Ray::Ray");
 }
 
 template<typename T, unsigned D>
 inline bool Ray<T, D>::check_limits(T x) const
 {
-       return x>=0 && (!limit || x<=limit);
+       return x>=T(0) && (!limit || x<=limit);
 }
 
 } // namespace Geometry