-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmesh_holefilling.hpp
277 lines (236 loc) · 7 KB
/
mesh_holefilling.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#pragma once
#ifndef BuildingPCCData_mesh_holefilling_hpp
#define BuildingPCCData_mesh_holefilling_hpp
#define COMPILER_MSVC
#define NOMINMAX
#include <vld.h>
#include <omp.h>
#include <iostream>
#include <vector>
#include <map>
#include <numeric> // std::iota
#include <easy3d/core/surface_mesh.h>
#include <easy3d/core/surface_mesh_builder.h>
#include <easy3d/algo/delaunay_2d.h>
#include <easy3d/algo/surface_mesh_geometry.h>
#include <easy3d/algo_ext/surfacer.h>
#include <easy3d/kdtree/kdtree_search_eth.h>
#include <easy3d/fileio/surface_mesh_io.h>
#include <easy3d/fileio/point_cloud_io.h>
#include <easy3d/core/graph.h>
#include <easy3d/fileio/graph_io.h>
#include <easy3d/renderer/camera.h>
#include <easy3d/viewer/viewer.h>
#include "additional_repair.hpp"
#include "mesh_properties.hpp"
#include "remove_inner_faces.hpp"
namespace building_pcc_data
{
int easy3d_fill_holes(easy3d::SurfaceMesh*, const bool allow_internal_log_print = true);
int cgal_hole_filling(easy3d::SurfaceMesh*, std::vector<easy3d::SurfaceMesh::Halfedge>&);
void holes_filling_preprocessing(easy3d::SurfaceMesh*, std::map<easy3d::SurfaceMesh::Vertex, int>&);
void holes_filling_postprocessing(easy3d::SurfaceMesh*);
void complex_holes_detection(easy3d::SurfaceMesh*, std::map<easy3d::SurfaceMesh::Vertex, int>&, std::vector<std::vector<std::pair<int, int>>>&, int&, int&);
void get_edge_neighbors
(
easy3d::SurfaceMesh*,
std::vector<std::pair<int, int>>&,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
std::map<int, std::set<int>>&
);
void get_two_edge_attributes
(
easy3d::SurfaceMesh*,
easy3d::SurfaceMesh::Vertex&, easy3d::SurfaceMesh::Vertex&, easy3d::SurfaceMesh::Vertex&,
easy3d::SurfaceMesh::Vertex&, easy3d::SurfaceMesh::Vertex&, easy3d::SurfaceMesh::Vertex&, easy3d::SurfaceMesh::Vertex&,
std::set<int>&,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
int&, int&, int&, int&,
bool&
);
void get_two_edge_incident_facets
(
easy3d::SurfaceMesh*,
std::set<int>&,
std::set<int>&
);
void create_face_from_two_edges
(
easy3d::SurfaceMesh* mesh,
easy3d::SurfaceMesh::Vertex&,
easy3d::SurfaceMesh::Vertex&,
easy3d::SurfaceMesh::Vertex&,
easy3d::vec3&, easy3d::vec3&, easy3d::vec3&
);
void get_all_pre_h_candidates
(
easy3d::SurfaceMesh*,
easy3d::SurfaceMesh::Halfedge&,
easy3d::SurfaceMesh::Halfedge&,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
std::map<std::pair<int, int>, int>&,
std::set<int>&
);
void get_hole_candidates
(
std::map<std::pair<int, int>, bool>&,
std::pair<int, int>&, std::pair<int, int>&, std::pair<int, int>&,
std::pair<int, int>&, std::pair<int, int>&, std::pair<int, int>&,
std::vector<std::pair<int, int>>&,
std::map<int, int>&,
int&, int&, int&, int&
);
void hole_detection_pipeline
(
easy3d::SurfaceMesh* ,
easy3d::SurfaceMesh::Halfedge& ,
easy3d::SurfaceMesh::Halfedge& ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
std::map<std::pair<int, int>, bool>& ,
std::map<int, int>& ,
std::vector<std::pair<int, int>>&
);
void copy_mesh(easy3d::SurfaceMesh*, easy3d::SurfaceMeshBuilder&);
void add_missing_edge
(
std::map< std::pair<int, int>, bool>& ,
std::vector<std::pair<int, int>>& ,
const int ,
const int ,
const easy3d::SurfaceMesh::Vertex ,
const easy3d::SurfaceMesh::Vertex
);
void check_vertices_for_missing_edges
(
easy3d::SurfaceMesh* ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
std::map< int, bool>& ,
std::map< std::pair<int, int>, bool>& ,
std::vector<std::pair<int, int>>& ,
const easy3d::vec3 ,
const int
);
void find_missing_edges_in_holes
(
easy3d::SurfaceMesh* ,
std::vector<std::pair<int, int>>& ,
std::map<easy3d::SurfaceMesh::Vertex, int>&
);
bool planar_hole_checking
(
easy3d::SurfaceMesh* ,
std::vector<std::pair<int, int>>& ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
easy3d::Plane3& ,
std::map<int, bool>&
);
bool check_visited_turn
(
std::map<std::pair<std::pair<int, int>, std::pair<int, int>>, bool>& ,
std::pair<int, int>& ,
std::pair<int, int>& ,
std::pair<int, int>& ,
std::pair<int, int>&
);
bool check_hole_loop_completeness(std::vector<std::pair<int, int>>&);
easy3d::SurfaceMesh::Vertex get_non_adjacent_vertex
(
easy3d::SurfaceMesh*,
easy3d::SurfaceMesh::Vertex,
easy3d::SurfaceMesh::Vertex,
easy3d::SurfaceMesh::Vertex,
easy3d::SurfaceMesh::Vertex,
std::map<easy3d::SurfaceMesh::Vertex, int>&
);
void hole_edge_complement
(
easy3d::SurfaceMesh*,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
std::vector<std::vector<std::pair<int, int>>>&,
std::vector<std::vector<std::pair<int, int>>>&
);
void filter_invalid_hole_edges
(
easy3d::SurfaceMesh*,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
std::vector<std::vector<std::pair<int, int>>>&,
std::vector<std::vector<std::pair<int, int>>>&
);
void re_order_hole_vertices
(
easy3d::SurfaceMesh* ,
std::vector<std::pair<int, int>>& ,
std::vector<std::vector<std::pair<int, int>>>& ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
std::map<std::pair<int, int>, int>&,
std::map<std::pair<std::pair<int, int>, std::pair<int, int>>, bool>&
);
void get_hole_start_end_vertex
(
easy3d::SurfaceMesh* ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
easy3d::SurfaceMesh::Vertex& ,
easy3d::SurfaceMesh::Vertex& ,
easy3d::SurfaceMesh::Vertex& ,
easy3d::SurfaceMesh::Vertex& ,
std::map<int, bool>& ,
const std::vector<std::pair<int, int>>
);
void reverse_hole_edge_vertices(std::vector<std::pair<int, int>>&);
bool hole_edge_collinear_check
(
easy3d::SurfaceMesh* ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
const std::vector<std::pair<int, int>>
);
void planar_hole_edge_complement
(
easy3d::SurfaceMesh* ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
std::map<int, bool>&,
std::vector<std::pair<int, int>>&,
easy3d::SurfaceMesh::Vertex ,
easy3d::SurfaceMesh::Vertex ,
const easy3d::SurfaceMesh::Vertex ,
const easy3d::SurfaceMesh::Vertex ,
const easy3d::Plane3 ,
const bool
);
void project_hole_points
(
easy3d::SurfaceMesh*,
std::vector<std::pair<int, int>>&,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
std::vector<CDPoint_in>&,
std::map<int, std::pair<easy3d::vec3, easy3d::vec2>>&
);
bool extract_polyline_from_holes
(
easy3d::SurfaceMesh*,
std::vector<std::pair<int, int>>&,
std::map<easy3d::SurfaceMesh::Vertex, int>&,
Polygon_2_in&,
std::vector< std::pair<CDPoint_in, unsigned> >&,
std::map<int, int>&
);
void hole_surface_recosntruction_cgal_constrained_delaunay
(
easy3d::SurfaceMesh*,
Polygon_2_in&,
std::vector< std::pair<CDPoint_in, unsigned> >&,
std::map<int, int>&,
std::vector<Facet>&,
const bool,
const int
);
void triangulate_holes_without_self_intersection
(
easy3d::SurfaceMesh* ,
std::map<easy3d::SurfaceMesh::Vertex, int>& ,
easy3d::SurfaceMeshBuilder& ,
std::vector<Facet>&
);
void remesh_holes(easy3d::SurfaceMesh*, std::map<easy3d::SurfaceMesh::Vertex, int>&, std::vector< std::vector <std::pair<int, int>>>&, int&);
void advacing_holes_filling(easy3d::SurfaceMesh*);
}
#endif