Simple selection of a surfel (with shift + left click) with the Polyscope Viewer proposed by DGtal. You may associates names (i.e. integers) to surfels or to group of surfels. You may associate reactions or callback functions to named graphical objects (surfels in DGtal 0.9).
* $ ./examples/io/viewers/viewer3D-10-interaction
*
Example of PolyscopeViewer interaction with the selection of surfels.
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
typedef PolyscopeViewer<Space,KSpace>
MyViewer;
typedef KSpace::SCell
SCell;
const std::string& name,
size_t index,
void* polyscopeStructure
) {
std::cout << "Item name: " << name << std::endl;
}
};
int main(
int argc,
char** argv )
{
viewer.draw(surfel1, "Surfel 1");
viewer.draw(surfel2, "Surfel 2");
viewer.show();
return 0;
}
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Data required to display an object.
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)
MyViewer::Callback Callback
PolyscopeViewer< Space, KSpace > MyViewer