Easy3D 2.6.1
Loading...
Searching...
No Matches
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:
32 explicit SurfaceMeshSmoothing(SurfaceMesh *mesh);
33
38
44 void explicit_smoothing(unsigned int iters = 10,
45 bool use_uniform_laplace = false);
46
53 void implicit_smoothing(float timestep = 0.001,
54 bool use_uniform_laplace = false,
55 bool rescale = true);
56
61 void initialize(bool use_uniform_laplace = false) {
62 compute_edge_weights(use_uniform_laplace);
63 compute_vertex_weights(use_uniform_laplace);
64 }
65
66 private:
71 void compute_edge_weights(bool use_uniform_laplace);
72
77 void compute_vertex_weights(bool use_uniform_laplace);
78
79 private:
81 SurfaceMesh *mesh_;
82
83 // remember for how many edges we computed weights
84 // recompute if numbers change (i.e. mesh has changed)
85 unsigned int how_many_edge_weights_;
86 };
87
88} // namespace easy3d
89
90
91#endif // EASY3D_ALGO_SURFACE_MESH_SMOOTHING_H
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
void initialize(bool use_uniform_laplace=false)
Initialize edge and vertex weights.
Definition surface_mesh_smoothing.h:61
void implicit_smoothing(float timestep=0.001, bool use_uniform_laplace=false, bool rescale=true)
Perform implicit Laplacian smoothing with timestep.
Definition surface_mesh_smoothing.cpp:127
~SurfaceMeshSmoothing()
Destructor.
Definition surface_mesh_smoothing.cpp:35
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.
Definition surface_mesh_smoothing.cpp:77
Definition collider.cpp:182