Euclid
Geometry Processing and Shape Analysis in C++
GeodesicsInHeat.h
1 #pragma once
2 
3 #include <vector>
4 #include <Eigen/SparseCholesky>
5 #include <Euclid/MeshUtil/MeshDefs.h>
6 #include <Euclid/Util/Memory.h>
7 
8 namespace Euclid
9 {
21 template<typename Mesh>
23 {
24 public:
25  using FT = FT_t<Mesh>;
26  using Vector_3 = Vector_3_t<Mesh>;
27  using SpMat = Eigen::SparseMatrix<FT>;
28 
29 public:
44  void build(const Mesh& mesh,
45  float scale = 1.0f,
46  FT resolution = 0,
47  const SpMat* cot_mat = nullptr,
48  const SpMat* mass_mat = nullptr);
49 
55  void scale(float scale);
56 
63  template<typename T>
64  void compute(
65  const typename boost::graph_traits<const Mesh>::vertex_descriptor& v,
66  std::vector<T>& geodesics);
67 
68 public:
72  const Mesh* mesh = nullptr;
73 
78  FT resolution = 0.0;
79 
86 
93 
97  Eigen::SimplicialLDLT<SpMat> heat_solver;
98 
102  Eigen::SimplicialLDLT<SpMat> poisson_solver;
103 };
104 
106 } // namespace Euclid
107 
108 #include "src/GeodesicsInHeat.cpp"
ProPtr< const SpMat > cot_mat
Cotangent matrix.
Definition: GeodesicsInHeat.h:85
Single source approximate geodesic distance using the heat method.
Definition: GeodesicsInHeat.h:22
Eigen::SimplicialLDLT< SpMat > heat_solver
The heat equation solver.
Definition: GeodesicsInHeat.h:97
Eigen::SimplicialLDLT< SpMat > poisson_solver
The poisson equation solver.
Definition: GeodesicsInHeat.h:102
Definition: AABB.h:6
FT resolution
The resolution of mesh.
Definition: GeodesicsInHeat.h:78
ProPtr< const SpMat > mass_mat
Mass matrix.
Definition: GeodesicsInHeat.h:92
void compute(const typename boost::graph_traits< const Mesh >::vertex_descriptor &v, std::vector< T > &geodesics)
Compute geodesics distance from a vertex.
Definition: GeodesicsInHeat.cpp:81
void build(const Mesh &mesh, float scale=1.0f, FT resolution=0, const SpMat *cot_mat=nullptr, const SpMat *mass_mat=nullptr)
Build up the necesssary computational components.
Definition: GeodesicsInHeat.cpp:10
const Mesh * mesh
The target mesh.
Definition: GeodesicsInHeat.h:72
void scale(float scale)
Reset the time scale.
Definition: GeodesicsInHeat.cpp:61