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>
41 explicit Weight(
float _angle = FLT_MAX,
float _area = FLT_MAX)
42 : angle(_angle), area(_area) {
45 Weight
operator+(
const Weight &_rhs)
const {
46 return Weight(std::max(angle, _rhs.angle), area + _rhs.area);
49 bool operator<(
const Weight &_rhs)
const {
50 return (angle < _rhs.angle ||
51 (angle == _rhs.angle && area < _rhs.area));
63 Weight compute_weight(
int i,
int j,
int k)
const;
68 void split_long_edges(
float lmax);
70 void collapse_short_edges(
float lmin);
82 return mesh_->
target(hole_[i]);
84 LOG(ERROR) <<
"index of hole edge is out of range";
94 LOG(ERROR) <<
"index of hole edge is out of range";
109 float compute_angle(
const vec3 &_n1,
const vec3 &_n2)
const;
118 std::vector<SurfaceMesh::Halfedge> hole_;
121 std::vector<std::vector<Weight>> weight_;
122 std::vector<std::vector<int>> index_;
Definition: surface_mesh.h:233
Definition: surface_mesh.h:185
This class closes simple holes in a surface mesh.
Definition: surface_mesh_hole_filling.h:31
SurfaceMeshHoleFilling(SurfaceMesh *mesh)
construct with mesh
Definition: surface_mesh_hole_filling.cpp:26
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:52
Halfedge opposite(Halfedge h) const
returns the opposite halfedge of h
Definition: surface_mesh.h:1260
Vertex target(Halfedge h) const
returns the vertex the halfedge h points to
Definition: surface_mesh.h:1211
Halfedge next(Halfedge h) const
returns the next halfedge within the incident face
Definition: surface_mesh.h:1241
Definition: collider.cpp:182
Matrix< FT > operator+(const Matrix< FT > &, const FT &)
Definition: matrix.h:990
bool operator<(const Vec< N, T > &a, const Vec< N, T > &b)
Lexicographic comparison of two vectors.
Definition: vec.h:782
Definition: surface_mesh.h:114
Definition: surface_mesh.h:104