DGtal 1.3.0
|
Aim: A class for computing the digitization of a triangle or a Mesh. More...
#include <DGtal/shapes/MeshVoxelizer.h>
Public Types | |
enum | TriangleOrientation { OUTSIDE , INSIDE , ONEDGE , ONVERTEX } |
Enum type when deciding if a 2D point belongs to a 2D triangle. More... | |
typedef TDigitalSet | DigitalSet |
Digital Set Type. More... | |
using | Space = typename DigitalSet::Space |
using | Space2D = SpaceND< 2, typename Space::Integer > |
using | Domain = typename DigitalSet::Domain |
using | PointR3 = typename Space::RealPoint |
using | VectorR3 = typename Space::RealPoint |
using | PointR2 = typename Space2D::RealPoint |
using | PointZ3 = typename Space::Point |
using | OrientationFunctor = InHalfPlaneBySimple3x3Matrix< PointR2, double > |
using | IntersectionTarget = typename IntersectionTargetTrait< Space, Separation, 1 >::Type |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CDigitalSet< TDigitalSet >)) | |
Concept Checking. More... | |
BOOST_STATIC_ASSERT_MSG (DigitalSet::Space::dimension==3, "DigitalSet dimension must be 3") | |
BOOST_STATIC_ASSERT_MSG (Separation==6||Separation==26, "Separation must be 6 or 26") | |
Separation Checking. More... | |
MeshVoxelizer ()=default | |
template<typename MeshPoint > | |
void | voxelize (DigitalSet &outputSet, const Mesh< MeshPoint > &aMesh, const double scaleFactor=1.0) |
template<typename MeshPoint > | |
void | voxelize (DigitalSet &outputSet, const MeshPoint &a, const MeshPoint &b, const MeshPoint &c, const double scaleFactor=1.0) |
void | voxelizeTriangle (DigitalSet &outputSet, const PointR3 &A, const PointR3 &B, const PointR3 &C, const VectorR3 &n, const std::pair< PointZ3, PointZ3 > &bbox) |
Static Public Member Functions | |
static double | distance (const PointR3 &M, const VectorR3 &n, const PointZ3 &p) |
static TriangleOrientation | pointIsInside2DTriangle (const PointR2 &A, const PointR2 &B, const PointR2 &C, const PointR2 &p) |
static bool | pointIsInsideVoxel (const PointR3 &P, const PointZ3 &v) |
Private Attributes | |
IntersectionTarget | myIntersectionTarget |
Intersection target. More... | |
Aim: A class for computing the digitization of a triangle or a Mesh.
Description of template class 'MeshVoxelizer'
This class is parametrized by a Separation strategy (either 6 or 26). This value corresponds to the separability of a digitized continuous plane. For instance, if the value is set to 6, then the digitization of an Euclidean plane is such that no 6-path exists to go from one side to the other of the Euclidean plane (see [64]).
From the separability parameter, a template is constructed. A voxel belongs to the digitization if and only if the template centered at a given voxel intersects the triangle.
This approach is a CPU straightforward implementation of [77].
6 and 26 templates are the following ones:
TDigitalSet | a DigitalSet (model of concepts::CDigitalSet) |
Separation | strategy of the voxelization (6 or 26) |
Definition at line 79 of file MeshVoxelizer.h.
typedef TDigitalSet DGtal::MeshVoxelizer< TDigitalSet, Separation >::DigitalSet |
Digital Set Type.
Definition at line 88 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Domain = typename DigitalSet::Domain |
Definition at line 97 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::IntersectionTarget = typename IntersectionTargetTrait<Space, Separation, 1>::Type |
Definition at line 103 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::OrientationFunctor = InHalfPlaneBySimple3x3Matrix<PointR2, double> |
Definition at line 102 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointR2 = typename Space2D::RealPoint |
Definition at line 100 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointR3 = typename Space::RealPoint |
Definition at line 98 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointZ3 = typename Space::Point |
Definition at line 101 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Space = typename DigitalSet::Space |
Definition at line 95 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Space2D = SpaceND<2, typename Space::Integer> |
Definition at line 96 of file MeshVoxelizer.h.
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::VectorR3 = typename Space::RealPoint |
Definition at line 99 of file MeshVoxelizer.h.
enum DGtal::MeshVoxelizer::TriangleOrientation |
Enum type when deciding if a 2D point belongs to a 2D triangle.
Enumerator | |
---|---|
OUTSIDE | |
INSIDE | |
ONEDGE | |
ONVERTEX |
Definition at line 157 of file MeshVoxelizer.h.
|
default |
Constructor of the voxelizer
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDigitalSet< TDigitalSet >) | ) |
Concept Checking.
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_STATIC_ASSERT_MSG | ( | DigitalSet::Space::dimension | = =3 , |
"DigitalSet dimension must be 3" | |||
) |
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_STATIC_ASSERT_MSG | ( | Separation | = =6||Separation==26 , |
"Separation must be 6 or 26" | |||
) |
Separation Checking.
|
static |
Compute (unsigned) distance between p and the Euclidean plane defined by normal vector n and point M
M | point |
n | normal |
p | point p |
|
static |
Predicate to know if p (2D point) is inside ABC (2D triangle)
A | Point A |
B | Point B |
C | Point C |
p | point p |
|
static |
Predicate to decide if a real point P is inside voxel v
P | point P |
v | voxel v |
void DGtal::MeshVoxelizer< TDigitalSet, Separation >::voxelize | ( | DigitalSet & | outputSet, |
const Mesh< MeshPoint > & | aMesh, | ||
const double | scaleFactor = 1.0 |
||
) |
Voxelize the mesh into the digital set.
If one voxel is outside the digtial set (outputSet) domain, the voxel is skipped.
[out] | outputSet | the set that collects the voxels. |
[in] | aMesh | the mesh to voxelize (vertex coordinates will be casted to PointR3 points. |
[in] | scaleFactor | the scale factor to apply to the mesh (default=1.0) |
MeshPoint | the type of point of the mesh. |
Referenced by main().
void DGtal::MeshVoxelizer< TDigitalSet, Separation >::voxelize | ( | DigitalSet & | outputSet, |
const MeshPoint & | a, | ||
const MeshPoint & | b, | ||
const MeshPoint & | c, | ||
const double | scaleFactor = 1.0 |
||
) |
Voxelize a unique triangle (a,b,c) into the digital set. voxels are inserted to the outputSet.
[out] | outputSet | the set that collects the voxels. |
[in] | a | the first point of the triangle |
[in] | b | the second point of the triangle |
[in] | c | the third point of the triangle |
[in] | scaleFactor | the scale factor to apply to the triangle (default=1.0) |
MeshPoint | the type of point of the triangle (casted to PointR3 later). |
void DGtal::MeshVoxelizer< TDigitalSet, Separation >::voxelizeTriangle | ( | DigitalSet & | outputSet, |
const PointR3 & | A, | ||
const PointR3 & | B, | ||
const PointR3 & | C, | ||
const VectorR3 & | n, | ||
const std::pair< PointZ3, PointZ3 > & | bbox | ||
) |
Voxelize ABC to the digitalSet
[out] | outputSet | the set that collects the voxels. |
A | Point A | |
B | Point B | |
C | Point C | |
n | normal of ABC | |
bbox | bounding box of ABC |
|
private |
Intersection target.
Definition at line 217 of file MeshVoxelizer.h.