DGtal
2.0.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
() {
54
static
int
count = 16;
55
// Depending on the viewer, this may change
56
ImGui::SliderInt(
"Number of points to draw"
, &count, 0, 32);
57
if
(ImGui::Button(
"Create points"
)) {
58
for
(
int
i = 0; i < count; ++i) {
59
// Rand values from -10 to 10
60
// Viewer is pointer to the viewer this extension is attached to
61
*viewer <<
Point
(rand() % 21 - 10, rand() % 21 - 10, rand() % 21 - 10);
62
}
63
// Ask viewer to render all data that were added
64
viewer->renderNewData();
65
}
66
}
67
};
69
70
int
main
(
int
argc,
char
** argv )
71
{
72
Point
p1( 0, 0, 0 );
73
Point
p2( 5, 5, 5 );
74
Point
p3( 2, 3, 4 );
75
76
Domain
domain
( p1, p2 );
77
78
KSpace
K
;
79
K
.
init
( p1, p2,
true
);
80
81
PolyscopeViewer
viewer(
K
);
83
viewer.
setCallback
(
new
RandomPointExtension
);
85
viewer <<
domain
;
86
viewer << p1 << p2 << p3;
87
88
viewer.
show
();
89
return
0;
90
}
91
// //
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.
std
STL namespace.
RandomPointExtension
[viewer3D-extension-derivation]
Definition
viewer3D-11-extension.cpp:52
RandomPointExtension::OnUI
void OnUI()
Definition
viewer3D-11-extension.cpp:53
main
int main()
Definition
testBits.cpp:56
K
KSpace K
Definition
testCubicalComplex.cpp:62
domain
Domain domain
Definition
testProjection.cpp:88
Callback
MyViewer::Callback Callback
Definition
viewer3D-10-interaction.cpp:65
examples
io
viewers
viewer3D-11-extension.cpp
Generated on Sun Jul 6 2025 09:03:51 for DGtal by
1.9.8