DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
mesh3DConstructionAndVisualisation.cpp
Go to the documentation of this file.
1
16
29
30
37
38
40
#include "DGtal/base/Common.h"
41
#include "DGtal/helpers/StdDefs.h"
43
#include "DGtal/shapes/Mesh.h"
45
#include "DGtal/io/viewers/PolyscopeViewer.h"
47
48
using namespace
std
;
49
using namespace
DGtal
;
50
using namespace
DGtal::Z3i
;
51
52
53
int
main
()
54
{
55
57
PolyscopeViewer<>
viewer;
59
60
62
// A mesh is constructed and faces are added from the vertex set.
64
Mesh<Point>
aMesh(
true
);
66
68
aMesh.
addVertex
(
Point
(0,0,0));
69
aMesh.
addVertex
(
Point
(1,0,0));
70
aMesh.
addVertex
(
Point
(1,1,0));
72
73
aMesh.
addVertex
(
Point
(0,0,1));
74
aMesh.
addVertex
(
Point
(1,0,1));
75
aMesh.
addVertex
(
Point
(1,1,1));
76
aMesh.
addVertex
(
Point
(0,1,1));
77
78
aMesh.
addVertex
(
Point
(0,1,0));
79
aMesh.
addVertex
(
Point
(0,2,0));
80
aMesh.
addVertex
(
Point
(0,3,1));
81
aMesh.
addVertex
(
Point
(0,2,2));
82
aMesh.
addVertex
(
Point
(0,1,2));
83
aMesh.
addVertex
(
Point
(0,0,1));
85
aMesh.
addTriangularFace
(0, 1, 2,
Color
(150,0,150,104));
86
aMesh.
addQuadFace
(6,5,4,3,
Color::Blue
);
88
90
Mesh<Point>::MeshFace
listIndex;
91
listIndex.push_back(7);
92
listIndex.push_back(8);
93
listIndex.push_back(9);
94
listIndex.push_back(10);
95
listIndex.push_back(11);
96
listIndex.push_back(12);
97
aMesh.
addFace
(listIndex,
Color
(150,150,0,54));
100
102
viewer.
drawColor
(
Color
(150,0,0,254));
103
viewer << aMesh;
105
viewer.
show
();
106
return
0;
107
}
108
// //
DGtal::Color::Color
Color()
Definition
Color.h:139
DGtal::Color::Blue
static const Color Blue
Definition
Color.h:428
DGtal::Display3D::drawColor
void drawColor(const DGtal::Color &color)
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::addFace
void addFace(const MeshFace &aFace, const DGtal::Color &aColor=DGtal::Color::White)
DGtal::Mesh::MeshFace
std::vector< Index > MeshFace
Definition
Mesh.h:126
DGtal::Mesh::addTriangularFace
void addTriangularFace(Index indexVertex1, Index indexVertex2, Index indexVertex3, const DGtal::Color &aColor=DGtal::Color::White)
DGtal::Mesh::addVertex
void addVertex(const TPoint &vertex)
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:57
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::Point
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
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
shapes
mesh3DConstructionAndVisualisation.cpp
Generated on
for DGtal by
1.18.0