12#ifndef EASY3D_ALGO_SURFACE_MESH_HOLE_FILLING_H
13#define EASY3D_ALGO_SURFACE_MESH_HOLE_FILLING_H
18#include <easy3d/core/surface_mesh.h>
56 explicit Weight(
float _angle = FLT_MAX,
float _area = FLT_MAX)
57 : angle(_angle), area(_area) {
60 Weight
operator+(
const Weight &_rhs)
const {
61 return Weight(std::max(angle, _rhs.angle), area + _rhs.area);
64 bool operator<(
const Weight &_rhs)
const {
65 return (angle < _rhs.angle ||
66 (angle == _rhs.angle && area < _rhs.area));
78 Weight compute_weight(
int i,
int j,
int k)
const;
83 void split_long_edges(
float lmax);
85 void collapse_short_edges(
float lmin);
97 return mesh_->target(hole_[i]);
99 LOG(ERROR) <<
"index of hole edge is out of range";
106 if (i < hole_.size())
107 return mesh_->target(mesh_->next(mesh_->opposite(hole_[i])));
109 LOG(ERROR) <<
"index of hole edge is out of range";
124 float compute_angle(
const vec3 &_n1,
const vec3 &_n2)
const;
129 SurfaceMesh::VertexProperty <vec3> points_;
133 std::vector<SurfaceMesh::Halfedge> hole_;
136 std::vector<std::vector<Weight>> weight_;
137 std::vector<std::vector<int>> index_;
Edge property of type T.
Definition surface_mesh.h:327
Vertex property of type T.
Definition surface_mesh.h:255
SurfaceMeshHoleFilling(SurfaceMesh *mesh)
Construct with mesh.
Definition surface_mesh_hole_filling.cpp:26
int fill_holes(int size=500)
Fill all holes with size smaller than the specified size.
Definition surface_mesh_hole_filling.cpp:99
bool fill_hole(SurfaceMesh::Halfedge h)
Fill the hole specified by halfedge h.
Definition surface_mesh_hole_filling.cpp:64
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182
Matrix< FT > operator+(const Matrix< FT > &, const FT &)
Definition matrix.h:1010
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44
bool operator<(const Vec< N, T > &a, const Vec< N, T > &b)
Lexicographic comparison of two vectors.
Definition vec.h:1008
This type represents a halfedge (internally it is basically an index).
Definition surface_mesh.h:155
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135