Easy3D 2.5.3
surface_mesh_smoothing.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_SMOOTHING_H
13#define EASY3D_ALGO_SURFACE_MESH_SMOOTHING_H
14
15#include <easy3d/core/surface_mesh.h>
16
17namespace easy3d {
18
27 public:
29 explicit SurfaceMeshSmoothing(SurfaceMesh *mesh);
30
31 // destructor
33
36 void explicit_smoothing(unsigned int iters = 10,
37 bool use_uniform_laplace = false);
38
42 void implicit_smoothing(float timestep = 0.001,
43 bool use_uniform_laplace = false,
44 bool rescale = true);
45
47 void initialize(bool use_uniform_laplace = false) {
48 compute_edge_weights(use_uniform_laplace);
49 compute_vertex_weights(use_uniform_laplace);
50 }
51
52 private:
54 void compute_edge_weights(bool use_uniform_laplace);
55
57 void compute_vertex_weights(bool use_uniform_laplace);
58
59 private:
61 SurfaceMesh *mesh_;
62
63 // remember for how many edges we computed weights
64 // recompute if numbers change (i.e. mesh has changed)
65 unsigned int how_many_edge_weights_;
66 };
67
68} // namespace easy3d
69
70
71#endif // EASY3D_ALGO_SURFACE_MESH_SMOOTHING_H
A halfedge data structure for polygonal meshes of 2-manifold.
Definition: surface_mesh.h:52
A class for Laplacian smoothing.See the following papers for more details:
Definition: surface_mesh_smoothing.h:26
void initialize(bool use_uniform_laplace=false)
Initialize edge and vertex weights.
Definition: surface_mesh_smoothing.h:47
void implicit_smoothing(float timestep=0.001, bool use_uniform_laplace=false, bool rescale=true)
Perform implicit Laplacian smoothing with timestep. Decide whether to use uniform Laplacian or cotan ...
Definition: surface_mesh_smoothing.cpp:127
SurfaceMeshSmoothing(SurfaceMesh *mesh)
Construct with mesh to be smoothed.
Definition: surface_mesh_smoothing.cpp:29
void explicit_smoothing(unsigned int iters=10, bool use_uniform_laplace=false)
Perform iters iterations of explicit Laplacian smoothing. Decide whether to use uniform Laplacian or ...
Definition: surface_mesh_smoothing.cpp:77
Definition: collider.cpp:182