MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / is_valid

Method is_valid

src/svgfill/src/graph_2d.h:175–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 }
174
175 bool is_valid() const {
176 typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 2, size_t, CGAL::Box_intersection_d::ID_EXPLICIT> Box;
177 std::vector<Box> boxes;
178 std::vector<CGAL::Segment_2<Kernel>> segments;
179 for (const auto& p : adjacency_list) {
180 for (const auto& q : p.second) {
181 if (p.first < q) {
182 segments.emplace_back(p.first, q);
183 }
184 }
185 }
186 for (auto it = segments.begin(); it != segments.end(); ++it) {
187 boxes.emplace_back(it->bbox(), std::distance(segments.begin(), it));
188 }
189 bool any = false;
190 CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), [this, &segments, &any](const Box& a, const Box& b) {
191 auto& seg1 = segments[a.handle()];
192 auto& seg2 = segments[b.handle()];
193 // Skip topologically connected segments
194 if (seg1.source() == seg2.source() || seg1.source() == seg2.target() || seg1.target() == seg2.source() || seg1.target() == seg2.target()) {
195 return;
196 }
197 if (CGAL::do_intersect(seg1, seg2)) {
198 any = true;
199 }
200 });
201 return any;
202 }
203
204 // Eliminates a vertex with exactly two neighbors by connecting its neighbors
205 typename std::map<Point_2, std::set<Point_2>>::iterator eliminate_vertex(typename std::map<Point_2, std::set<Point_2>>::iterator it) {

Callers 8

build_facet_edge_graphFunction · 0.80
TriangulateMethod · 0.80
is_manifoldMethod · 0.80
create_polyhedronMethod · 0.80
create_nef_polyhedronMethod · 0.80
to_xmlMethod · 0.80
current_revisionMethod · 0.80

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected