28 #if !defined IntersectionTarget_h
30 #define IntersectionTarget_h
32 #include "DGtal/helpers/StdDefs.h"
33 #include "DGtal/base/ConstAlias.h"
34 #include "DGtal/shapes/Mesh.h"
35 #include "DGtal/shapes/IntersectionTarget.h"
36 #include "DGtal/kernel/SpaceND.h"
37 #include "DGtal/kernel/sets/CDigitalSet.h"
38 #include "DGtal/geometry/tools/determinant/PredicateFromOrientationFunctor2.h"
39 #include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
56 template<
typename TSpace,
size_t TSeparation,
size_t TDimension = 1>
74 template<
typename Space,
size_t Separation,
size_t Dimension = 1>
97 template<
typename Space>
103 const std::array<Edge, 3> myTarget {{
104 { { 0.5, 0.0, 0.0 }, { -0.5, 0.0, 0.0} } ,
105 { { 0.0, 0.0, 0.5 }, { 0.0, 0.0, -0.5} } ,
106 { { 0.0, 0.5, 0.0 }, { 0.0, -0.5, 0.0} }
135 ASSERT( 0 <= i && i <= 2 );
137 if(myTarget[i].myFirst[0] == 0.5)
138 return { p[1], p[2] };
139 else if(myTarget[i].myFirst[1] == 0.5)
140 return { p[0], p[2] };
142 return { p[0], p[1] };
149 template<
typename Space>
155 const std::array<Edge, 4> myTarget {{
156 { { -0.5, 0.5, 0.5}, { 0.5, -0.5, -0.5} } ,
157 { { 0.5, 0.5, 0.5}, { -0.5, -0.5, -0.5} } ,
158 { { 0.5, 0.5, -0.5}, { -0.5, -0.5, 0.5} } ,
159 { { -0.5, 0.5, -0.5}, { 0.5, -0.5, 0.5} }
166 std::array<VectorR3, 4> myE2base;
173 const double coef = 1. / std::sqrt(3.);
175 std::array<VectorR3, 4> myNormal {{
176 { coef, -coef, -coef } ,
177 { -coef, -coef, -coef } ,
178 { -coef, -coef, coef } ,
179 { coef, -coef, coef }
183 for(
int i = 0; i < 4; i++)
185 auto& x = myNormal[i][0];
186 auto& y = myNormal[i][1];
187 auto& z = myNormal[i][2];
189 myE1base[i] = std::move(
VectorR3(-y, x, 0).getNormalized() );
190 myE2base[i] = std::move(
VectorR3(-x*z, -y*z, x*x + y*y).getNormalized() );
220 ASSERT( 0 <= i && i <= 3 );
222 return { myE1base[i].dot(p), myE2base[i].dot(p) };
PointVector< dim, double > RealPoint
DGtal is the top-level namespace which contains all DGtal functions and types.
Edge(const Edge &)=default
Edge(const PointR3 &mf, const PointR3 &ms)
const std::array< Edge, 4 > & operator()() const
std::array< VectorR3, 4 > myE1base
E1 base for each target's edge.
const Edge & operator()(int i) const
PointR2 project(int i, const PointR3 &p) const
const Edge & operator()(int i)
const std::array< Edge, 3 > & operator()()
PointR2 project(int i, const PointR3 &p) const
Internal intersection target structure.
Aim: A class for intersection target used for voxelization.
typename Space2D::RealPoint PointR2
typename TSpace::RealPoint VectorR3
BOOST_STATIC_ASSERT_MSG(TSeparation==6||TSeparation==26, "Separation must be 6 or 26")
Separation Checking.
BOOST_STATIC_ASSERT_MSG(TSpace::dimension==3, "DigitalSet dimension must be 3")
Digital Set dimension Checking.
typename TSpace::RealPoint PointR3
IntersectionTargetTrait()=delete
BOOST_STATIC_ASSERT_MSG(TDimension==1, "Currently only 1D intersection target is implemented")
Dimension of the intersection target checking.
PointVector< 3, double > RealPoint