DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ctopo-1s-3d.cpp
Go to the documentation of this file.
1
16
29
40
42
#include <iostream>
43
#include "DGtal/base/Common.h"
44
#include "DGtal/helpers/StdDefs.h"
45
#include "DGtal/io/viewers/PolyscopeViewer.h"
46
48
49
using namespace
std
;
50
using namespace
DGtal
;
51
using namespace
DGtal::Z3i
;
52
54
55
int
main
()
56
{
57
// for 3D display with PolyscopeViewer
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
64
typedef
PolyscopeViewer<Space, KSpace>
MyViewer
;
65
MyViewer
viewer(
K
);
66
67
SCell
ptlow =
K
.
sPointel
( plow );
// pointel (0*2,0*2, 0*2)
68
SCell
ptup1 =
K
.
sPointel
( pup );
// pointel (3*2,3*2, 2*2)
69
SCell
ptup2 =
K
.
sTranslation
( ptup1,
Point::diagonal
() );
// pointel (4*2, 4*2, 3*2)
70
71
viewer << ptlow << ptup1 << ptup2;
72
73
// drawing cells of dimension 0
74
SCell
p1=
K
.
sCell
(
Point
(0,0,2),
false
);
// pointel (0*2,0*2,2*2)
75
SCell
p2=
K
.
sCell
(
Point
(0,2,2));
// ...
76
SCell
p3=
K
.
sCell
(
Point
(2,2,2),
false
);
77
SCell
p4=
K
.
sCell
(
Point
(2,0,2));
78
SCell
p5=
K
.
sCell
(
Point
(0,0,4),
false
);
79
SCell
p6=
K
.
sCell
(
Point
(0,2,4));
80
SCell
p7=
K
.
sCell
(
Point
(2,2,4),
false
);
81
SCell
p8=
K
.
sCell
(
Point
(2,0,4));
82
viewer << p1 << p2 << p3 << p4 << p5 << p6 << p7 << p8;
83
84
// drawing Cells of dimension 1
85
SCell
linel0 =
K
.
sCell
(
Point
( 1, 0, 2 ) );
// linel (2*1+1, 0, 2*2)
86
SCell
linel1 =
K
.
sCell
(
Point
( 1, 2, 2 ) );
// ...
87
SCell
linel2 =
K
.
sCell
(
Point
( 0, 1, 2 ) );
88
SCell
linel3 =
K
.
sCell
(
Point
( 2, 1, 2 ) );
89
90
SCell
linel4 =
K
.
sCell
(
Point
( 1, 0, 4 ) );
91
SCell
linel5 =
K
.
sCell
(
Point
( 1, 2, 4 ) );
92
SCell
linel6 =
K
.
sCell
(
Point
( 0, 1, 4 ) );
93
SCell
linel7 =
K
.
sCell
(
Point
( 2, 1, 4 ) );
94
95
SCell
linel8 =
K
.
sCell
(
Point
( 0, 0, 3 ) );
96
SCell
linel9 =
K
.
sCell
(
Point
( 0, 2, 3 ) );
97
SCell
linel10 =
K
.
sCell
(
Point
( 2, 0, 3 ) );
98
SCell
linel11 =
K
.
sCell
(
Point
( 2, 2, 3 ) );
99
100
101
SCell
linel12 =
K
.
sCell
(
Point
( 3, 2, 2 ) );
102
103
viewer << linel0<< linel1<< linel2 << linel3 ;
104
viewer << linel4<< linel5<< linel6 << linel7 ;
105
viewer << linel8<< linel9<< linel10 << linel11 << linel12;
106
107
// drawing cells of dimension 2
108
109
SCell
surfelA =
K
.
sCell
(
Point
( 2, 1, 3 ) );
// surfel (2*2,2*1+1,2*3+1)
110
SCell
surfelB =
K
.
sCell
(
Point
( 1, 0, 1 ) );
// surfel (2*1,2*0,2*1+1)
111
SCell
surfelC =
K
.
sCell
(
Point
( 2, 1, 1 ),
false
);
// surfel (2*2,2*1+1,2*1+1)
112
viewer << surfelA << surfelB << surfelC;
113
114
// drawing cells of dimension 3
115
SCell
vox1 =
K
.
sCell
(
Point
( 3, 3, 3 ) );
// voxel (2*3+1,2*3+1,2*3+1)
116
SCell
vox2 =
K
.
sCell
(
Point
( 1, 1, 3 ) ,
false
);
// voxel (2*1+1,2*1+1,2*3+1)
117
viewer << vox1 << vox2;
118
119
viewer.
show
();
120
return
0;
121
}
122
DGtal::KhalimskySpaceND::init
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
DGtal::KhalimskySpaceND::sCell
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
DGtal::KhalimskySpaceND::sTranslation
SCell sTranslation(const SCell &p, const Vector &vec) const
Add the vector [vec] to [p].
DGtal::KhalimskySpaceND::sPointel
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)...
DGtal::PointVector< dim, Integer >::diagonal
static Self diagonal(Component val=1)
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:57
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::Point
DGtal::Domain
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal::Z3i::KSpace
KhalimskySpaceND< 3, Integer > KSpace
Definition
StdDefs.h:146
DGtal::Z3i::SCell
KSpace::SCell SCell
Definition
StdDefs.h:149
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
K
KSpace K
Definition
testCubicalComplex.cpp:62
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
domain
Domain domain
Definition
testProjection.cpp:88
MyViewer
PolyscopeViewer< Space, KSpace > MyViewer
Definition
viewer3D-10-interaction.cpp:64
examples
topology
ctopo-1s-3d.cpp
Generated on
for DGtal by
1.18.0