30#include <DGtal/base/Common.h>
31#include <DGtal/helpers/StdDefs.h>
32#include <DGtal/helpers/Shortcuts.h>
33#include <DGtal/helpers/ShortcutsGeometry.h>
34#include <DGtal/shapes/SurfaceMesh.h>
35#include <DGtal/dec/PolygonalCalculus.h>
36#include <DGtal/dec/VectorsInHeat.h>
38#include <polyscope/polyscope.h>
39#include <polyscope/surface_mesh.h>
59polyscope::SurfaceMesh *
psMesh;
68std::vector<Vector> X_0;
69std::vector<Vertex> idX_0;
84 VHM->addSource(
id,Eigen::Vector3d::Random(3).normalized());
87 X_0[id] = VHM->extrinsicVectorSourceAtVertex(
id);
88 psMesh->addVertexVectorQuantity(
"X_0",X_0);
100 psMesh->addVertexVectorQuantity(
"VHM field",VHM->compute());
112 X_0.resize(nv,Vector::Zero(3));
114 psMesh->addVertexVectorQuantity(
"X_0",X_0);
125 psMesh->addVertexVectorQuantity(
"X_0",X_0);
126 psMesh->addVertexVectorQuantity(
"VHM field",X_0);
132 for(
const auto id: idX_0)
135 VHM->addSource(
id, x);
136 X_0[id] = VHM->extrinsicVectorSourceAtVertex(
id);
138 psMesh->addVertexVectorQuantity(
"X_0",X_0);
144 if(ImGui::Button(
"Compute Vector Field"))
148 if(ImGui::Button(
"Add random source"))
152 if(ImGui::Button(
"Clear sources"))
157 if(ImGui::Button(
"Start/stop rotating sources"))
168int main(
int argc,
char **argv)
170 std::vector<std::vector<SH3::SurfaceMesh::Vertex>> faces;
171 std::vector<RealPoint> positions;
175 trace.
error()<<
"Missing vol file. Usage: exampleVectorHeatMethod bunny.vol"<<std::endl;
181 params(
"surfaceComponents",
"All");
188 for(
size_t face= 0 ; face < primalSurface->nbFaces(); ++face)
189 faces.push_back(primalSurface->incidentVertices( face ));
192 positions = primalSurface->positions();
208 Rotx << 1, 0,0,0,cos(theta),-sin(theta),0,sin(theta),cos(theta);
209 Roty << cos(theta), 0,sin(theta),0,1,0,-sin(theta),0,cos(theta);
210 Rotz << cos(theta), -sin(theta),0,sin(theta),cos(theta),0,0,0,1;
216 psMesh = polyscope::registerSurfaceMesh(
"Digital Surface", positions, faces);
221 polyscope::view::upDir = polyscope::view::UpDir::XUp;
Implements differential operators on polygonal surfaces from degoes2020discrete.
LinAlg::SparseMatrix SparseMatrix
Type of sparse matrix.
LinAlg::DenseMatrix DenseMatrix
Type of dense matrix.
LinAlg::DenseVector Vector
Type of Vector.
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static Parameters parametersGeometryEstimation()
static Parameters defaultParameters()
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static Parameters defaultParameters()
static CountedPtr< SurfaceMesh > makePrimalSurfaceMesh(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
This class implements Sharp:2019:VHM on polygonal surfaces (using Discrete differential calculus on p...
polyscope::SurfaceMesh * psMesh
CountedPtr< SH3::DigitalSurface > surface
CountedPtr< SH3::BinaryImage > binary_image
DigitalPlane::Point Vector
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
std::vector< Vertex > Vertices
The type that defines a list/range of vertices (e.g. to define faces)
Scalar averageEdgeLength() const
EigenLinearAlgebraBackend::SparseMatrix SparseMatrix