DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testDisplayKSCell.cpp
1 
30 
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 <QtGui/qapplication.h>
43 #include "DGtal/io/viewers/Viewer3D.h"
44 #include "DGtal/base/Common.h"
45 #include "DGtal/helpers/StdDefs.h"
46 #include "DGtal/shapes/Shapes.h"
48 
49 using namespace std;
50 using namespace DGtal;
51 using namespace Z3i;
52 
54 // Functions for testing Display of display of KS space Cell.
56 
60 bool testViewer3D()
61 {
62  unsigned int nbok = 0;
63  unsigned int nb = 0;
64 
65  trace.beginBlock ( "Testing block ..." );
66  nbok += true ? 1 : 0;
67  nb++;
68  trace.info() << "(" << nbok << "/" << nb << ") "
69  << "true == true" << std::endl;
70  trace.endBlock();
71 
72  return nbok == nb;
73 }
74 
76 // Standard services - public :
77 
78 int main( int argc, char** argv )
79 {
80 
81  QApplication application(argc,argv);
82  Viewer3D viewer;
83  viewer.show();
84 
85  KSpace K;
86  Point plow(0,0,0);
87  Point pup(3,3,2);
88  Domain domain( plow, pup );
89  K.init( plow, pup, true );
90 
91 
92  //viewer << SetMode3D( domain.className(), "Paving" );
93  // viewer << domain;
94 
95 
96  // Drawing cell of dimension 3
97  Cell voxelA = K.uCell(Point(1,1,1));
98  SCell voxelB = K.sCell(Point(1,1,3));
99  viewer << voxelB<< voxelA;//
100 
101  // drawing cells of dimension 2
102  SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
103  SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
104  Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
105  SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
106  Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
107  viewer << surfelA << surfelB << surfelC << surfelD << surfelE;
108 
109  Cell linelA = K.uCell(Point(2,1 ,2));
110  SCell linelB = K.sCell(Point(2,2 ,1));
111  SCell linelC = K.sCell(Point(1,2 ,2), false);
112  viewer << linelA << linelB << linelC;
113 
114 
115  Cell center(Point(5,5,5));
116 // Testing display of oriented surfels:
117  SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
118  SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
119  SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
120  viewer<< center;
121 
122  SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
123  SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
124  SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
125 
126  viewer << ssurfelXZ << ssurfelXY << ssurfelZY;
127  viewer << ssurfelXZo << ssurfelXYo << ssurfelZYo;
128 
129  // Testing display oriented pointels
130  Cell pointelA = K.uCell(Point(2, 2, 2));
131  SCell pointelB = K.sCell(Point(4, 4, 4), true);
132  SCell pointelC = K.sCell(Point(6, 4, 4), false);
133  SCell linelAC = K.sCell(Point(5, 4, 4), false);
134  viewer << pointelA << pointelB << pointelC << linelAC;
135 
136  viewer << Viewer3D::updateDisplay;
137  application.exec();
138 
139 
140  trace.endBlock();
141  return true;
142 }
143 // //