]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/ray.h
Always explicitly construct values of type T
[libs/math.git] / source / geometry / ray.h
index 99f447bcd62edc2a640039d1ad7ad1eea54bb8c2..6c9a65bf4785c38ae07ab6fc78e4a4337575200b 100644 (file)
@@ -30,7 +30,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 +46,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