DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
exampleMeshVoxelizer.cpp
Go to the documentation of this file.
1
16
29
30
36
38
#include <iostream>
39
#include "ConfigExamples.h"
40
#include "DGtal/helpers/StdDefs.h"
41
#include "DGtal/base/Common.h"
42
#include "DGtal/shapes/Mesh.h"
44
#include "DGtal/shapes/MeshVoxelizer.h"
46
#include "DGtal/io/writers/MeshWriter.h"
48
49
using namespace
std
;
50
using namespace
DGtal
;
51
53
54
int
main
( )
55
{
56
trace
.
beginBlock
(
"Example MeshVoxelizer"
);
57
58
60
using namespace
Z3i
;
61
Mesh<Point>
aMesh;
62
63
trace
.
info
()<<
"Creating a cube"
<<std::endl;
64
//Creating a cube
65
aMesh.
addVertex
(
Point
(0,0,0));
66
aMesh.
addVertex
(
Point
(1,0,0));
67
aMesh.
addVertex
(
Point
(1,1,0));
68
aMesh.
addVertex
(
Point
(0,1,0));
69
aMesh.
addVertex
(
Point
(0,1,1));
70
aMesh.
addVertex
(
Point
(1,1,1));
71
aMesh.
addVertex
(
Point
(1,0,1));
72
aMesh.
addVertex
(
Point
(0,0,1));
73
74
aMesh.
addQuadFace
(0,1,2,3);
75
aMesh.
addQuadFace
(1,2,5,6);
76
aMesh.
addQuadFace
(7,6,5,4);
77
aMesh.
addQuadFace
(3,2,5,4);
78
aMesh.
addQuadFace
(0,3,4,7);
79
aMesh.
addQuadFace
(0,1,6,7);
81
82
84
Domain
domain
(
Point
(0,0,0),
Point
(128,128,128));
85
DigitalSet
outputSet(
domain
);
86
87
MeshVoxelizer<DigitalSet, 6>
voxelizer;
88
89
trace
.
info
()<<
"Digitization..."
<<std::endl;
90
voxelizer.
voxelize
(outputSet, aMesh, 15.0);
91
92
trace
.
info
()<<
"Got "
<< outputSet.
size
() <<
" voxels."
<<std::endl;
94
95
trace
.
endBlock
();
96
return
0;
97
}
98
// //
DGtal::DigitalSetByAssociativeContainer::size
Size size() const
DGtal::MeshVoxelizer
Aim: A class for computing the digitization of a triangle or a Mesh.
Definition
MeshVoxelizer.h:80
DGtal::MeshVoxelizer::voxelize
void voxelize(DigitalSet &outputSet, const Mesh< MeshPoint > &aMesh, const double scaleFactor=1.0)
DGtal::Mesh
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition
Mesh.h:92
DGtal::Mesh::addQuadFace
void addQuadFace(Index indexVertex1, Index indexVertex2, Index indexVertex3, Index indexVertex4, const DGtal::Color &aColor=DGtal::Color::White)
DGtal::Mesh::addVertex
void addVertex(const TPoint &vertex)
DGtal::Point
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal::Domain
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
domain
Domain domain
Definition
testProjection.cpp:88
DigitalSet
Z2i::DigitalSet DigitalSet
Definition
testVoronoiMapComplete.cpp:40
examples
shapes
exampleMeshVoxelizer.cpp
Generated on
for DGtal by
1.18.0