DGtal  1.4.beta
testViewerQuad.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 testViewerQuad.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 testViewerQuad.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file testViewerQuad.cpp.

52 {
53 
54  QApplication application(argc,argv);
55  KSpace k;
56 
57  k.init(Point(2,2,2), Point(4,4,4), true);
58  Viewer3D<Space,KSpace> viewer(k);
59  viewer.setWindowTitle("simpleViewer");
60  viewer.show();
61 
62 
63  trace.beginBlock ( "Testing class for Viewer3D" );
64 
65  Point p1( 0, 0, 0 );
66  Point p2( 0, 1 , 0);
67  Point p3( 1, 1, 0);
68  Point p4(1, 0, 0 );
69  Point p5( 2, 0 , 0);
70  Point p6( 2, 1, 0);
71  RealVector n(1,1,1);
72  RealVector n2(0,1,1);
73 
74  viewer.addQuadWithNormal(p1,p2,p3,p4, n.getNormalized(), true);
75  viewer.addQuadWithNormal(p4,p5,p6,p3, n2.getNormalized(), true);
76 
77  Cell surfel = k.uCell( Point( 2,3,3) );
78  SCell surfel2 = k.sCell( Point( 6,3,3), KSpace::POS);
79  SCell surfel3 = k.sCell( Point( 8,3,3), KSpace::NEG );
80 
81  viewer << SetMode3D( surfel.className(), "Basic" );
82 
83  Display3DFactory<Space,KSpace>::drawUnorientedSurfelWithNormal( viewer, surfel, n2.getNormalized());
84 
85  Display3DFactory<Space,KSpace>::drawOrientedSurfelWithNormal( viewer, surfel2, n2.getNormalized());
86 
87  Display3DFactory<Space,KSpace>::drawOrientedSurfelWithNormal( viewer, surfel3, n2.getNormalized());
88 
89 
90 
91 
92 
93  viewer << Display3D<Space, KSpace>::updateDisplay;
94 
95  bool res = application.exec();
96 
97 
98 
99 
100 
101 
102  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
103  trace.endBlock();
104  return res ? 0 : 1;
105 }
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
Trace trace
Definition: Common.h:153
Factory for GPL Display3D:
std::string className() const
Return the style name used for drawing this object.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
MyPointD Point
Definition: testClone2.cpp:383

References DGtal::Display3D< Space, KSpace >::addQuadWithNormal(), DGtal::Trace::beginBlock(), DGtal::KhalimskyCell< dim, TInteger >::className(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::getNormalized(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::Viewer3D< TSpace, TKSpace >::show(), DGtal::trace, and DGtal::KhalimskySpaceND< dim, TInteger >::uCell().