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
44using namespace std;
45using namespace DGtal;
46using namespace Z3i;
47
49// Standard services - public :
50
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
71int 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);
86 viewer << domain;
87 viewer << p1 << p2 << p3;
88
89 viewer.show();
90 return 0;
91}
92// //
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.
void setCallback(typename Display3D< Space, KSpace >::Callback *callback) override
void show() override
Starts the event loop and display of elements.
Space::Point Point
Definition StdDefs.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
[viewer3D-extension-derivation]
void OnUI(void *viewerData) override
KSpace K
Domain domain
MyViewer::Callback Callback
int main()
[viewer3D-extension-derivation]