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>
82 using Type = IntersectionTarget<TSpace, TSeparation, TDimension>;
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} }
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) };
228 #endif // !defined MeshVoxelizer_h Internal intersection target structure.
Aim: A class for intersection target used for voxelization.
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
const std::array< Edge, 4 > & operator()() const
typename Space ::RealPoint PointR3
PointR2 project(int i, const PointR3 &p) const
typename Space2D::RealPoint PointR2
PointVector< dim, double > RealPoint
std::array< VectorR3, 4 > myE2base
E2 base for each target's edge.
PointVector< 3, double > RealPoint
const Edge & operator()(int i)
BOOST_STATIC_ASSERT_MSG(TSpace::dimension==3, "DigitalSet dimension must be 3")
Digital Set dimension Checking.
std::array< VectorR3, 4 > myE1base
E1 base for each target's edge.
Edge(const PointR3 &mf, const PointR3 &ms)
DGtal is the top-level namespace which contains all DGtal functions and types.
PointR2 project(int i, const PointR3 &p) const
IntersectionTargetTrait()=delete
const Edge & operator()(int i) const
const std::array< Edge, 3 > & operator()()
IntersectionTarget< Space, TSeparation, TDimension > Type
typename Space ::RealPoint VectorR3