DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
DGtal::MeshVoxelizer< TDigitalSet, Separation > Class Template Reference

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...
 

Detailed Description

template<typename TDigitalSet, int Separation = 6>
class DGtal::MeshVoxelizer< TDigitalSet, Separation >

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:

Template for 6-separating digitization
Template for 26-separating digitization
Template Parameters
TDigitalSeta DigitalSet (model of concepts::CDigitalSet)
Separationstrategy of the voxelization (6 or 26)
Examples
shapes/exampleMeshVoxelizer.cpp.

Definition at line 79 of file MeshVoxelizer.h.

Member Typedef Documentation

◆ DigitalSet

template<typename TDigitalSet , int Separation = 6>
typedef TDigitalSet DGtal::MeshVoxelizer< TDigitalSet, Separation >::DigitalSet

Digital Set Type.

Definition at line 88 of file MeshVoxelizer.h.

◆ Domain

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Domain = typename DigitalSet::Domain

Definition at line 97 of file MeshVoxelizer.h.

◆ IntersectionTarget

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::IntersectionTarget = typename IntersectionTargetTrait<Space, Separation, 1>::Type

Definition at line 103 of file MeshVoxelizer.h.

◆ OrientationFunctor

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::OrientationFunctor = InHalfPlaneBySimple3x3Matrix<PointR2, double>

Definition at line 102 of file MeshVoxelizer.h.

◆ PointR2

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointR2 = typename Space2D::RealPoint

Definition at line 100 of file MeshVoxelizer.h.

◆ PointR3

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointR3 = typename Space::RealPoint

Definition at line 98 of file MeshVoxelizer.h.

◆ PointZ3

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::PointZ3 = typename Space::Point

Definition at line 101 of file MeshVoxelizer.h.

◆ Space

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Space = typename DigitalSet::Space

Definition at line 95 of file MeshVoxelizer.h.

◆ Space2D

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::Space2D = SpaceND<2, typename Space::Integer>

Definition at line 96 of file MeshVoxelizer.h.

◆ VectorR3

template<typename TDigitalSet , int Separation = 6>
using DGtal::MeshVoxelizer< TDigitalSet, Separation >::VectorR3 = typename Space::RealPoint

Definition at line 99 of file MeshVoxelizer.h.

Member Enumeration Documentation

◆ TriangleOrientation

template<typename TDigitalSet , int Separation = 6>
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.

Constructor & Destructor Documentation

◆ MeshVoxelizer()

template<typename TDigitalSet , int Separation = 6>
DGtal::MeshVoxelizer< TDigitalSet, Separation >::MeshVoxelizer ( )
default

Constructor of the voxelizer

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TDigitalSet , int Separation = 6>
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_CONCEPT_ASSERT ( (concepts::CDigitalSet< TDigitalSet >)  )

Concept Checking.

◆ BOOST_STATIC_ASSERT_MSG() [1/2]

template<typename TDigitalSet , int Separation = 6>
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_STATIC_ASSERT_MSG ( DigitalSet::Space::dimension  = =3,
"DigitalSet dimension must be 3"   
)

◆ BOOST_STATIC_ASSERT_MSG() [2/2]

template<typename TDigitalSet , int Separation = 6>
DGtal::MeshVoxelizer< TDigitalSet, Separation >::BOOST_STATIC_ASSERT_MSG ( Separation  = =6||Separation==26,
"Separation must be 6 or 26"   
)

Separation Checking.

◆ distance()

template<typename TDigitalSet , int Separation = 6>
static double DGtal::MeshVoxelizer< TDigitalSet, Separation >::distance ( const PointR3 M,
const VectorR3 n,
const PointZ3 p 
)
static

Compute (unsigned) distance between p and the Euclidean plane defined by normal vector n and point M

Parameters
Mpoint
nnormal
ppoint p
Returns
distance the distance to the plane

◆ pointIsInside2DTriangle()

template<typename TDigitalSet , int Separation = 6>
static TriangleOrientation DGtal::MeshVoxelizer< TDigitalSet, Separation >::pointIsInside2DTriangle ( const PointR2 A,
const PointR2 B,
const PointR2 C,
const PointR2 p 
)
static

Predicate to know if p (2D point) is inside ABC (2D triangle)

Parameters
APoint A
BPoint B
CPoint C
ppoint p
Returns
TriangleOrientation either {OUTSIDE, INSIDE, ONEDGE, ONVERTEX}

◆ pointIsInsideVoxel()

template<typename TDigitalSet , int Separation = 6>
static bool DGtal::MeshVoxelizer< TDigitalSet, Separation >::pointIsInsideVoxel ( const PointR3 P,
const PointZ3 v 
)
static

Predicate to decide if a real point P is inside voxel v

Parameters
Ppoint P
vvoxel v
Returns
true if P is inside v

◆ voxelize() [1/2]

template<typename TDigitalSet , int Separation = 6>
template<typename MeshPoint >
void DGtal::MeshVoxelizer< TDigitalSet, Separation >::voxelize ( DigitalSet outputSet,
const Mesh< MeshPoint > &  aMesh,
const double  scaleFactor = 1.0 
)

Voxelize the mesh into the digital set.

Warning
if the mesh has non-trianuglar faces, we naively triangulate using a triangle fan at zero. If the face is not convex, the output will not be correct.

If one voxel is outside the digtial set (outputSet) domain, the voxel is skipped.

Parameters
[out]outputSetthe set that collects the voxels.
[in]aMeshthe mesh to voxelize (vertex coordinates will be casted to PointR3 points.
[in]scaleFactorthe scale factor to apply to the mesh (default=1.0)
Template Parameters
MeshPointthe type of point of the mesh.
Examples
shapes/exampleMeshVoxelizer.cpp.

Referenced by main().

◆ voxelize() [2/2]

template<typename TDigitalSet , int Separation = 6>
template<typename MeshPoint >
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.

Parameters
[out]outputSetthe set that collects the voxels.
[in]athe first point of the triangle
[in]bthe second point of the triangle
[in]cthe third point of the triangle
[in]scaleFactorthe scale factor to apply to the triangle (default=1.0)
Template Parameters
MeshPointthe type of point of the triangle (casted to PointR3 later).

◆ voxelizeTriangle()

template<typename TDigitalSet , int Separation = 6>
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

Parameters
[out]outputSetthe set that collects the voxels.
APoint A
BPoint B
CPoint C
nnormal of ABC
bboxbounding box of ABC

Field Documentation

◆ myIntersectionTarget

template<typename TDigitalSet , int Separation = 6>
IntersectionTarget DGtal::MeshVoxelizer< TDigitalSet, Separation >::myIntersectionTarget
private

Intersection target.

Definition at line 217 of file MeshVoxelizer.h.


The documentation for this class was generated from the following file: