DGtal  1.5.beta
testMeshDisplay.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 testMeshDisplay.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
2012/07/07

Functions for testing class MeshDisplay.

This file is part of the DGtal library.

Definition in file testMeshDisplay.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

[MeshUseInitDisplay]

[MeshUseInitDisplay]

[MeshUseMeshCreation]

[MeshUseMeshCreation] [MeshUseDisplay]

[MeshUseDisplay]

Definition at line 51 of file testMeshDisplay.cpp.

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  QApplication application(argc,argv);
60  Viewer3D<> viewer;
61  viewer.show();
63 
65  Mesh<Point> aMesh(true);
66  aMesh.addVertex(Point(0,0,0));
67  aMesh.addVertex(Point(1,0,0));
68  aMesh.addVertex(Point(1,1,0));
69 
70  aMesh.addVertex(Point(0,0,1));
71  aMesh.addVertex(Point(1,0,1));
72  aMesh.addVertex(Point(1,1,1));
73  aMesh.addVertex(Point(0,1,1));
74 
75  aMesh.addVertex(Point(0,1,0));
76  aMesh.addVertex(Point(0,2,0));
77  aMesh.addVertex(Point(0,3,1));
78  aMesh.addVertex(Point(0,2,2));
79  aMesh.addVertex(Point(0,1,2));
80  aMesh.addVertex(Point(0,0,1));
81 
82  aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
83  aMesh.addQuadFace(6,5,4,3, Color::Blue);
84 
85  Mesh<Point>::MeshFace listIndex;
86  listIndex.push_back(7);
87  listIndex.push_back(8);
88  listIndex.push_back(9);
89  listIndex.push_back(10);
90  listIndex.push_back(11);
91  listIndex.push_back(12);
92 
93  aMesh.addFace(listIndex, Color(150,150,0,54));
96  viewer.setLineColor(Color(150,0,0,254));
97  viewer << aMesh;
98  viewer << Viewer3D<>::updateDisplay;
99  bool res = application.exec();
101  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
102  trace.endBlock();
103  return res ? 0 : 1;
104 }
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
virtual void setLineColor(DGtal::Color aColor)
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition: Mesh.h:92
void addFace(const MeshFace &aFace, const DGtal::Color &aColor=DGtal::Color::White)
std::vector< Index > MeshFace
Definition: Mesh.h:126
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Trace trace
Definition: Common.h:153
MyPointD Point
Definition: testClone2.cpp:383

References DGtal::Mesh< TPoint >::addFace(), DGtal::Mesh< TPoint >::addQuadFace(), DGtal::Mesh< TPoint >::addTriangularFace(), DGtal::Mesh< TPoint >::addVertex(), DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::Display3D< Space, KSpace >::setLineColor(), DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::trace.