DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
viewer3D-10-interaction.cpp
Go to the documentation of this file.
1
16
32
50
51
53
#include <iostream>
54
55
#include "DGtal/base/Common.h"
56
#include "DGtal/helpers/StdDefs.h"
57
#include "DGtal/io/viewers/PolyscopeViewer.h"
59
60
using namespace
std
;
61
using namespace
DGtal
;
62
using namespace
Z3i
;
63
64
typedef
PolyscopeViewer<Space,KSpace>
MyViewer
;
65
typedef
MyViewer::Callback
Callback
;
66
typedef
KSpace::SCell
SCell
;
67
69
// Standard services - public :
70
//
71
struct
MyCallback
:
public
Callback
{
72
void
OnClick
(
73
const
std::string& name,
size_t
index
,
74
const
DisplayData<MyViewer::RealPoint>
& data,
75
void
* polyscopeStructure
76
) {
77
((void)
index
); ((void) data); ((void) polyscopeStructure);
78
std::cout <<
"Item name: "
<< name << std::endl;
79
}
80
};
81
82
int
main
()
83
{
84
Point
p1( 0, 0, 0 );
85
Point
p2( 5, 5 ,5 );
86
Point
p3( 2, 3, 4 );
87
88
KSpace
K
;
89
K
.
init
( p1, p2,
true
);
90
91
Point
v1 =
Z3i::Point
(10, 10,10);
92
Point
v2 =
Z3i::Point
(9, 9, 9);
93
Point
v3 =
Z3i::Point
(11, 11,11);
94
95
MyViewer
viewer(
K
);
96
viewer.
setCallback
(
new
MyCallback
);
97
Z3i::SCell
surfel1 =
K
.
sCell
(
Point
( 1, 1, 2 ),
KSpace::POS
);
98
Z3i::SCell
surfel2 =
K
.
sCell
(
Point
( 3, 3, 4 ),
KSpace::NEG
);
99
Z3i::SCell
surfel3 =
K
.
sCell
(
Point
( 5, 6, 5 ),
KSpace::POS
);
100
101
viewer.
draw
(surfel1,
"Surfel 1"
);
102
viewer.
draw
(surfel2,
"Surfel 2"
);
103
viewer <<
Point
(0, 0, 1) <<
Point
(1, 1, 2);
104
105
viewer.
show
();
106
return
0;
107
}
108
// //
DGtal::Display3D::draw
std::string draw(const Point &p, const std::string &uname="Point_{i}")
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< 3, Integer >::NEG
static const constexpr Sign NEG
Definition
KhalimskySpaceND.h:433
DGtal::KhalimskySpaceND::sCell
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
DGtal::KhalimskySpaceND< 3, Integer >::SCell
SignedKhalimskyCell< dim, Integer > SCell
Definition
KhalimskySpaceND.h:417
DGtal::KhalimskySpaceND< 3, Integer >::POS
static const constexpr Sign POS
Definition
KhalimskySpaceND.h:432
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:57
DGtal::PolyscopeViewer::setCallback
void setCallback(typename Display3D< Space, KSpace >::Callback *callback) override
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::Point
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::Point
Space::Point Point
Definition
StdDefs.h:168
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.
DGtal::Display3D::Callback
A general callback for the viewer to give control to the user.
Definition
Display3D.h:408
DGtal::DisplayData
Data required to display an object.
Definition
Display3D.h:247
MyCallback
Definition
viewer3D-10-interaction.cpp:71
MyCallback::OnClick
void OnClick(const std::string &name, size_t index, const DisplayData< MyViewer::RealPoint > &data, void *polyscopeStructure)
Definition
viewer3D-10-interaction.cpp:72
index
unsigned int index(DGtal::uint32_t n, unsigned int b)
Definition
testBits.cpp:44
K
KSpace K
Definition
testCubicalComplex.cpp:62
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
Callback
MyViewer::Callback Callback
Definition
viewer3D-10-interaction.cpp:65
MyViewer
PolyscopeViewer< Space, KSpace > MyViewer
Definition
viewer3D-10-interaction.cpp:64
examples
io
viewers
viewer3D-10-interaction.cpp
Generated on
for DGtal by
1.18.0