DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
PolyscopeViewer.h
1
15
#pragma once
16
27
28
#if !defined(DGTAL_WITH_POLYSCOPE_VIEWER)
29
#error DGTAL_WITH_POLYSCOPE_VIEWER flag not set during the cmake step
30
#endif
31
32
#include "DGtal/io/Display3D.h"
33
34
#include "polyscope/polyscope.h"
35
36
#include "polyscope/sparse_volume_grid.h"
37
#include "polyscope/curve_network.h"
38
#include "polyscope/surface_mesh.h"
39
#include "polyscope/volume_mesh.h"
40
#include "polyscope/volume_grid.h"
41
#include "polyscope/point_cloud.h"
42
#include "polyscope/pick.h"
43
44
namespace
DGtal
{
45
namespace
drawutils
{
46
// @brief Convert a DGtal color to a glm color
47
glm::vec3
toglm
(
const
DGtal::Color
& col);
48
49
// @brief Convert a vector of DGtal color to a vector of glm color
50
std::vector<glm::vec3>
toglm
(
const
std::vector<DGtal::Color>& col);
51
52
// @brief Convert an Eigen transform to glm matrix
53
glm::mat4
toglm
(
const
Eigen::Affine3d& transform);
54
}
55
56
template
<
typename
Space = Z3i::Space,
typename
KSpace = Z3i::KSpace>
57
class
PolyscopeViewer
:
public
Display3D
<Space, KSpace> {
58
public
:
59
PolyscopeViewer
() :
Display3D
<
Space
,
KSpace
>() {
60
polyscope::init();
61
}
62
63
PolyscopeViewer
(
const
KSpace
& k) :
Display3D
<
Space
,
KSpace
>(k) {
64
polyscope::init();
65
}
66
67
// @brief Clear the view (ie. remove all polyscope structures)
68
void
clearView
()
override
{
69
polyscope::removeAllStructures();
70
}
71
72
// @brief Starts event loop (first render data)
73
void
show
()
override
{
74
renderNewData
();
75
renderClippingPlanes
();
76
77
polyscope::show();
78
}
79
80
// @brief Render new data
81
void
renderNewData
()
override
;
82
83
// @brief setCallback
84
void
setCallback
(
typename
Display3D<Space, KSpace>::Callback
* callback)
override
;
85
86
// @brief Renders the clipping planes
87
void
renderClippingPlanes
();
88
89
~PolyscopeViewer
() {
90
this->
clear
();
91
}
92
93
public
:
94
static
constexpr
double
BallToCubeRatio
= 0.025;
95
static
constexpr
double
VectorScale
= 1. / 30.;
96
97
private
:
98
void
setGeneralProperties
(polyscope::Structure* s,
const
DisplayData<typename Space::RealPoint>
& d);
99
100
void
registerPointCloud
(
const
std::string& n,
const
DisplayData<typename Space::RealPoint>
& d);
101
void
registerLineNetwork
(
const
std::string& n,
const
DisplayData<typename Space::RealPoint>
& d);
102
void
registerSurfaceMesh
(
const
std::string& n,
const
DisplayData<typename Space::RealPoint>
& d);
103
void
registerVolumeMesh
(
const
std::string& n,
const
DisplayData<typename Space::RealPoint>
& d);
104
void
registerSparseVolumeGrid
(
const
std::string& n,
const
DisplayData<typename Space::RealPoint>
& d);
105
106
// @brief Global callback handling UI, click and callback calls
107
void
polyscopeCallback
();
108
};
109
}
110
111
#include "PolyscopeViewer.ih"
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition
Color.h:77
DGtal::Display3D< Z3i::Space, Z3i::KSpace >::Display3D
Display3D(const KSpace &space)
Definition
Display3D.h:383
DGtal::Display3D::clear
virtual void clear()
Clear the viewer, including screen and internal data.
DGtal::PolyscopeViewer::registerVolumeMesh
void registerVolumeMesh(const std::string &n, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer::~PolyscopeViewer
~PolyscopeViewer()
Definition
PolyscopeViewer.h:89
DGtal::PolyscopeViewer::setGeneralProperties
void setGeneralProperties(polyscope::Structure *s, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::renderClippingPlanes
void renderClippingPlanes()
DGtal::PolyscopeViewer::setCallback
void setCallback(typename Display3D< Space, KSpace >::Callback *callback) override
DGtal::PolyscopeViewer::registerPointCloud
void registerPointCloud(const std::string &n, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer::registerSparseVolumeGrid
void registerSparseVolumeGrid(const std::string &n, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::BallToCubeRatio
static constexpr double BallToCubeRatio
Definition
PolyscopeViewer.h:94
DGtal::PolyscopeViewer::clearView
void clearView() override
Clear the screen.
Definition
PolyscopeViewer.h:68
DGtal::PolyscopeViewer::PolyscopeViewer
PolyscopeViewer(const KSpace &k)
Definition
PolyscopeViewer.h:63
DGtal::PolyscopeViewer::PolyscopeViewer
PolyscopeViewer()
Definition
PolyscopeViewer.h:59
DGtal::PolyscopeViewer::polyscopeCallback
void polyscopeCallback()
DGtal::PolyscopeViewer::registerSurfaceMesh
void registerSurfaceMesh(const std::string &n, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer::registerLineNetwork
void registerLineNetwork(const std::string &n, const DisplayData< typename Space::RealPoint > &d)
DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::renderNewData
void renderNewData() override
DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::VectorScale
static constexpr double VectorScale
Definition
PolyscopeViewer.h:95
DGtal::drawutils
Definition
Display3D.h:64
DGtal::drawutils::toglm
glm::vec3 toglm(const DGtal::Color &col)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::Space
DGtal::Display3D::Callback
A general callback for the viewer to give control to the user.
Definition
Display3D.h:408
DGtal::DisplayData
Data required to display an object.
Definition
Display3D.h:247
KSpace
Z3i::KSpace KSpace
Definition
testArithmeticalDSSComputerOnSurfels.cpp:48
src
DGtal
io
viewers
PolyscopeViewer.h
Generated on
for DGtal by
1.18.0