Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
mesh3DConstructionAndVisualisation.cpp File Reference
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Mesh.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
Include dependency graph for mesh3DConstructionAndVisualisation.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2013/01/10

Example of Mesh construction and visualisation.

This file is part of the DGtal library.

Definition in file mesh3DConstructionAndVisualisation.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

[MeshUseInitDisplay]

[MeshUseInitDisplay]

[MeshUseMeshCreation]

[MeshUseMeshConstructor]

[MeshUseMeshConstructor]

[MeshUseMeshAddingPoints]

[MeshUseMeshAddingPoints]

[MeshUseMeshAddingBasicFaces]

[MeshUseMeshAddingBasicFaces]

[MeshUseMeshAddingPolygonalFaces]

[MeshUseMeshAddingPolygonalFaces] [MeshUseMeshCreation]

[MeshUseDisplay]

[MeshUseDisplay]

Definition at line 53 of file mesh3DConstructionAndVisualisation.cpp.

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}
Structure representing an RGB triple with alpha component.
Definition Color.h:77
static const Color Blue
Definition Color.h:428
void drawColor(const DGtal::Color &color)
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition Mesh.h:92
std::vector< Index > MeshFace
Definition Mesh.h:126
void show() override
Starts the event loop and display of elements.
Space::Point Point
Definition StdDefs.h:168

References DGtal::Mesh< TPoint >::addFace(), DGtal::Mesh< TPoint >::addQuadFace(), DGtal::Mesh< TPoint >::addTriangularFace(), DGtal::Mesh< TPoint >::addVertex(), DGtal::Color::Blue, DGtal::Display3D< Space, KSpace >::drawColor(), and DGtal::PolyscopeViewer< Space, KSpace >::show().