DGtal
2.1.0
Loading...
Searching...
No Matches
viewer3D-11-extension.cpp
Go to the documentation of this file.
1
37
#include <iostream>
38
39
#include "DGtal/base/Common.h"
40
#include "DGtal/helpers/StdDefs.h"
41
#include "DGtal/io/viewers/PolyscopeViewer.h"
43
44
using namespace
std
;
45
using namespace
DGtal
;
46
using namespace
Z3i;
47
49
// Standard services - public :
50
52
struct
RandomPointExtension
:
public
PolyscopeViewer
<>
::Callback
{
53
void
OnUI
(
void
* viewerData)
override
{
54
((void) viewerData);
55
static
int
count = 16;
56
// Depending on the viewer, this may change
57
ImGui::SliderInt(
"Number of points to draw"
, &count, 0, 32);
58
if
(ImGui::Button(
"Create points"
)) {
59
for
(
int
i = 0; i < count; ++i) {
60
// Rand values from -10 to 10
61
// Viewer is pointer to the viewer this extension is attached to
62
*viewer <<
Point
(rand() % 21 - 10, rand() % 21 - 10, rand() % 21 - 10);
63
}
64
// Ask viewer to render all data that were added
65
viewer->renderNewData();
66
}
67
}
68
};
70
71
int
main
()
72
{
73
Point
p1( 0, 0, 0 );
74
Point
p2( 5, 5, 5 );
75
Point
p3( 2, 3, 4 );
76
77
Domain
domain
( p1, p2 );
78
79
KSpace
K
;
80
K
.
init
( p1, p2,
true
);
81
82
PolyscopeViewer
viewer(
K
);
84
viewer.
setCallback
(
new
RandomPointExtension
);
86
viewer <<
domain
;
87
viewer << p1 << p2 << p3;
88
89
viewer.
show
();
90
return
0;
91
}
92
// //
DGtal::HyperRectDomain< Space >
DGtal::KhalimskySpaceND
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Definition
KhalimskySpaceND.h:394
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::PointVector< dim, Integer >
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:52
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:68
DGtal::Z3i::Point
Space::Point Point
Definition
StdDefs.h:168
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
RandomPointExtension
[viewer3D-extension-derivation]
Definition
viewer3D-11-extension.cpp:52
RandomPointExtension::OnUI
void OnUI(void *viewerData) override
Definition
viewer3D-11-extension.cpp:53
K
KSpace K
Definition
testCubicalComplex.cpp:62
domain
Domain domain
Definition
testProjection.cpp:88
Callback
MyViewer::Callback Callback
Definition
viewer3D-10-interaction.cpp:65
main
int main()
[viewer3D-extension-derivation]
Definition
viewer3D-11-extension.cpp:71
examples
io
viewers
viewer3D-11-extension.cpp
Generated on Tue Aug 26 2025 14:27:42 for DGtal by
1.9.8