1515
1616#include < algorithm>
1717#include < boost/container/static_vector.hpp>
18+ #include < boost/iterator/function_output_iterator.hpp>
1819#include < boost/range/iterator_range.hpp>
1920#include < boost/unordered/unordered_flat_map.hpp>
2021#include < functional>
@@ -251,7 +252,11 @@ class Corefine {
251252 const std::vector<std::size_t >& point_ids, OutputIterator faces) const {
252253 auto it = triangulations.find (fi);
253254 if (it != triangulations.end ()) {
254- return it->second .value ().get_faces (faces);
255+ return it->second .value ().get_faces (
256+ boost::make_function_output_iterator ([&](const auto & face) {
257+ auto [a, b, c] = face;
258+ *faces++ = {Vertex_index{a}, Vertex_index{b}, Vertex_index{c}};
259+ }));
255260 }
256261
257262 const auto & f = soup.face (fi);
@@ -263,23 +268,22 @@ class Corefine {
263268 }
264269
265270 void insert_intersection (Triangulation& triangulation, const Intersection_info& info) {
266- typename Triangulation::Vertex_handle null_vh ;
267- auto first = null_vh ;
268- auto prev = null_vh ;
271+ using Vertex_handle = typename Triangulation::Vertex_handle;
272+ Vertex_handle first;
273+ Vertex_handle last ;
269274 for (std::size_t i = 0 ; i < info.intersections .size (); ++i) {
270275 auto id = info.intersections .at (i);
271276 auto sym = info.symbolic_intersections .at (i);
272277 auto cur = triangulation.insert (id, sym);
273- if (prev != null_vh) {
274- triangulation.insert_constraint (prev, cur);
275- }
276- if (first == null_vh) {
278+ if (i == 0 ) {
277279 first = cur;
280+ } else {
281+ triangulation.insert_constraint (last, cur);
278282 }
279- prev = cur;
283+ last = cur;
280284 }
281285 if (info.intersections .size () > 2 ) {
282- triangulation.insert_constraint (prev , first);
286+ triangulation.insert_constraint (last , first);
283287 }
284288 }
285289
0 commit comments