DGtal 1.4.0
Loading...
Searching...
No Matches
testPolyscopeViewer3D.cpp
Go to the documentation of this file.
1
31#include <iostream>
32#include "DGtal/base/Common.h"
33#include "DGtal/io/viewers/Viewer3D.h"
34#include "DGtal/io/DrawWithDisplay3DModifier.h"
35#include "DGtal/io/Color.h"
36#include "DGtal/helpers/StdDefs.h"
37#include "DGtal/shapes/Shapes.h"
39
40using namespace std;
41using namespace DGtal;
42using namespace Z3i;
43
45// Functions for testing class Viewer3D.
47
49// Standard services - public :
50
51int main( int argc, char ** argv )
52{
53
54 QApplication application( argc, argv );
55 Viewer3D<> viewer;
56 viewer.setWindowTitle( "simpleViewer" );
57 viewer.show();
58
59 trace.beginBlock( "Testing class for Viewer3D" );
60
61 Point p1( 14, 14, 14 );
62 Point p2( 27, 27, 27 );
63 Domain domain( p1, p2 );
64
65 viewer << CustomColors3D( Color( 20, 20, 20, 50 ), Color( 20, 0, 250, 30 ) );
66 viewer << SetMode3D( domain.className(), "Grid" );
67 viewer << domain;
68
69 DigitalSet shape_set( domain );
70 Shapes<Domain>::addNorm1Ball( shape_set, Point( 13, 23, 13 ), 7 );
71 viewer << CustomColors3D( Color( 250, 200, 0, 100 ),
72 Color( 250, 200, 0, 50 ) );
73
74 viewer << shape_set;
75 DigitalSet shape_set2( domain );
76 Shapes<Domain>::addNorm1Ball( shape_set2, Point( 24, 15, 12 ), 12 );
77 viewer << shape_set2;
78
79 DigitalSet shape_set3( domain );
80 Shapes<Domain>::addNorm2Ball( shape_set3, Point( 11, 15, 12 ), 12 );
81 viewer << CustomColors3D( Color( 250, 20, 0, 190 ),
82 Color( 220, 20, 20, 250 ) );
83 viewer << shape_set3;
84
85 Point pp1( -1, -1, -2 );
86 Point pp2( 2, 2, 3 );
87
88 Domain domain2( pp1, pp2 );
89 Point pp3( 1, 1, 1 );
90 Point pp4( 2, -1, 5 );
91 Point pp5( -1, 2, 3 );
92 Point pp6( 0, 0, 0 );
93 Point pp0( 0, 2, 1 );
94
95 // viewer<< m;
96 viewer << SetMode3D( pp1.className(), "Paving" );
97 viewer << pp1 << pp2 << pp3;
98
99 // viewer << SetMode3D( pp1.className(), "Grid" );
100 viewer << CustomColors3D( Color( 250, 0, 0 ), Color( 250, 0, 0 ) );
101 viewer << SetMode3D( pp1.className(), "PavingWired" );
102 viewer << pp4 << pp5;
103 viewer << SetMode3D( pp1.className(), "Both" );
104 viewer << CustomColors3D( Color( 250, 200, 0, 100 ),
105 Color( 250, 0, 0, 100 ) );
106 viewer << pp6;
107 viewer << CustomColors3D( Color( 250, 200, 0, 100 ),
108 Color( 250, 200, 0, 20 ) );
109 viewer << pp0;
110
111 viewer << SetMode3D( domain.className(), "Paving" );
112 viewer << domain2 << Display3D<Space, KSpace>::updateDisplay;
113
114 bool res = application.exec();
115 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
116 trace.endBlock();
117 return res ? 0 : 1;
118}
119// //
Structure representing an RGB triple with alpha component.
Definition Color.h:68
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
std::string className() const
std::string className() const
static void addNorm1Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
static void addNorm2Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
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...
Space::Point Point
Definition StdDefs.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
int main()
Definition testBits.cpp:56
Domain domain