Euclid
Geometry Processing and Shape Analysis in C++
RicciFlow.h
1 
14 #pragma once
15 
16 #include <CGAL/boost/graph/Seam_mesh.h>
17 #include <CGAL/Surface_mesh_parameterization/Error_code.h>
18 
19 namespace Euclid
20 {
31 template<typename Mesh, typename VertexRadiusMap, typename EdgeWeightMap>
32 void circle_packing_metric(Mesh& mesh, VertexRadiusMap vrm, EdgeWeightMap ewm);
33 
44 template<typename Mesh,
45  typename VertexRadiusMap,
46  typename EdgeWeightMap,
47  typename SEM,
48  typename SVM,
49  typename VertexUVMap>
50 void embed_circle_packing_metric(const Mesh& mesh,
51  VertexRadiusMap vrm,
52  EdgeWeightMap ewm,
53  CGAL::Seam_mesh<Mesh, SEM, SVM>& seam_mesh,
54  VertexUVMap uvm);
55 
60 {
64  Newton
65 };
66 
71 {
75  double step = 5e-2;
77  double eps = 1e-5;
79  int max_iters = 5000;
81  bool verbose = false;
82 };
83 
84 enum class RicciFlowSolverStatus
85 {
86  Optimal,
87  Suboptimal,
88  InvalidInput,
89 };
90 
101 template<typename Mesh,
102  typename VertexRadiusMap,
103  typename EdgeWeightMap,
104  typename VertexCurvatureMap>
105 RicciFlowSolverStatus ricci_flow(
106  Mesh& mesh,
107  VertexRadiusMap vrm,
108  EdgeWeightMap ewm,
109  VertexCurvatureMap vcm,
111 
117 template<typename Mesh, typename SEM, typename SVM>
119 {
120 public:
121  using TriangleMesh = CGAL::Seam_mesh<Mesh, SEM, SVM>;
122  using halfedge_descriptor =
123  typename boost::graph_traits<TriangleMesh>::halfedge_descriptor;
124  using Scalar = typename CGAL::Kernel_traits<typename boost::property_traits<
125  typename boost::property_map<Mesh, boost::vertex_point_t>::type>::
126  value_type>::Kernel::FT;
127 
128 public:
133  explicit Ricci_flow_parameterizer3(const Mesh& mesh);
134 
139  void set_solver_settings(const RicciFlowSolverSettings& settings);
140 
148  void add_cone(typename boost::graph_traits<Mesh>::vertex_descriptor v,
149  Scalar k);
150 
162  template<typename VertexUVMap,
163  typename VertexIndexMap,
164  typename VertexParameterizedMap>
165  CGAL::Surface_mesh_parameterization::Error_code parameterize(
166  TriangleMesh& mesh,
167  halfedge_descriptor bhd,
168  VertexUVMap uvmap,
169  VertexIndexMap vimap,
170  VertexParameterizedMap vpmap);
171 
172 private:
173  using vd = typename boost::graph_traits<Mesh>::vertex_descriptor;
174  using ed = typename boost::graph_traits<Mesh>::edge_descriptor;
175  using VRM = std::map<vd, Scalar>;
176  using VRPM = boost::associative_property_map<VRM>;
177  using EWM = std::map<ed, Scalar>;
178  using EWPM = boost::associative_property_map<EWM>;
179  using VCM = std::map<vd, Scalar>;
180  using VCPM = boost::associative_property_map<VCM>;
181 
182 private:
183  const Mesh& _underlying_mesh;
184  RicciFlowSolverSettings _settings;
185  VRM _vrm;
186  VRPM _vrpm;
187  EWM _ewm;
188  EWPM _ewpm;
189  VCM _vcm;
190  VCPM _vcpm;
191 };
192 
194 } // namespace Euclid
195 
196 #include "src/RicciFlow.cpp"
RicciFlowSolverStatus ricci_flow(Mesh &mesh, VertexRadiusMap vrm, EdgeWeightMap ewm, VertexCurvatureMap vcm, const RicciFlowSolverSettings &settings=RicciFlowSolverSettings())
The discrete Ricci flow.
Definition: RicciFlow.cpp:409
Compute plane parameterization with Ricci flow.
Definition: RicciFlow.h:118
void circle_packing_metric(Mesh &mesh, VertexRadiusMap vrm, EdgeWeightMap ewm)
Compute the circle packing metric.
Definition: RicciFlow.cpp:330
Definition: AABB.h:6
Ricci flow solver settings.
Definition: RicciFlow.h:70
void embed_circle_packing_metric(const Mesh &mesh, VertexRadiusMap vrm, EdgeWeightMap ewm, CGAL::Seam_mesh< Mesh, SEM, SVM > &seam_mesh, VertexUVMap uvm)
Embed the circle packing metric into plane.
Definition: RicciFlow.cpp:385
RicciFlowSolverType
Ricci flow solver types.
Definition: RicciFlow.h:59