DGtal 2.1.0
Loading...
Searching...
No Matches
viewer3D-10-interaction.cpp
Go to the documentation of this file.
1
53#include <iostream>
54
55#include "DGtal/base/Common.h"
56#include "DGtal/helpers/StdDefs.h"
57#include "DGtal/io/viewers/PolyscopeViewer.h"
59
60using namespace std;
61using namespace DGtal;
62using namespace Z3i;
63
65typedef MyViewer::Callback Callback;
67
69// Standard services - public :
70//
71struct MyCallback : public Callback {
72 void OnClick(
73 const std::string& name, size_t index,
75 void* polyscopeStructure
76 ) {
77 ((void) index); ((void) data); ((void) polyscopeStructure);
78 std::cout << "Item name: " << name << std::endl;
79 }
80};
81
82int 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// //
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.
static const constexpr Sign NEG
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
static const constexpr Sign POS
Space::Point Point
Definition StdDefs.h:168
KSpace::SCell SCell
Definition StdDefs.h:149
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Data required to display an object.
Definition Display3D.h:247
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
void OnClick(const std::string &name, size_t index, const DisplayData< MyViewer::RealPoint > &data, void *polyscopeStructure)
unsigned int index(DGtal::uint32_t n, unsigned int b)
Definition testBits.cpp:44
KSpace K
MyViewer::Callback Callback
PolyscopeViewer< Space, KSpace > MyViewer