DGtal  1.4.beta
testPolygon3D.cpp
Go to the documentation of this file.
1 
29 #include <iostream>
30 #include "DGtal/base/Common.h"
31 #include "DGtal/io/viewers/Viewer3D.h"
32 #include "DGtal/io/DrawWithDisplay3DModifier.h"
33 #include "DGtal/io/Color.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "DGtal/shapes/Shapes.h"
37 
38 using namespace std;
39 using namespace DGtal;
40 using namespace Z3i;
41 
43 // Standard services - public :
44 
45 int main( int argc, char** argv )
46 {
47 
48  QApplication application(argc,argv);
49  Viewer3D<> viewer;
50  viewer.setWindowTitle("simpleViewer");
51  viewer.show();
52  trace.beginBlock ( "Testing Polygon 3D display in Viewer3D" );
53  std::vector<Z3i::RealPoint> polyg1;
54 
55  polyg1.push_back(Z3i::RealPoint(0,0,0));
56  polyg1.push_back(Z3i::RealPoint(0,1,0));
57  polyg1.push_back(Z3i::RealPoint(1,1,0));
58 
59  viewer.addPolygon(polyg1);
60 
61  viewer.createNewPolygonList("hop");
62 
63  std::vector<Z3i::RealPoint> polyg2;
64 
65  polyg2.push_back(Z3i::RealPoint(0,10,0));
66  polyg2.push_back(Z3i::RealPoint(0,11,0));
67  polyg2.push_back(Z3i::RealPoint(11,11,0));
68 
69  viewer.addPolygon(polyg2);
70 
71  viewer << Viewer3D<>::updateDisplay;
72 
73  bool res = application.exec();
74  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
75  trace.endBlock();
76  return res ? 0 : 1;
77 
78 
79 }
80 // //
82 
void addPolygon(const std::vector< RealPoint > &vertices)
void createNewPolygonList(std::string s="")
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
int main(int argc, char **argv)