4 #include <boost/fusion/sequence/intrinsic/at_c.hpp>
5 #include <boost/fusion/include/at_c.hpp>
6 #include <boost/fusion/container/vector.hpp>
7 #include <boost/fusion/include/vector.hpp>
8 #include <boost/fusion/container/vector/vector_fwd.hpp>
9 #include <boost/fusion/include/vector_fwd.hpp>
10 #include "boost/multi_array.hpp"
12 #include <Space/Shape/Point.hpp>
23 template<
unsigned int dim ,
typename T>
class Sphere
28 typedef boost::fusion::vector<T[3],T>
type;
34 static const unsigned int x = 0;
36 static const unsigned int r = 1;
46 return boost::fusion::at_c<x>(
data)[i];
58 template<
unsigned int k>
Sphere(boost::fusion::vector<T[k]> & c, T
radius)
61 for (
int i = 0 ; i < dim ; i++)
63 boost::fusion::at_c<x>(
data)[i] = boost::fusion::at_c<x>(c)[i];
66 boost::fusion::at_c<r>(
data) = radius;
76 return boost::fusion::at_c<r>(
data);
96 for (
int i = 0; i < dim ; i++)
98 dist += d.accum_dist(boost::fusion::at_c<x>(
data)[i],p.
get(i) );
103 if (dist <= boost::fusion::at_c<r>(
data))
118 template<
typename Distance>
bool isInside(
float * pnt)
127 for (
int i = 0; i < dim ; i++)
129 dist += d.accum_dist(boost::fusion::at_c<x>(
data)[i],pnt[i],i);
134 if (dist <= boost::fusion::at_c<r>(
data))
T center(unsigned int i)
Get the component i of the center.
type data
Structure that store the data.
This class implement the point shape in an N-dimensional space.
bool isInside(float *pnt)
Is the point inside the sphere.
static const unsigned int x
property id of the center position of the sphere
T get(int i) const
Get coordinate.
boost::fusion::vector< T[3], T > type
boost fusion that store the point
T isInside(Point< dim, T > p)
Check if a point is inside.
This class implement the Sphere concept in an N-dimensional space.
static const unsigned int r
property id of the radius of the sphere
Sphere(boost::fusion::vector< T[k]> &c, T radius)
Sphere constructor.
T radius()
Get the radius of the sphere.