inline ExtrudedShape<T, D>::ExtrudedShape(const Shape<T, D-1> &b, T l):
length(l)
{
- if(l<=0)
+ if(l<=T(0))
throw std::invalid_argument("ExtrudedShape::ExtrudedShape");
base = b.clone();
template<typename T, unsigned D>
inline HalfSpace<T, D>::HalfSpace()
{
- normal[0] = 1;
+ normal[0] = T(1);
}
template<typename T, unsigned D>
template<typename T, unsigned D>
inline bool HalfSpace<T, D>::contains(const LinAl::Vector<T, D> &point) const
{
- return inner_product(point, normal)<=0;
+ return inner_product(point, normal)<=T(0);
}
template<typename T, unsigned D>
T mid = -inner_product(ray.get_direction(), ray.get_start());
LinAl::Vector<T, D> nearest = ray.get_start()+ray.get_direction()*mid;
T offset_sq = radius*radius-inner_product(nearest, nearest);
- if(offset_sq<0)
+ if(offset_sq<T(0))
return 0;
T offset = sqrt(offset_sq);
inline Ray<T, D>::Ray():
limit(0)
{
- direction[0] = 1;
+ direction[0] = T(1);
}
template<typename T, unsigned 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