DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
viewer3D-4bis-illustrationMode.cpp
1 
30 
31 #include <iostream>
32 #include <QtGui/qapplication.h>
33 #include "DGtal/io/viewers/Viewer3D.h"
34 #include "DGtal/base/Common.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/shapes/Shapes.h"
38 #include "DGtal/io/DrawWithDisplay3DModifier.h"
41 
42 using namespace std;
43 using namespace DGtal;
44 using namespace Z3i;
45 
46 
48 // Standard services - public :
49 
50 int main( int argc, char** argv )
51 {
52 
53  QApplication application(argc,argv);
54  Viewer3D viewer;
55  viewer.show();
56 
57  KSpace K;
58  Point plow(0,0,0);
59  Point pup(1,1,0);
60  Domain domain( plow, pup );
61  K.init( plow, pup, true );
62 
63  viewer << SetMode3D( domain.className(), "Paving" );
64  viewer << domain;
65 
66  // drawing cells of dimension 3
67 
68  SCell v2 = K.sSpel( Point( 1, 0, 0 ), KSpace::POS ); // +v
69  SCell v3 = K.sSpel( Point( 0, 1, 0 ), KSpace::POS ); // +v
70  SCell v4 = K.sSpel( Point( 1, 1, 0 ), KSpace::NEG ); // +v
72  SCell v = K.sSpel( Point( 0, 0, 0 ), KSpace::POS ); // +v
73  viewer << SetMode3D( v.className(), "Illustration" );
75 
76  viewer << v << v2 << v3;
77 
78 
79  // Surfel of Voxel (0,0)
81  SCell sx = K.sIncident( v, 0, true ); // surfel further along x
82  DGtal::TransformedKSSurfel tsx (sx, v);
84 
85  SCell sy = K.sIncident( v, 1, true ); // surfel further along y
86  SCell sz = K.sIncident( v, 2, true ); // surfel further along z
87  SCell sxn = K.sIncident( v, 0, false ); // surfel further along x
88  SCell syn = K.sIncident( v, 1, false ); // surfel further along y
89  SCell szn = K.sIncident( v, 2, false ); // surfel further along z
90 
91  // Resizing and shifting the surfel towords its associated voxel (v).
92 
93  DGtal::TransformedKSSurfel tsy (sy, v);
94  DGtal::TransformedKSSurfel tsz (sz, v);
95  DGtal::TransformedKSSurfel tsxn (sxn, v);
96  DGtal::TransformedKSSurfel tsyn (syn, v);
97  DGtal::TransformedKSSurfel tszn (szn, v);
98 
99  viewer << tsx << tsy << tsz << tsxn << tsyn << tszn;
100 
101 
102  // Surfel of Voxel (1,0)
103  SCell sx2 = K.sIncident( v2, 0, true ); // surfel further along x
104  SCell sy2 = K.sIncident( v2, 1, true ); // surfel further along y
105  SCell sz2 = K.sIncident( v2, 2, true ); // surfel further along z
106  SCell sxn2 = K.sIncident( v2, 0, false ); // surfel further along x
107  SCell syn2 = K.sIncident( v2, 1, false ); // surfel further along y
108  SCell szn2 = K.sIncident( v2, 2, false ); // surfel further along z
109 
110  // Resizing and shifting the surfel towords its associated voxel (v2).
111  DGtal::TransformedKSSurfel tsx2 (sx2, v2);
112  DGtal::TransformedKSSurfel tsy2 (sy2, v2);
113  DGtal::TransformedKSSurfel tsz2 (sz2, v2);
114  DGtal::TransformedKSSurfel tsxn2 (sxn2, v2);
115  DGtal::TransformedKSSurfel tsyn2 (syn2, v2);
116  DGtal::TransformedKSSurfel tszn2 (szn2, v2);
117 
118  viewer << tsx2 << tsy2 << tsz2 << tsxn2 << tsyn2 << tszn2;
119 
120 
121  // Surfel of Voxel (0,1)
122  SCell sx3 = K.sIncident( v3, 0, true ); // surfel further along x
123  SCell sy3 = K.sIncident( v3, 1, true ); // surfel further along y
124  SCell sz3 = K.sIncident( v3, 2, true ); // surfel further along z
125  SCell sxn3 = K.sIncident( v3, 0, false ); // surfel further along x
126  SCell syn3 = K.sIncident( v3, 1, false ); // surfel further along y
127  SCell szn3 = K.sIncident( v3, 2, false ); // surfel further along z
128 
129  // Shifting the surfel to its associated voxel (v3).
130  DGtal::TransformedKSSurfel tsx3 (sx3, v3);
131  DGtal::TransformedKSSurfel tsy3 (sy3, v3);
132  DGtal::TransformedKSSurfel tsz3 (sz3, v3);
133  DGtal::TransformedKSSurfel tsxn3 (sxn3, v3);
134  DGtal::TransformedKSSurfel tsyn3 (syn3, v3);
135  DGtal::TransformedKSSurfel tszn3 (szn3, v3);
136 
137 
138  viewer << tsx3 << tsy3 << tsz3 << tsxn3 << tsyn3 << tszn3;
139  viewer << Display3D::updateDisplay;
140 
141  return application.exec();
142 }
143 // //
145 
146 
147 
148