DGtal 1.3.0
Loading...
Searching...
No Matches
ctopo-1s-3d.cpp
Go to the documentation of this file.
1
42#include <iostream>
43#include "DGtal/base/Common.h"
44#include "DGtal/helpers/StdDefs.h"
45#include "DGtal/io/viewers/Viewer3D.h"
46
47#include "DGtal/io/DrawWithDisplay3DModifier.h"
49
50using namespace std;
51using namespace DGtal;
52using namespace DGtal::Z3i;
53
55
56int main( int argc, char** argv )
57{
58 // for 3D display with Viewer3D
59 QApplication application(argc,argv);
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
68 MyViewer viewer(K);
69 viewer.show();
70 //viewer << SetMode3D( domain.className(), "Paving" );
71
72 SCell ptlow = K.sPointel( plow ); // pointel (0*2,0*2, 0*2)
73 SCell ptup1 = K.sPointel( pup ); // pointel (3*2,3*2, 2*2)
74 SCell ptup2 = K.sTranslation( ptup1, Point::diagonal() ); // pointel (4*2, 4*2, 3*2)
75
76 viewer << ptlow << ptup1 << ptup2;
77
78 // drawing cells of dimension 0
79 SCell p1= K.sCell(Point(0,0,2),false); // pointel (0*2,0*2,2*2)
80 SCell p2= K.sCell(Point(0,2,2)); // ...
81 SCell p3= K.sCell(Point(2,2,2),false);
82 SCell p4= K.sCell(Point(2,0,2));
83 SCell p5= K.sCell(Point(0,0,4),false);
84 SCell p6= K.sCell(Point(0,2,4));
85 SCell p7= K.sCell(Point(2,2,4), false);
86 SCell p8= K.sCell(Point(2,0,4));
87 viewer << p1 << p2 << p3 << p4 << p5 << p6 << p7 << p8;
88
89 // drawing Cells of dimension 1
90 SCell linel0 = K.sCell( Point( 1, 0, 2 ) ); // linel (2*1+1, 0, 2*2)
91 SCell linel1 = K.sCell( Point( 1, 2, 2 ) ); // ...
92 SCell linel2 = K.sCell( Point( 0, 1, 2 ) );
93 SCell linel3 = K.sCell( Point( 2, 1, 2 ) );
94
95 SCell linel4 = K.sCell( Point( 1, 0, 4 ) );
96 SCell linel5 = K.sCell( Point( 1, 2, 4 ) );
97 SCell linel6 = K.sCell( Point( 0, 1, 4 ) );
98 SCell linel7 = K.sCell( Point( 2, 1, 4 ) );
99
100 SCell linel8 = K.sCell( Point( 0, 0, 3 ) );
101 SCell linel9 = K.sCell( Point( 0, 2, 3 ) );
102 SCell linel10 = K.sCell( Point( 2, 0, 3 ) );
103 SCell linel11 = K.sCell( Point( 2, 2, 3 ) );
104
105
106 SCell linel12 = K.sCell( Point( 3, 2, 2 ) );
107
108 viewer << linel0<< linel1<< linel2 << linel3 ;
109 viewer << linel4<< linel5<< linel6 << linel7 ;
110 viewer << linel8<< linel9<< linel10 << linel11 << linel12;
111
112 // drawing cells of dimension 2
113
114 SCell surfelA = K.sCell( Point( 2, 1, 3 ) ); // surfel (2*2,2*1+1,2*3+1)
115 SCell surfelB = K.sCell( Point( 1, 0, 1 ) ); // surfel (2*1,2*0,2*1+1)
116 SCell surfelC = K.sCell( Point( 2, 1, 1 ),false ); // surfel (2*2,2*1+1,2*1+1)
117 viewer << surfelA << surfelB << surfelC;
118
119 // drawing cells of dimension 3
120 SCell vox1 = K.sCell( Point( 3, 3, 3 ) ); // voxel (2*3+1,2*3+1,2*3+1)
121 SCell vox2 = K.sCell( Point( 1, 1, 3 ) ,false ); // voxel (2*1+1,2*1+1,2*3+1)
122 viewer << vox1 << vox2;
123
124
125 viewer << CameraPosition(-2.9, 2.96, 2.64)
126 << CameraDirection(0.6, -0.43, 0.65)
127 << CameraUpVector(0.32, 0.900, 0.29);
128
130 return application.exec();
131
132 return 0;
133}
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.
SCell sTranslation(const SCell &p, const Vector &vec) const
Add the vector [vec] to [p].
SCell sPointel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
static Self diagonal(Component val=1)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Z3i this namespace gathers the standard of types for 3D imagery.
Space::Point Point
Definition: StdDefs.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
CameraDirection class to set camera direction.
CameraPosition class to set camera position.
CameraUpVector class to set camera up-vector.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
int main()
Definition: testBits.cpp:56
KSpace K
Domain domain