DGtal  1.5.beta
testDisplayKSCell.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
34 
35 using namespace std;
36 using namespace DGtal;
37 
38 
39 
41 #include <iostream>
42 #include "DGtal/base/Common.h"
43 #include "DGtal/helpers/StdDefs.h"
44 #include "DGtal/shapes/Shapes.h"
45 #include "DGtal/io/viewers/Viewer3D.h"
47 
48 using namespace std;
49 using namespace DGtal;
50 using namespace Z3i;
51 
53 // Functions for testing Display of display of KS space Cell.
55 int main( int argc, char** argv )
56 {
57 
58  QApplication application(argc,argv);
59 
60 
61  KSpace K;
62  Point plow(0,0,0);
63  Point pup(3,3,2);
64  Domain domain( plow, pup );
65  K.init( plow, pup, true );
66 
67  Viewer3D<Space, KSpace> viewer(K);
68  viewer.show();
69  trace.beginBlock ( "Testing display KSCell in Viewer 3D" );
70  //viewer << SetMode3D( domain.className(), "Paving" );
71  // if the domain is visible can't see the cubes inside
72  // viewer << domain;
73 
74 
75  // Drawing cell of dimension 3
76  Cell voxelA = K.uCell(Point(1, 1, 1));
77  SCell voxelB = K.sCell(Point(1, 1, 3));
78  viewer << voxelB<< voxelA;//
79 
80  // drawing cells of dimension 2
81  SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
82  SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
83  Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
84  SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
85  Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
86  viewer << surfelA << surfelB << surfelC << surfelD << surfelE;
87 
88  Cell linelA = K.uCell(Point(2, 1 ,2));
89  SCell linelB = K.sCell(Point(2, 2 ,1));
90  SCell linelC = K.sCell(Point(1, 2 ,2), false);
91  viewer << linelA << linelB << linelC;
92 
93 
94  Cell center = K.uCell(Point(5,5,5));
95 // Testing display of oriented surfels:
96  SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
97  SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
98  SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
99  viewer<< center;
100 
101  SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
102  SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
103  SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
104 
105  viewer << ssurfelXZ << ssurfelXY << ssurfelZY;
106  viewer << ssurfelXZo << ssurfelXYo << ssurfelZYo;
107 
108  // Testing display oriented pointels
109  Cell pointelA = K.uCell(Point(2, 2, 2));
110  SCell pointelB = K.sCell(Point(4, 4, 4), true);
111  SCell pointelC = K.sCell(Point(6, 4, 4), false);
112  SCell linelAC = K.sCell(Point(5, 4, 4), false);
113  viewer << pointelA << pointelB << pointelC << linelAC;
114 
115  viewer << Viewer3D<>::updateDisplay;
116 
117  bool res = application.exec();
118  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
119  trace.endBlock();
120  return res ? 0 : 1;
121 }
122 // //
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()
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
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
MyPointD Point
Definition: testClone2.cpp:383
KSpace K
int main(int argc, char **argv)
Domain domain