Easy3D 2.6.1
Loading...
Searching...
No Matches
surface_mesh_triangulation.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_TRIANGULATION_H
13#define EASY3D_ALGO_SURFACE_MESH_TRIANGULATION_H
14
15
16#include <easy3d/core/surface_mesh.h>
17
18#include <vector>
19#include <cfloat>
20
21
22namespace easy3d {
23
32 public:
38
43 enum Objective { MIN_AREA, MAX_ANGLE};
44
49 void triangulate(Objective obj = MIN_AREA);
50
56 void triangulate(SurfaceMesh::Face f, Objective obj = MIN_AREA);
57
58 private:
66 float compute_weight(int i, int j, int k) const;
67
74 bool is_edge(SurfaceMesh::Vertex a, SurfaceMesh::Vertex b) const;
75
82 bool insert_edge(int i, int j);
83
84 private:
85 Objective objective_;
86
87 // mesh and properties
88 SurfaceMesh *mesh_;
89 SurfaceMesh::VertexProperty <vec3> points_;
90 std::vector<SurfaceMesh::Halfedge> halfedges_;
91 std::vector<SurfaceMesh::Vertex> vertices_;
92
93 // data for computing optimal triangulation
94 std::vector<std::vector<float> > weight_;
95 std::vector<std::vector<int> > index_;
96 };
97
98} // namespace easy3d
99
100
101#endif // EASY3D_ALGO_SURFACE_MESH_TRIANGULATION_H
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
SurfaceMeshTriangulation(SurfaceMesh *mesh)
Construct with the surface mesh to be triangulated.
Definition surface_mesh_triangulation.cpp:17
void triangulate(Objective obj=MIN_AREA)
Triangulate all faces.
Definition surface_mesh_triangulation.cpp:25
Objective
Triangulation objective: find the triangulation that minimizes the sum of squared triangle areas,...
Definition surface_mesh_triangulation.h:43
Definition collider.cpp:182
Definition surface_mesh.h:191
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135