template<typename T, unsigned D>
inline unsigned ExtrudedShape<T, D>::get_intersections(const Ray<T, D> &ray, SurfacePoint<T, D> *points, unsigned size) const
{
- using std::abs;
- using std::sqrt;
using std::swap;
unsigned n = 0;
template<typename T, unsigned D>
inline bool HyperBox<T, D>::contains(const LinAl::Vector<T, D> &point) const
{
+ using std::abs;
+
for(unsigned i=0; i<D; ++i)
if(abs(point[i])>dimensions[i]/2)
return false;
#ifndef MSP_GEOMETRY_HYPERSPHERE_H_
#define MSP_GEOMETRY_HYPERSPHERE_H_
+#include <cmath>
#include <msp/linal/vector.h>
#include "hyperbox.h"
#include "ray.h"
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);
#ifndef MSP_LINAL_SQUAREMATRIX_H_
#define MSP_LINAL_SQUAREMATRIX_H_
+#include <cmath>
#include <stdexcept>
#include "matrix.h"
template<typename T, unsigned S>
SquareMatrix<T, S> &SquareMatrix<T, S>::invert()
{
+ using std::abs;
+
SquareMatrix<T, S> r = identity();
for(unsigned i=0; i<S; ++i)
{
template<typename T, unsigned N>
inline T Vector<T, N>::norm() const
{
+ using std::sqrt;
return sqrt(inner_product(*this, *this));
}