DGtal 1.3.0
Loading...
Searching...
No Matches
testViewerQuad.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 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
84
86
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}
106// //
void addQuadWithNormal(const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4, const RealPoint &n, const bool enableReorientation, const bool enableDoubleFace=false)
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.
static const constexpr Sign NEG
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.
static const constexpr Sign POS
PointVector< dim, double, std::array< double, dim > > getNormalized() const
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:154
STL namespace.
static void drawOrientedSurfelWithNormal(Display &display, const typename KSpace::SCell &aSignedCell, const RealVector &aNormal, const bool enableDoubleFace=false)
static void drawUnorientedSurfelWithNormal(Display &display, const typename KSpace::Cell &anObject, const RealVector &aNormal, const bool enableDoubleFace=false)
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.
int main()
Definition: testBits.cpp:56