Skip to content

Commit 77e5bee

Browse files
committed
use features available in std instead of boost
1 parent 38c4ebd commit 77e5bee

File tree

4 files changed

+37
-39
lines changed

4 files changed

+37
-39
lines changed

Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@
4242
#include <vector>
4343
#include <stack>
4444
#include <map>
45+
#include <unordered_set>
4546

4647
#include <CGAL/boost/iterator/transform_iterator.hpp>
47-
#include <boost/next_prior.hpp>
48-
#include <boost/unordered_set.hpp>
49-
#include <boost/next_prior.hpp>
5048

5149
namespace CGAL {
5250
namespace internal {
@@ -651,7 +649,7 @@ struct Edge_graph
651649
}
652650
};
653651

654-
typedef boost::unordered_set<int> Vertex_container;
652+
typedef std::unordered_set<int> Vertex_container;
655653
// contains edges as key, and each edge contains set of third vertices which denote neighbor facets to that edge
656654
typedef std::map<std::pair<int, int>, Vertex_container, Edge_comp> Graph;
657655

@@ -791,8 +789,8 @@ class Triangulate_hole_polyline_DT
791789
Triangulation tr;
792790
std::vector<bool> edge_exist;
793791
std::pair<int, int> range(0, n-1);
794-
boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist);
795-
if(!res.template get<2>()) {
792+
std::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist);
793+
if(!std::get<2>(res)) {
796794
#ifdef CGAL_HOLE_FILLING_VERBOSE
797795
#ifndef CGAL_TEST_SUITE
798796
CGAL_warning_msg(false, "Returning no output. Dimension of 3D Triangulation is below 2!");
@@ -804,12 +802,12 @@ class Triangulate_hole_polyline_DT
804802
}
805803

806804
// all border edges inside 3D Triangulation
807-
if(boost::get<1>(res)) {
805+
if(std::get<1>(res)) {
808806
LookupTable<Weight> W(n, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
809807
LookupTable<int> lambda(n,-1);
810808

811809
typename Incident_facet_circulator_base<Triangulate_hole_polyline_DT>::Edge_wrapper
812-
e_start(*boost::get<0>(res));
810+
e_start(*std::get<0>(res));
813811
if(tr.dimension() == 3) {
814812
triangulate_DT<IFC_3>(P, Q, W, lambda, e_start, tr, WC, false);
815813
}
@@ -839,7 +837,7 @@ class Triangulate_hole_polyline_DT
839837
#else
840838
// This approach produce better patches when used with Weight_incomplete
841839
// (which should be arranged in internal::triangulate_hole_Polyhedron, triangulate_polyline)
842-
return fill_by_incomplete_patches(tr, res.get<0>(), edge_exist, P, Q, tracer, WC);
840+
return fill_by_incomplete_patches(tr, std::get<0>(res), edge_exist, P, Q, tracer, WC);
843841
#endif
844842
}
845843

@@ -928,7 +926,7 @@ class Triangulate_hole_polyline_DT
928926
}
929927

930928
// returns [h.first-h.second edge, true if all edges inside 3D triangulation, true if tr.dimension() >= 2]
931-
boost::tuple<boost::optional<Edge>, bool, bool>
929+
std::tuple<boost::optional<Edge>, bool, bool>
932930
construct_3D_triangulation(const Polyline_3& P,
933931
std::pair<int,int> h,
934932
Triangulation& tr,
@@ -937,11 +935,11 @@ class Triangulate_hole_polyline_DT
937935
// construct 3D tr with P[h.first], P[h.second] also assign ids from h.first to h.second
938936
boost::optional<Edge> e;
939937
int n_border = h.second - h.first + 1;
940-
tr.insert(boost::make_transform_iterator(boost::next(P.begin(), h.first), Auto_count(h.first)),
941-
boost::make_transform_iterator(boost::next(P.begin(), h.second +1), Auto_count(h.first)));
938+
tr.insert(boost::make_transform_iterator(std::next(P.begin(), h.first), Auto_count(h.first)),
939+
boost::make_transform_iterator(std::next(P.begin(), h.second +1), Auto_count(h.first)));
942940
tr.infinite_vertex()->info() = -1;
943941

944-
if(tr.dimension() < 2) { return boost::make_tuple(e, false, false); }
942+
if(tr.dimension() < 2) { return std::make_tuple(e, false, false); }
945943

946944
// check whether all edges are included in DT, and get v0-vn-1 edge
947945
edge_exist.assign(n_border, false);
@@ -972,7 +970,7 @@ class Triangulate_hole_polyline_DT
972970

973971
bool is_3D_T_complete = (nb_exists == n_border);
974972
if(edge_exist[n_border-1]) { e = *v_first_v_second_edge; }
975-
return boost::make_tuple(e, is_3D_T_complete, true);
973+
return std::make_tuple(e, is_3D_T_complete, true);
976974
}
977975

978976
/************************************************************************
@@ -992,7 +990,7 @@ class Triangulate_hole_polyline_DT
992990
{
993991
typedef std::pair<int, int> Range;
994992
typedef std::back_insert_iterator<std::vector<Range> > Output_hole_iterator;
995-
typedef Tracer_polyline_incomplete<boost::tuple<int, int, int>, Emptyset_iterator, Output_hole_iterator> Remaining_holes_tracer;
993+
typedef Tracer_polyline_incomplete<std::tuple<int, int, int>, Emptyset_iterator, Output_hole_iterator> Remaining_holes_tracer;
996994

997995
std::vector<Range> remaining_holes;
998996

@@ -1055,14 +1053,14 @@ class Triangulate_hole_polyline_DT
10551053
// construct tr for next coming hole
10561054
h = remaining_holes.back();
10571055
tr.clear();
1058-
boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist);
1059-
if(!boost::get<0>(res)) {
1056+
std::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist);
1057+
if(!std::get<0>(res)) {
10601058
#ifdef CGAL_HOLE_FILLING_VERBOSE
10611059
CGAL_warning_msg(false, "Returning no output. Filling hole with incomplete patches is not successful!");
10621060
#endif
10631061
return Weight::NOT_VALID();
10641062
}
1065-
start_edge = *boost::get<0>(res);
1063+
start_edge = *std::get<0>(res);
10661064
// clear related regions in W, lambda for next coming hole
10671065
W.set_range_to_default(h.first, h.second);
10681066
lambda.set_range_to_default(h.first, h.second);

Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/experimental/experimental_code.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ triangulate_hole_polyline_incomplete(InputIterator pbegin, InputIterator pend,
121121
typedef Weight_incomplete<Weight_min_max_dihedral_and_area> Weight;
122122
typedef Weight_calculator<Weight, Is_valid_degenerate_triangle> WC;
123123

124-
typedef std::vector<boost::tuple<int, int, int> > Facet_vector; /* deliberately not OutputIteratorValueType*/
124+
typedef std::vector<std::tuple<int, int, int> > Facet_vector; /* deliberately not OutputIteratorValueType*/
125125
typedef std::back_insert_iterator<Facet_vector> OutIt;
126126
typedef Tracer_polyline_incomplete<Facet_vector::value_type, OutIt> Tracer;
127127
typedef std::pair<int, int> Range;

Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include <CGAL/boost/graph/helpers.h>
2929

30-
#include <boost/tuple/tuple.hpp>
30+
#include <tuple>
3131

3232
#include <vector>
3333

Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <cassert>
66
#include <vector>
77
#include <fstream>
8-
#include <boost/tuple/tuple.hpp>
8+
#include <tuple>
99

1010
#include <CGAL/Polyhedron_incremental_builder_3.h>
1111
#include <CGAL/Polyhedron_3.h>
@@ -20,7 +20,7 @@ template<class HDS, class K>
2020
class Polyhedron_builder : public CGAL::Modifier_base<HDS> {
2121
typedef typename K::Point_3 Point_3;
2222
public:
23-
Polyhedron_builder(std::vector<boost::tuple<int, int, int> >* triangles,
23+
Polyhedron_builder(std::vector<std::tuple<int, int, int> >* triangles,
2424
std::vector<Point_3>* polyline)
2525
: triangles(triangles), polyline(polyline)
2626
{ }
@@ -34,20 +34,20 @@ class Polyhedron_builder : public CGAL::Modifier_base<HDS> {
3434
B.add_vertex(*it);
3535
}
3636

37-
for(typename std::vector<boost::tuple<int, int, int> >::iterator it = triangles->begin();
37+
for(typename std::vector<std::tuple<int, int, int> >::iterator it = triangles->begin();
3838
it != triangles->end(); ++it) {
3939
B.begin_facet();
40-
B.add_vertex_to_facet(it->get<0>());
41-
B.add_vertex_to_facet(it->get<1>());
42-
B.add_vertex_to_facet(it->get<2>());
40+
B.add_vertex_to_facet(std::get<0>(*it));
41+
B.add_vertex_to_facet(std::get<1>(*it));
42+
B.add_vertex_to_facet(std::get<2>(*it));
4343
B.end_facet();
4444
}
4545

4646
B.end_surface();
4747
}
4848

4949
private:
50-
std::vector<boost::tuple<int, int, int> >* triangles;
50+
std::vector<std::tuple<int, int, int> >* triangles;
5151
std::vector<Point_3>* polyline;
5252
};
5353

@@ -92,25 +92,25 @@ void read_polyline_with_extra_points(
9292
}
9393
}
9494

95-
void check_triangles(std::vector<Point_3>& points, std::vector<boost::tuple<int, int, int> >& tris) {
95+
void check_triangles(std::vector<Point_3>& points, std::vector<std::tuple<int, int, int> >& tris) {
9696
if(points.size() - 3 != tris.size()) {
9797
std::cerr << " Error: there should be n-2 triangles in generated patch." << std::endl;
9898
assert(false);
9999
}
100100

101101
const int max_index = static_cast<int>(points.size())-1;
102-
for(std::vector<boost::tuple<int, int, int> >::iterator it = tris.begin(); it != tris.end(); ++it) {
103-
if(it->get<0>() == it->get<1>() ||
104-
it->get<0>() == it->get<2>() ||
105-
it->get<1>() == it->get<2>() )
102+
for(std::vector<std::tuple<int, int, int> >::iterator it = tris.begin(); it != tris.end(); ++it) {
103+
if(std::get<0>(*it) == std::get<1>(*it) ||
104+
std::get<0>(*it) == std::get<2>(*it) ||
105+
std::get<1>(*it) == std::get<2>(*it) )
106106
{
107107
std::cerr << "Error: indices of triangles should be all different." << std::endl;
108108
assert(false);
109109
}
110110

111-
if(it->get<0>() >= max_index ||
112-
it->get<1>() >= max_index ||
113-
it->get<2>() >= max_index )
111+
if(std::get<0>(*it) >= max_index ||
112+
std::get<1>(*it) >= max_index ||
113+
std::get<2>(*it) >= max_index )
114114
{
115115
std::cerr << " Error: max possible index check failed." << std::endl;
116116
assert(false);
@@ -119,7 +119,7 @@ void check_triangles(std::vector<Point_3>& points, std::vector<boost::tuple<int,
119119
}
120120

121121
void check_constructed_polyhedron(const char* file_name,
122-
std::vector<boost::tuple<int, int, int> >* triangles,
122+
std::vector<std::tuple<int, int, int> >* triangles,
123123
std::vector<Point_3>* polyline,
124124
const bool save_poly)
125125
{
@@ -147,7 +147,7 @@ void test_1(const char* file_name, bool use_DT, bool save_output) {
147147
std::vector<Point_3> points; // this will contain n and +1 repeated point
148148
read_polyline_one_line(file_name, points);
149149

150-
std::vector<boost::tuple<int, int, int> > tris;
150+
std::vector<std::tuple<int, int, int> > tris;
151151
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(
152152
points, std::back_inserter(tris),
153153
CGAL::parameters::use_delaunay_triangulation(use_DT)
@@ -166,7 +166,7 @@ void test_2(const char* file_name, bool use_DT, bool save_output) {
166166
std::vector<Point_3> extras;
167167
read_polyline_with_extra_points(file_name, points, extras);
168168

169-
std::vector<boost::tuple<int, int, int> > tris;
169+
std::vector<std::tuple<int, int, int> > tris;
170170
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(
171171
points, extras, std::back_inserter(tris),
172172
CGAL::parameters::use_delaunay_triangulation(use_DT)
@@ -184,7 +184,7 @@ void test_should_be_no_output(const char* file_name, bool use_DT) {
184184
std::vector<Point_3> points; // this will contain n and +1 repeated point
185185
read_polyline_one_line(file_name, points);
186186

187-
std::vector<boost::tuple<int, int, int> > tris;
187+
std::vector<std::tuple<int, int, int> > tris;
188188
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(
189189
points, std::back_inserter(tris),
190190
CGAL::parameters::use_delaunay_triangulation(use_DT)

0 commit comments

Comments
 (0)