DGtal 1.3.0
Loading...
Searching...
No Matches
MeshVoxelizer.h
1
17#pragma once
18
29#if !defined MeshVoxelizer_h
31#define MeshVoxelizer_h
32
34// Inclusions
35#include "DGtal/helpers/StdDefs.h"
36#include "DGtal/base/ConstAlias.h"
37#include "DGtal/shapes/Mesh.h"
38#include "DGtal/shapes/IntersectionTarget.h"
39#include "DGtal/kernel/SpaceND.h"
40#include "DGtal/kernel/sets/CDigitalSet.h"
41#include "DGtal/geometry/tools/determinant/PredicateFromOrientationFunctor2.h"
42#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
44
45namespace DGtal
46{
47
49
78 template <typename TDigitalSet, int Separation = 6>
80 {
81
82 public:
83
86
88 typedef TDigitalSet DigitalSet;
89 BOOST_STATIC_ASSERT_MSG( DigitalSet::Space::dimension == 3, "DigitalSet dimension must be 3");
90
92 BOOST_STATIC_ASSERT_MSG( Separation == 6 || Separation == 26, "Separation must be 6 or 26");
93
94 /****** Associated types *********************/
95 using Space = typename DigitalSet::Space;
97 using Domain = typename DigitalSet::Domain;
98 using PointR3 = typename Space::RealPoint;
99 using VectorR3 = typename Space::RealPoint;
100 using PointR2 = typename Space2D::RealPoint;
101 using PointZ3 = typename Space::Point;
104 /*********************************************/
105
106 public:
107
111 MeshVoxelizer() = default;
112
113 // ----------------------- Standard services ------------------------------
130 template<typename MeshPoint>
131 void voxelize(DigitalSet &outputSet,
132 const Mesh<MeshPoint> &aMesh,
133 const double scaleFactor = 1.0);
134
148 template<typename MeshPoint>
149 void voxelize(DigitalSet &outputSet,
150 const MeshPoint &a, const MeshPoint &b, const MeshPoint &c,
151 const double scaleFactor = 1.0);
152
153
154
155 // ----------------------- Internal services ------------------------------
158
167 static
168 double distance(const PointR3& M,
169 const VectorR3& n,
170 const PointZ3& p) ;
171
180 static
182 const PointR2& B,
183 const PointR2& C,
184 const PointR2& p) ;
185
192 static
194 const PointZ3& v) ;
195
206 const PointR3& A,
207 const PointR3& B,
208 const PointR3& C,
209 const VectorR3& n,
210 const std::pair<PointZ3, PointZ3>& bbox);
211
212 // ----------------------- Members ------------------------------
213
214 private:
215
218 };
219}
220
222// Includes inline functions.
223#include "DGtal/shapes/MeshVoxelizer.ih"
224
225// //
227
228#endif // !defined MeshVoxelizer_h
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: A class for computing the digitization of a triangle or a Mesh.
Definition: MeshVoxelizer.h:80
typename Space::Point PointZ3
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TDigitalSet >))
Concept Checking.
typename Space2D::RealPoint PointR2
typename DigitalSet::Domain Domain
Definition: MeshVoxelizer.h:97
TriangleOrientation
Enum type when deciding if a 2D point belongs to a 2D triangle.
static double distance(const PointR3 &M, const VectorR3 &n, const PointZ3 &p)
typename DigitalSet::Space Space
Definition: MeshVoxelizer.h:95
static TriangleOrientation pointIsInside2DTriangle(const PointR2 &A, const PointR2 &B, const PointR2 &C, const PointR2 &p)
IntersectionTarget myIntersectionTarget
Intersection target.
void voxelizeTriangle(DigitalSet &outputSet, const PointR3 &A, const PointR3 &B, const PointR3 &C, const VectorR3 &n, const std::pair< PointZ3, PointZ3 > &bbox)
void voxelize(DigitalSet &outputSet, const Mesh< MeshPoint > &aMesh, const double scaleFactor=1.0)
TDigitalSet DigitalSet
Digital Set Type.
Definition: MeshVoxelizer.h:88
typename IntersectionTargetTrait< Space, Separation, 1 >::Type IntersectionTarget
BOOST_STATIC_ASSERT_MSG(Separation==6||Separation==26, "Separation must be 6 or 26")
Separation Checking.
BOOST_STATIC_ASSERT_MSG(DigitalSet::Space::dimension==3, "DigitalSet dimension must be 3")
void voxelize(DigitalSet &outputSet, const MeshPoint &a, const MeshPoint &b, const MeshPoint &c, const double scaleFactor=1.0)
static bool pointIsInsideVoxel(const PointR3 &P, const PointZ3 &v)
typename Space::RealPoint VectorR3
Definition: MeshVoxelizer.h:99
typename Space::RealPoint PointR3
Definition: MeshVoxelizer.h:98
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition: Mesh.h:92
PointVector< dim, Integer > Point
Points in DGtal::SpaceND.
Definition: SpaceND.h:110
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal is the top-level namespace which contains all DGtal functions and types.
Internal intersection target structure.
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:141