Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
testDisplayKSCell.cpp
Go to the documentation of this file.
1
16
29
31#include <iostream>
32#include "DGtal/base/Common.h"
34
35using namespace std;
36using 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/PolyscopeViewer.h"
47
48using namespace std;
49using namespace DGtal;
50using namespace Z3i;
51
53// Functions for testing Display of display of KS space Cell.
55int main( int argc, char** argv )
56{
57
58 KSpace K;
59 Point plow(0,0,0);
60 Point pup(3,3,2);
61 Domain domain( plow, pup );
62 K.init( plow, pup, true );
63
65 trace.beginBlock ( "Testing display KSCell in Viewer 3D" );
66 // if the domain is visible can't see the cubes inside
67 // viewer << domain;
68
69
70 // Drawing cell of dimension 3
71 Cell voxelA = K.uCell(Point(1, 1, 1));
72 SCell voxelB = K.sCell(Point(1, 1, 3));
73 viewer << voxelB<< voxelA;//
74
75 // drawing cells of dimension 2
76 SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
77 SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
78 Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
79 SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
80 Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
81 viewer << surfelA << surfelB << surfelC << surfelD << surfelE;
82
83 Cell linelA = K.uCell(Point(2, 1 ,2));
84 SCell linelB = K.sCell(Point(2, 2 ,1));
85 SCell linelC = K.sCell(Point(1, 2 ,2), false);
86 viewer << linelA << linelB << linelC;
87
88 Cell center = K.uCell(Point(5,5,5));
89 // Testing display of oriented surfels:
90 SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
91 SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
92 SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
93 viewer<< center;
94
95 SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
96 SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
97 SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
98
99 viewer << ssurfelXZ << ssurfelXY << ssurfelZY;
100 viewer << ssurfelXZo << ssurfelXYo << ssurfelZYo;
101
102 // Testing display oriented pointels
103 Cell pointelA = K.uCell(Point(2, 2, 2));
104 SCell pointelB = K.sCell(Point(4, 4, 4), true);
105 SCell pointelC = K.sCell(Point(6, 4, 4), false);
106 SCell linelAC = K.sCell(Point(5, 4, 4), false);
107 viewer << pointelA << pointelB << pointelC << linelAC;
108
109 trace.emphase() << "Passed." << endl;
110 trace.endBlock();
111 viewer.show();
112 return 0;
113}
114// //
void show() override
Starts the event loop and display of elements.
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
Definition StdDefs.h:146
Space::Point Point
Definition StdDefs.h:168
KSpace::SCell SCell
Definition StdDefs.h:149
KSpace::Cell Cell
Definition StdDefs.h:148
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
STL namespace.
int main()
Definition testBits.cpp:56
KSpace K
Domain domain