]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/hypersphere.h
Math function usage fixes
[libs/math.git] / source / geometry / hypersphere.h
index ce424e141cb32bbd9e5b8ed1b59cf9aee05ed617..01aee0e57b22e2791763077aecb3e3193ea35843 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GEOMETRY_HYPERSPHERE_H_
 #define MSP_GEOMETRY_HYPERSPHERE_H_
 
+#include <cmath>
 #include <msp/linal/vector.h>
 #include "hyperbox.h"
 #include "ray.h"
@@ -79,6 +80,8 @@ inline bool HyperSphere<T, D>::check_intersection(const Ray<T, D> &ray) const
 template<typename T, unsigned D>
 inline unsigned HyperSphere<T, D>::get_intersections(const Ray<T, D> &ray, SurfacePoint<T, D> *points, unsigned size) const
 {
+       using std::sqrt;
+
        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);