Easy3D 2.6.1
Loading...
Searching...
No Matches
surface_mesh_curvature.h
1/********************************************************************
2 * Copyright (C) 2020-2021 by Liangliang Nan <liangliang.nan@gmail.com>
3 * Copyright (C) 2011-2020 the Polygon Mesh Processing Library developers.
4 *
5 * The code in this file is adapted from the PMP (Polygon Mesh Processing
6 * Library) with modifications.
7 * https://github.com/pmp-library/pmp-library
8 * The original code was distributed under a MIT-style license, see
9 * https://github.com/pmp-library/pmp-library/blob/master/LICENSE.txt
10 ********************************************************************/
11
12#ifndef EASY3D_ALGO_SURFACE_MESH_CURVATURE_H
13#define EASY3D_ALGO_SURFACE_MESH_CURVATURE_H
14
15#include <easy3d/core/surface_mesh.h>
16
17namespace easy3d {
18
30 public:
35 explicit SurfaceMeshCurvature(SurfaceMesh *mesh);
40
46 void analyze(unsigned int post_smoothing_steps = 0);
47
54 void analyze_tensor(unsigned int post_smoothing_steps = 0, bool two_ring_neighborhood = false);
55
61
67
73
80 return 0.5f * (min_curvature_[v] + max_curvature_[v]);
81 }
82
89 return min_curvature_[v] * max_curvature_[v];
90 }
91
97 float min_curvature(SurfaceMesh::Vertex v) const { return min_curvature_[v]; }
98
104 float max_curvature(SurfaceMesh::Vertex v) const { return max_curvature_[v]; }
105
112 return std::max(fabs(min_curvature_[v]), fabs(max_curvature_[v]));
113 }
114
115 private:
117 void smooth_curvatures(unsigned int iterations);
118
119 private:
120 SurfaceMesh *mesh_;
123 };
124
125} // namespace easy3d
126
127
128#endif // EASY3D_ALGO_SURFACE_MESH_CURVATURE_H
Vertex property of type T.
Definition surface_mesh.h:255
void compute_gauss_curvature()
Definition surface_mesh_curvature.cpp:323
void compute_max_abs_curvature()
Computes the maximum absolute curvature.
Definition surface_mesh_curvature.cpp:331
float min_curvature(SurfaceMesh::Vertex v) const
Returns the minimum (signed) curvature of a given vertex.
Definition surface_mesh_curvature.h:97
SurfaceMeshCurvature(SurfaceMesh *mesh)
Constructor that initializes the curvature analysis with a given mesh.
Definition surface_mesh_curvature.cpp:19
void compute_mean_curvature()
Definition surface_mesh_curvature.cpp:313
float max_abs_curvature(SurfaceMesh::Vertex v) const
Returns the maximum absolute curvature of a given vertex.
Definition surface_mesh_curvature.h:111
float max_curvature(SurfaceMesh::Vertex v) const
Returns the maximum (signed) curvature of a given vertex.
Definition surface_mesh_curvature.h:104
float gauss_curvature(SurfaceMesh::Vertex v) const
Returns the Gaussian curvature of a given vertex.
Definition surface_mesh_curvature.h:88
void analyze(unsigned int post_smoothing_steps=0)
Computes principle curvature information for each vertex.
Definition surface_mesh_curvature.cpp:30
~SurfaceMeshCurvature()
Destructor.
float mean_curvature(SurfaceMesh::Vertex v) const
Returns the mean curvature of a given vertex.
Definition surface_mesh_curvature.h:79
void analyze_tensor(unsigned int post_smoothing_steps=0, bool two_ring_neighborhood=false)
Computes principle curvature information for each vertex using tensor analysis.
Definition surface_mesh_curvature.cpp:122
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135