DGtal 1.4.0
Loading...
Searching...
No Matches
testPolyscopeViewer3D.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
Include dependency graph for testPolyscopeViewer3D.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
2011/01/03

Functions for testing class Viewer3D.

This file is part of the DGtal library.

Definition in file testPolyscopeViewer3D.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 51 of file testPolyscopeViewer3D.cpp.

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}
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
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
Trace trace
Definition Common.h:153
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Domain domain

References DGtal::Shapes< TDomain >::addNorm1Ball(), DGtal::Shapes< TDomain >::addNorm2Ball(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::className(), domain, DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::trace.