DGtal  0.9.3
Functions
mesh3DConstructionAndVisualisation.cpp File Reference
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Mesh.h"
#include "DGtal/io/viewers/Viewer3D.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.

References DGtal::Mesh< TPoint >::addFace(), DGtal::Mesh< TPoint >::addQuadFace(), DGtal::Mesh< TPoint >::addTriangularFace(), DGtal::Mesh< TPoint >::addVertex(), DGtal::Display3D< Space, KSpace >::setLineColor(), and DGtal::Viewer3D< Space, KSpace >::show().

54 {
55 
57  QApplication application(argc,argv);
58  Viewer3D<> viewer;
59  viewer.show();
61 
62 
64  // A mesh is constructed and faces are added from the vertex set.
66  Mesh<Point> aMesh(true);
68 
70  aMesh.addVertex(Point(0,0,0));
71  aMesh.addVertex(Point(1,0,0));
72  aMesh.addVertex(Point(1,1,0));
74 
75  aMesh.addVertex(Point(0,0,1));
76  aMesh.addVertex(Point(1,0,1));
77  aMesh.addVertex(Point(1,1,1));
78  aMesh.addVertex(Point(0,1,1));
79 
80  aMesh.addVertex(Point(0,1,0));
81  aMesh.addVertex(Point(0,2,0));
82  aMesh.addVertex(Point(0,3,1));
83  aMesh.addVertex(Point(0,2,2));
84  aMesh.addVertex(Point(0,1,2));
85  aMesh.addVertex(Point(0,0,1));
87  aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
88  aMesh.addQuadFace(6,5,4,3, Color::Blue);
90 
92  vector<unsigned int> listIndex;
93  listIndex.push_back(7);
94  listIndex.push_back(8);
95  listIndex.push_back(9);
96  listIndex.push_back(10);
97  listIndex.push_back(11);
98  listIndex.push_back(12);
99  aMesh.addFace(listIndex, Color(150,150,0,54));
102 
104  viewer.setLineColor(Color(150,0,0,254));
105  viewer << aMesh;
106  viewer << Viewer3D<>::updateDisplay;
108  bool res = application.exec();
109  FATAL_ERROR(res);
110  return true;
111 }
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: This class is defined to represent a surface mesh through a set of vertices and faces...
Definition: Mesh.h:91
virtual void setLineColor(DGtal::Color aColor)
MyPointD Point
Definition: testClone2.cpp:383
Structure representing an RGB triple with alpha component.
Definition: Color.h:66