Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
testMeshDisplay.cpp
Go to the documentation of this file.
1
16
29
32#include "DGtal/base/Common.h"
33#include "DGtal/helpers/StdDefs.h"
34#include "DGtal/shapes/Mesh.h"
35#include "DGtal/io/viewers/PolyscopeViewer.h"
38
39using namespace std;
40using namespace DGtal;
41using namespace DGtal::Z3i;
42
44// Functions for testing class Mesh Display.
46
48// Standard services - public :
49
50
51int main( int argc, char** argv )
52{
53 trace.beginBlock ( "Testing class MeshDisplay" );
54 trace.info() << "Args:";
55 for ( int i = 0; i < argc; ++i )
56 trace.info() << " " << argv[ i ];
57 trace.info() << endl;
59 PolyscopeViewer viewer;
61
63 Mesh<Point> aMesh(true);
64 aMesh.addVertex(Point(0,0,0));
65 aMesh.addVertex(Point(1,0,0));
66 aMesh.addVertex(Point(1,1,0));
67
68 aMesh.addVertex(Point(0,0,1));
69 aMesh.addVertex(Point(1,0,1));
70 aMesh.addVertex(Point(1,1,1));
71 aMesh.addVertex(Point(0,1,1));
72
73 aMesh.addVertex(Point(0,1,0));
74 aMesh.addVertex(Point(0,2,0));
75 aMesh.addVertex(Point(0,3,1));
76 aMesh.addVertex(Point(0,2,2));
77 aMesh.addVertex(Point(0,1,2));
78 aMesh.addVertex(Point(0,0,1));
79
80 aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
81 aMesh.addQuadFace(6,5,4,3, Color::Blue);
82
83 Mesh<Point>::MeshFace listIndex;
84 listIndex.push_back(7);
85 listIndex.push_back(8);
86 listIndex.push_back(9);
87 listIndex.push_back(10);
88 listIndex.push_back(11);
89 listIndex.push_back(12);
90
91 aMesh.addFace(listIndex, Color(150,150,0,54));
94 viewer << aMesh;
95
97 trace.emphase() << "Passed." << endl;
98 trace.endBlock();
99 viewer.show();
100 return 0;
101}
102// //
Structure representing an RGB triple with alpha component.
Definition Color.h:77
static const Color Blue
Definition Color.h:428
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition Mesh.h:92
void addQuadFace(Index indexVertex1, Index indexVertex2, Index indexVertex3, Index indexVertex4, const DGtal::Color &aColor=DGtal::Color::White)
void addFace(const MeshFace &aFace, const DGtal::Color &aColor=DGtal::Color::White)
std::vector< Index > MeshFace
Definition Mesh.h:126
void addTriangularFace(Index indexVertex1, Index indexVertex2, Index indexVertex3, const DGtal::Color &aColor=DGtal::Color::White)
void addVertex(const TPoint &vertex)
void show() override
Starts the event loop and display of elements.
Z3i this namespace gathers the standard of types for 3D imagery.
Space::Point Point
Definition StdDefs.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
STL namespace.
int main()
Definition testBits.cpp:56