diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h index 2f1fdc3e5c6..5c7a45edb67 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h @@ -47,7 +47,7 @@ Provides the operator: `return_type operator()(const Query& q, const Primitive::Datum& d)`, which computes the intersection between `q` and `d`. The type of the returned object -must be a `boost::optional` of a `boost::variant` of the possible intersection types. +must be a `std::optional` of a `std::variant` of the possible intersection types. */ typedef unspecified_type Intersect_3; diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h index 215cbd65924..3b186c9ff22 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h @@ -25,15 +25,15 @@ public: /*! A functor object to compute the distance between the source of a ray and its closest intersection point between the ray and a primitive or a bounding box. - An empty `boost::optional` is returned, if there is no intersection. + An empty `std::optional` is returned, if there is no intersection. When there is an intersection, an object of type `FT` is returned such that if `i1` and `i2` are two intersection points, then `i1` is closer to the source of the ray than `i2` iff `n1 < n2`, `n1` and `n2` being the numbers returned for `i1` and `i2` respectively. Provides the operators: - `boost::optional operator()(const Ray_3& r, const Bounding_box& bbox)`. - `boost::optional::%Type > > + `std::optional operator()(const Ray_3& r, const Bounding_box& bbox)`. + `std::optional::%Type > > operator()(const Ray_3& r, const Primitive& primitive)`. A common algorithm to compute the intersection between a bounding box and a ray is ::%Type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. +`std::optional::%Type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. \cgalHeading{Note on Backward Compatibility} -Before the release 4.3 of \cgal, the return type of this function used to be `boost::optional`. +Before the release 4.3 of \cgal, the return type of this function used to be `std::optional`. */ typedef unspecified_type Intersection; diff --git a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp index 4a4a1e61306..6ced34c0234 100644 --- a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp @@ -19,8 +19,8 @@ typedef CGAL::Polyhedron_3 Polyhedron; typedef CGAL::AABB_face_graph_triangle_primitive Primitive; typedef CGAL::AABB_traits Traits; typedef CGAL::AABB_tree Tree; -typedef boost::optional< Tree::Intersection_and_primitive_id::Type > Segment_intersection; -typedef boost::optional< Tree::Intersection_and_primitive_id::Type > Plane_intersection; +typedef std::optional< Tree::Intersection_and_primitive_id::Type > Segment_intersection; +typedef std::optional< Tree::Intersection_and_primitive_id::Type > Plane_intersection; typedef Tree::Primitive_id Primitive_id; int main() @@ -57,7 +57,7 @@ int main() if(intersection) { // gets intersection object - const Point* p = boost::get(&(intersection->first)); + const Point* p = std::get_if(&(intersection->first)); if(p) std::cout << "intersection object is a point " << *p << std::endl; @@ -81,7 +81,7 @@ int main() if(plane_intersection) { - if(boost::get(&(plane_intersection->first))) + if(std::get_if(&(plane_intersection->first))) std::cout << "intersection object is a segment" << std::endl; } diff --git a/AABB_tree/examples/AABB_tree/AABB_ray_shooting_example.cpp b/AABB_tree/examples/AABB_tree/AABB_ray_shooting_example.cpp index d3b2af45913..e9ed0fe87c5 100644 --- a/AABB_tree/examples/AABB_tree/AABB_ray_shooting_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_ray_shooting_example.cpp @@ -23,7 +23,7 @@ typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef CGAL::AABB_face_graph_triangle_primitive Primitive; typedef CGAL::AABB_traits Traits; typedef CGAL::AABB_tree Tree; -typedef boost::optional::Type> Ray_intersection; +typedef std::optional::Type> Ray_intersection; struct Skip { @@ -70,8 +70,8 @@ int main(int argc, char* argv[]) Ray_intersection intersection = tree.first_intersection(ray, skip); if(intersection) { - if(boost::get(&(intersection->first))){ - const Point* p = boost::get(&(intersection->first) ); + if(std::get_if(&(intersection->first))){ + const Point* p = std::get_if(&(intersection->first) ); std::cout << *p << std::endl; } } diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index b2eb87dc8f6..f5c1c1240a1 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -27,7 +27,7 @@ #include -#include +#include /// \file AABB_traits.h @@ -39,7 +39,7 @@ template struct Remove_optional { typedef T type; }; template -struct Remove_optional< ::boost::optional > { typedef T type; }; +struct Remove_optional< ::std::optional > { typedef T type; }; //helper controlling whether extra data should be stored in the AABB_tree traits class template ::value> @@ -85,7 +85,7 @@ struct AABB_traits_base_2{ typedef typename CGAL::Bbox_3 Bounding_box; struct Intersection_distance { - boost::optional operator()(const Ray_3& ray, const Bounding_box& bbox) const { + std::optional operator()(const Ray_3& ray, const Bounding_box& bbox) const { FT t_near = -DBL_MAX; // std::numeric_limits::lowest(); C++1903 FT t_far = DBL_MAX; @@ -101,7 +101,7 @@ struct AABB_traits_base_2{ for(int i = 0; i < 3; ++i, ++source_iter, ++direction_iter) { if(*direction_iter == 0) { if((*source_iter < (bbox.min)(i)) || (*source_iter > (bbox.max)(i))) { - return boost::none; + return std::nullopt; } } else { FT t1 = ((bbox.min)(i) - *source_iter) / *direction_iter; @@ -118,7 +118,7 @@ struct AABB_traits_base_2{ // t_far = t2; if(t_near > t_far || t_far < FT(0.)) - return boost::none; + return std::nullopt; } } @@ -193,7 +193,7 @@ public: /// `Intersection_and_primitive_id::%Type::first_type` is found according to /// the result type of `GeomTraits::Intersect_3::operator()`. If it is - /// `boost::optional` then it is `T`, and the result type otherwise. + /// `std::optional` then it is `T`, and the result type otherwise. template struct Intersection_and_primitive_id { typedef decltype( @@ -364,12 +364,12 @@ public: Intersection(const AABB_traits& traits) :m_traits(traits) {} template - boost::optional< typename Intersection_and_primitive_id::Type > + std::optional< typename Intersection_and_primitive_id::Type > operator()(const Query& query, const typename AT::Primitive& primitive) const { auto inter_res = GeomTraits().intersect_3_object()(query, internal::Primitive_helper::get_datum(primitive,m_traits)); if (!inter_res) - return boost::none; - return boost::make_optional( std::make_pair(*inter_res, primitive.id()) ); + return std::nullopt; + return std::make_optional( std::make_pair(*inter_res, primitive.id()) ); } }; diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 1bc5173cb24..16c39099b38 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #ifdef CGAL_HAS_THREADS #include @@ -270,7 +270,7 @@ public: /// \tparam Query must be a type for which `Do_intersect` operators are /// defined in the traits class `AABBTraits`. template - boost::optional any_intersected_primitive(const Query& query) const; + std::optional any_intersected_primitive(const Query& query) const; ///@} /// \name Intersections @@ -293,7 +293,7 @@ public: /// \tparam Query must be a type for which `Do_intersect` and `Intersection` operators are /// defined in the traits class `AABBTraits`. template - boost::optional< typename Intersection_and_primitive_id::Type > + std::optional< typename Intersection_and_primitive_id::Type > any_intersection(const Query& query) const; @@ -317,12 +317,12 @@ public: /// `AABBTraits` must be a model of `AABBRayIntersectionTraits` to /// call this member function. template - boost::optional< typename Intersection_and_primitive_id::Type > + std::optional< typename Intersection_and_primitive_id::Type > first_intersection(const Ray& query, const SkipFunctor& skip) const; /// \cond template - boost::optional< typename Intersection_and_primitive_id::Type > + std::optional< typename Intersection_and_primitive_id::Type > first_intersection(const Ray& query) const { return first_intersection(query, [](Primitive_id){ return false; }); @@ -342,12 +342,12 @@ public: /// `AABBTraits` must be a model of `AABBRayIntersectionTraits` to /// call this member function. template - boost::optional + std::optional first_intersected_primitive(const Ray& query, const SkipFunctor& skip) const; /// \cond template - boost::optional + std::optional first_intersected_primitive(const Ray& query) const { return first_intersected_primitive(query, [](Primitive_id){ return false; }); @@ -963,7 +963,7 @@ public: template template - boost::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > + std::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > AABB_tree::any_intersection(const Query& query) const { using namespace CGAL::internal::AABB_tree; @@ -975,7 +975,7 @@ public: template template - boost::optional::Primitive_id> + std::optional::Primitive_id> AABB_tree::any_intersected_primitive(const Query& query) const { using namespace CGAL::internal::AABB_tree; diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h index 87ebbe012ab..fd11f41492c 100644 --- a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h +++ b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h @@ -19,8 +19,7 @@ #include #include -#include -#include +#include # if defined(BOOST_MSVC) # pragma warning(push) # pragma warning(disable: 4996) @@ -43,7 +42,7 @@ class AABB_ray_intersection { public: AABB_ray_intersection(const AABBTree& tree) : tree_(tree) {} - boost::optional< Ray_intersection_and_primitive_id > + std::optional< Ray_intersection_and_primitive_id > ray_intersection(const Ray& query, SkipFunctor skip) const { // We hit the root, now continue on the children. Keep track of // nb_primitives through a variable in each Node on the stack. In @@ -63,7 +62,7 @@ public: Heap_type pq; // pq.reserve(tree_.size() / 2); - boost::optional< Ray_intersection_and_primitive_id > + std::optional< Ray_intersection_and_primitive_id > intersection, /* the temporary for calculating the result */ p; /* the current best intersection */ @@ -84,7 +83,7 @@ public: if(!skip(current.node->left_data().id()) /* && do_intersect_obj(query, current.node->left_data()) */) { intersection = intersection_obj(query, current.node->left_data()); if(intersection) { - FT ray_distance = boost::apply_visitor(param_visitor, intersection->first); + FT ray_distance = std::visit(param_visitor, intersection->first); if(ray_distance < t) { t = ray_distance; p = intersection; @@ -96,7 +95,7 @@ public: if(!skip(current.node->right_data().id()) /* && do_intersect_obj(query, current.node->right_data()) */) { intersection = intersection_obj(query, current.node->right_data()); if(intersection) { - FT ray_distance = boost::apply_visitor(param_visitor, intersection->first); + FT ray_distance = std::visit(param_visitor, intersection->first); if(ray_distance < t) { t = ray_distance; p = intersection; @@ -111,7 +110,7 @@ public: if(!skip(current.node->left_data().id()) /* && do_intersect_obj(query, current.node->left_data()) */) { intersection = intersection_obj(query, current.node->left_data()); if(intersection) { - FT ray_distance = boost::apply_visitor(param_visitor, intersection->first); + FT ray_distance = std::visit(param_visitor, intersection->first); if(ray_distance < t) { t = ray_distance; p = intersection; @@ -121,7 +120,7 @@ public: // right child const Node* child = &(current.node->right_child()); - boost::optional< FT > dist = intersection_distance_obj(query, child->bbox()); + std::optional< FT > dist = intersection_distance_obj(query, child->bbox()); if(dist) pq.push(Node_ptr_with_ft(child, *dist, 2)); @@ -130,7 +129,7 @@ public: default: // Children both inner nodes { const Node* child = &(current.node->left_child()); - boost::optional dist = intersection_distance_obj(query, child->bbox()); + std::optional dist = intersection_distance_obj(query, child->bbox()); if(dist) pq.push(Node_ptr_with_ft(child, *dist, current.nb_primitives/2)); @@ -198,7 +197,7 @@ private: template template -boost::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > +std::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > AABB_tree::first_intersection(const Ray& query, const SkipFunctor& skip) const { static_assert(std::is_same::value, @@ -219,22 +218,22 @@ AABB_tree::first_intersection(const Ray& query, break; } } - return boost::none; + return std::nullopt; } template template -boost::optional::Primitive_id> +std::optional::Primitive_id> AABB_tree::first_intersected_primitive(const Ray& query, const SkipFunctor& skip) const { - boost::optional< + std::optional< typename AABB_tree:: template Intersection_and_primitive_id::Type > res = first_intersection(query, skip); if ( (bool) res ) - return boost::make_optional( res->second ); - return boost::none; + return std::make_optional( res->second ); + return std::nullopt; } } diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traversal_traits.h b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traversal_traits.h index fe7e85effdd..645ce1347cb 100644 --- a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traversal_traits.h +++ b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traversal_traits.h @@ -17,7 +17,7 @@ #include -#include +#include namespace CGAL { @@ -69,7 +69,7 @@ class First_intersection_traits public: typedef - boost::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > + std::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > Result; public: First_intersection_traits(const AABBTraits& traits) @@ -124,7 +124,7 @@ public: void intersection(const Query& query, const Primitive& primitive) { - boost::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > + std::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > intersection = m_traits.intersection_object()(query, primitive); if(intersection) @@ -211,7 +211,7 @@ public: { if( m_traits.do_intersect_object()(query, primitive) ) { - m_result = boost::optional(primitive.id()); + m_result = std::optional(primitive.id()); m_is_found = true; } } @@ -221,12 +221,12 @@ public: return m_traits.do_intersect_object()(query, node.bbox()); } - boost::optional result() const { return m_result; } + std::optional result() const { return m_result; } bool is_intersection_found() const { return m_is_found; } private: bool m_is_found; - boost::optional m_result; + std::optional m_result; const AABBTraits& m_traits; }; diff --git a/AABB_tree/test/AABB_tree/AABB_test_util.h b/AABB_tree/test/AABB_tree/AABB_test_util.h index 5b73a20f9f2..fae5abfe17c 100644 --- a/AABB_tree/test/AABB_tree/AABB_test_util.h +++ b/AABB_tree/test/AABB_tree/AABB_test_util.h @@ -95,20 +95,23 @@ void test_all_intersection_query_types(Tree& tree) tree.all_intersected_primitives(segment,std::back_inserter(primitives)); // any_intersection - boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > r = tree.any_intersection(ray); - boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > l = tree.any_intersection(line); - boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > s = tree.any_intersection(segment); + std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > r = tree.any_intersection(ray); + std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > l = tree.any_intersection(line); + std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > s = tree.any_intersection(segment); + CGAL_USE(r); + CGAL_USE(l); + CGAL_USE(s); // any_intersected_primitive - boost::optional optional_primitive; + std::optional optional_primitive; optional_primitive = tree.any_intersected_primitive(ray); optional_primitive = tree.any_intersected_primitive(line); optional_primitive = tree.any_intersected_primitive(segment); // all_intersections - std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_r; - std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_l; - std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_s; + std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_r; + std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_l; + std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > > intersections_s; tree.all_intersections(ray,std::back_inserter(intersections_r)); tree.all_intersections(line,std::back_inserter(intersections_l)); tree.all_intersections(segment,std::back_inserter(intersections_s)); @@ -322,7 +325,7 @@ class Naive_implementations typedef typename Traits::Point_3 Point; typedef typename Traits::Point_and_primitive_id Point_and_primitive_id; - typedef boost::optional Intersection_result; + typedef std::optional Intersection_result; const Traits& m_traits; public: @@ -380,7 +383,7 @@ public: Polyhedron_primitive_iterator it = Pr_generator().begin(p); for ( ; it != Pr_generator().end(p) ; ++it ) { - boost::optional< typename Traits::template Intersection_and_primitive_id::Type > + std::optional< typename Traits::template Intersection_and_primitive_id::Type > intersection = m_traits.intersection_object()(query, Pr(it,p)); if ( intersection ) *out++ = *intersection; @@ -653,7 +656,7 @@ private: } // any_intersected_primitive test (do not count time here) - typedef boost::optional Any_primitive; + typedef std::optional Any_primitive; Any_primitive primitive = tree.any_intersected_primitive(query); // Check: verify we do get the result by naive method @@ -723,7 +726,7 @@ private: } // Any intersection test (do not count time here) - boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > + std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id::Type > intersection = tree.any_intersection(query); // Check: verify we do get the result by naive method diff --git a/AABB_tree/test/AABB_tree/aabb_any_all_benchmark.cpp b/AABB_tree/test/AABB_tree/aabb_any_all_benchmark.cpp index 5e09d6c2291..eb6fef9082a 100644 --- a/AABB_tree/test/AABB_tree/aabb_any_all_benchmark.cpp +++ b/AABB_tree/test/AABB_tree/aabb_any_all_benchmark.cpp @@ -46,7 +46,7 @@ std::size_t intersect(ForwardIterator b, ForwardIterator e, const Tree& tree, lo v.reserve(elements); for(; b != e; ++b) { tree.all_intersections(*b, std::back_inserter(v)); - boost::optional o = tree.any_intersection(*b); + std::optional o = tree.any_intersection(*b); if(o) ++counter; } diff --git a/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp index 13eb303b771..54ef4c600f6 100644 --- a/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp @@ -65,7 +65,7 @@ int test() return EXIT_FAILURE; } - boost::optional any; + std::optional any; any = tree.any_intersection(pq); if(!any) { diff --git a/AABB_tree/test/AABB_tree/aabb_test_ray_intersection.cpp b/AABB_tree/test/AABB_tree/aabb_test_ray_intersection.cpp index 649f594d7e9..8ca781ff114 100644 --- a/AABB_tree/test/AABB_tree/aabb_test_ray_intersection.cpp +++ b/AABB_tree/test/AABB_tree/aabb_test_ray_intersection.cpp @@ -35,7 +35,7 @@ FT point_on_ray_dist(const Ray& ray, const Point& point) { std::size_t accum = 0; -boost::optional< +std::optional< Tree::Intersection_and_primitive_id::Type > min_intersection(const Tree& tree, const Ray& ray) { @@ -45,12 +45,12 @@ min_intersection(const Tree& tree, const Ray& ray) { tree.all_intersections(ray, std::back_inserter(all_intersections)); accum += all_intersections.size(); Tree::FT min_distance = DBL_MAX; - boost::optional< + std::optional< Tree::Intersection_and_primitive_id::Type - > mini = boost::none; + > mini = std::nullopt; for(IntersectionVector::iterator it2 = all_intersections.begin(); it2 != all_intersections.end(); ++it2) { - if(Point* point = boost::get(&(it2->first))) { + if(Point* point = std::get_if(&(it2->first))) { Vector i_ray(*point, ray.source()); Tree::FT new_distance = i_ray.squared_length(); if(new_distance < min_distance) { @@ -124,7 +124,7 @@ int main() rays.reserve(NB_RAYS); std::transform(v1.begin(), v1.end(), v2.begin(), std::back_inserter(rays), boost::value_factory()); - std::vector< boost::optional::Type > > primitives1, primitives2; + std::vector< std::optional::Type > > primitives1, primitives2; primitives1.reserve(NB_RAYS); primitives2.reserve(NB_RAYS); @@ -139,7 +139,7 @@ int main() } assert(primitives1.size() == primitives2.size()); // Different amount of primitives intersected assert(std::equal(primitives1.begin(), primitives1.end(), primitives2.begin())); // Primitives mismatch - std::size_t c = primitives1.size() - std::count(primitives1.begin(), primitives1.end(), boost::none); + std::size_t c = primitives1.size() - std::count(primitives1.begin(), primitives1.end(), std::nullopt); std::cout << "Intersected " << c << " primitives with " << NB_RAYS << " rays" << std::endl; std::cout << "Primitive method had to sort " << accum/NB_RAYS << " intersections on average." << std::endl; diff --git a/Algebraic_foundations/doc/Algebraic_foundations/Concepts/EuclideanRing.h b/Algebraic_foundations/doc/Algebraic_foundations/Concepts/EuclideanRing.h index 69421885198..a1ea3df6e96 100644 --- a/Algebraic_foundations/doc/Algebraic_foundations/Concepts/EuclideanRing.h +++ b/Algebraic_foundations/doc/Algebraic_foundations/Concepts/EuclideanRing.h @@ -3,7 +3,7 @@ \ingroup PkgAlgebraicFoundationsAlgebraicStructuresConcepts \cgalConcept -A model of `EuclideanRing` represents an euclidean ring (or Euclidean domain). +A model of `EuclideanRing` represents a Euclidean ring (or Euclidean domain). It is an `UniqueFactorizationDomain` that affords a suitable notion of minimality of remainders such that given \f$ x\f$ and \f$ y \neq 0\f$ we obtain an (almost) unique solution to \f$ x = qy + r \f$ by demanding that a solution \f$ (q,r)\f$ is chosen to minimize \f$ r\f$. diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index e92e01e0669..bc35601fc5e 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -359,7 +359,7 @@ public: Unary_compose(const Unary_compose& other) = default; Unary_compose& operator=(const Unary_compose& other) = default; - Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} + Unary_compose() : _inner(::std::nullopt),_outer(::std::nullopt) {} typedef typename InnerFunctor::argument_type argument_type; typedef typename OuterFunctor::result_type result_type; @@ -368,11 +368,11 @@ public: result_type operator() (const argument_type& arg) const { CGAL_assertion(bool(_inner)); CGAL_assertion(bool(_outer)); - return _outer.get()(_inner.get()(arg)); + return _outer.value()(_inner.value()(arg)); } private: - ::boost::optional _inner; - ::boost::optional _outer; + ::std::optional _inner; + ::std::optional _outer; }; template diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h index 2b5a30867ce..9c23acc6bd0 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h @@ -174,7 +174,7 @@ public: long old_precision = get_precision( BFI() ); set_precision( BFI(), 53 ); std::pair interval = CGAL::to_interval( convert_to_bfi( (*this))); - this->ptr()->interval_option = boost::optional< std::pair >(interval); + this->ptr()->interval_option = std::optional< std::pair >(interval); set_precision( BFI(), old_precision ); return *(this->ptr()->interval_option); } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h index b7e686d4203..06effd6b5dd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h @@ -86,10 +86,10 @@ private: CGAL::Polynomial_traits_d::template Rebind ::Other::Type BFI_polynomial; - mutable boost::optional + mutable std::optional < BFI_polynomial > f_bfi_; - mutable boost::optional low_bfi_, f_low_bfi_, + mutable std::optional low_bfi_, f_low_bfi_, high_bfi_, f_high_bfi_; mutable long N; @@ -113,8 +113,8 @@ private: low_bfi_ = CGAL::convert_to_bfi(this->low()); high_bfi_ = CGAL::convert_to_bfi(this->high()); - f_low_bfi_ = f_bfi_.get().evaluate(low_bfi_.get()); - f_high_bfi_ = f_bfi_.get().evaluate(high_bfi_.get()); + f_low_bfi_ = f_bfi_.value().evaluate(low_bfi_.value()); + f_high_bfi_ = f_bfi_.value().evaluate(high_bfi_.value()); } @@ -125,7 +125,7 @@ private: } m_bfi = CGAL::convert_to_bfi(m); - f_m_bfi = f_bfi_.get().evaluate(m_bfi); + f_m_bfi = f_bfi_.value().evaluate(m_bfi); if(CGAL::zero_in(f_m_bfi)) { @@ -229,21 +229,21 @@ protected: bool poly_changed = (P!=this->polynomial()); if(poly_changed) { - f_bfi_ = boost::none; + f_bfi_ = std::nullopt; } if(poly_changed || LOW != this->low()) { - f_low_bfi_ = low_bfi_ = boost::none; + f_low_bfi_ = low_bfi_ = std::nullopt; } if(poly_changed || HIGH != this->high()) { - f_high_bfi_ = high_bfi_ = boost::none; + f_high_bfi_ = high_bfi_ = std::nullopt; } Base::set_implicit_rep(P,LOW,HIGH,dummy_bool); } virtual void set_explicit_rep(const Field& m) const { - f_bfi_ = boost::none; - f_low_bfi_ = low_bfi_ = boost::none; - f_high_bfi_ = high_bfi_ = boost::none; + f_bfi_ = std::nullopt; + f_low_bfi_ = low_bfi_ = std::nullopt; + f_high_bfi_ = high_bfi_ = std::nullopt; Base::set_explicit_rep(m); } @@ -256,13 +256,13 @@ public: if(this->is_rational()) return; if(old_low_!=this->low_) { - f_low_bfi_ = low_bfi_ = boost::none; + f_low_bfi_ = low_bfi_ = std::nullopt; } if(old_high_!=this->high_) { - f_high_bfi_ = high_bfi_ = boost::none; + f_high_bfi_ = high_bfi_ = std::nullopt; } if(old_pol != this->polynomial()) { - f_bfi_ = boost::none; + f_bfi_ = std::nullopt; } } @@ -329,25 +329,25 @@ private: low_bfi_ = CGAL::convert_to_bfi(this->low()); } if(! f_low_bfi_) { - f_low_bfi_ = f_bfi_.get().evaluate(low_bfi_.get()); + f_low_bfi_ = f_bfi_.value().evaluate(low_bfi_.value()); } if(! high_bfi_) { high_bfi_ = CGAL::convert_to_bfi(this->high()); } if(! f_high_bfi_) { - f_high_bfi_ = f_bfi_.get().evaluate(high_bfi_.get()); + f_high_bfi_ = f_bfi_.value().evaluate(high_bfi_.value()); } Integer i; while(true) { - if(CGAL::zero_in(f_low_bfi_.get() - f_high_bfi_.get())) { + if(CGAL::zero_in(f_low_bfi_.value() - f_high_bfi_.value())) { _set_prec(2*prec_); continue; } - BFI denom = f_low_bfi_.get()-f_high_bfi_.get(); + BFI denom = f_low_bfi_.value()-f_high_bfi_.value(); - BFI z = f_low_bfi_.get() / denom; + BFI z = f_low_bfi_.value() / denom; std::pair int_pair = _to_integer_interval(z,N); Integer i_low = int_pair.first; @@ -458,7 +458,7 @@ protected: f_bfi_ = _convert_polynomial_to_bfi(this->polynomial()); } - BFI eval = f_bfi_.get().evaluate(convert_to_bfi(m)); + BFI eval = f_bfi_.value().evaluate(convert_to_bfi(m)); CGAL::Sign s = CGAL::sign(CGAL::lower(eval)); @@ -490,7 +490,7 @@ public: Poly f_old = this->polynomial(); Base::simplify(); if(f_old != this->polynomial()) { - f_bfi_ = boost::none; + f_bfi_ = std::nullopt; } } }; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h index cecfb57c971..95e8907ad55 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -56,7 +56,7 @@ private: typedef Algebraic_real_rep Self; public: - typedef boost::optional< std::pair > Interval_option; + typedef std::optional< std::pair > Interval_option; mutable Poly polynomial_; //!< square free polynomial mutable Rational low_; //!< lower endpoint of interval diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h index 2f7719bb362..bf607e75f15 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h @@ -31,7 +31,7 @@ #include #include -#include +#include /* * AUXILIARY CLASSES AND FUNCTIONS diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h index 70db25837e9..6fecb592a12 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h @@ -196,7 +196,7 @@ private: size_type index_of_content_root; size_type mult_of_prim_lcoeff_root; size_type index_of_prim_lcoeff_root; - boost::optional stack; + std::optional stack; }; // Functor to get the X_coordinate of an Event_coordinate @@ -210,14 +210,14 @@ private: //! The object holding the information about events, as an optional - mutable boost::optional > + mutable std::optional > event_coordinates; //! The algebraic kernel to use Algebraic_kernel_with_analysis_2* _m_kernel; //! The polynomial defining the curve - boost::optional f; + std::optional f; //! How degenerate situations are handled CGAL::Degeneracy_strategy degeneracy_strategy; @@ -230,24 +230,24 @@ private: * \c f/cont(f). The corresponding curve is equal to the curve of \c f, * only without vertical line components. */ - mutable boost::optional f_primitive; + mutable std::optional f_primitive; //! the polynomial containing all roots of the resultant of the primitive //! part of f and its y-derivative - mutable boost::optional + mutable std::optional resultant_of_primitive_and_derivative_y; //! the polynomial containing all roots of the resultant of the primitive //! part of f and its x-derivative - mutable boost::optional + mutable std::optional resultant_of_primitive_and_derivative_x; //! The Sturm-Habicht polynomials of f - mutable boost::optional > + mutable std::optional > sturm_habicht_of_primitive; //! The content of f - mutable boost::optional content; + mutable std::optional content; //! The non-working shear factors, as far as known mutable std::set bad_shears; @@ -256,10 +256,10 @@ private: mutable std::map sheared_curves; //! Has the curve vertical line components - mutable boost::optional has_vertical_component; + mutable std::optional has_vertical_component; //! The intermediate values - mutable boost::optional > > + mutable std::optional > > intermediate_values; //! stores Y_values at rational coordinate @@ -272,7 +272,7 @@ private: * are asymptotic to y=beta, * or go to +/- infty also in y-direction */ - mutable boost::optional > + mutable std::optional > horizontal_asymptotes_left, horizontal_asymptotes_right; //! friends @@ -546,7 +546,7 @@ private: if(! this->ptr()->intermediate_values) { this->ptr()->intermediate_values - = std::vector > + = std::vector > (number_of_status_lines_with_event()+1); } @@ -583,7 +583,7 @@ public: */ void set_f(Polynomial_2 f) { CGAL_precondition(! has_defining_polynomial()); - if((! this->ptr()->f) || f!=this->ptr()->f.get()) { + if((! this->ptr()->f) || f!=this->ptr()->f.value()) { this->copy_on_write(); this->ptr()->f=f; } @@ -630,7 +630,7 @@ public: event_coordinates(); CGAL_assertion(this->ptr()->has_vertical_component); } - return this->ptr()->has_vertical_component.get(); + return this->ptr()->has_vertical_component.value(); } public: @@ -638,7 +638,7 @@ public: //! Returns the defining polynomial Polynomial_2 polynomial_2() const { CGAL_precondition(bool(this->ptr()->f)); - return this->ptr()->f.get(); + return this->ptr()->f.value(); } public: @@ -713,8 +713,8 @@ public: = event_line; event_coordinates()[i].stack = event_line; } - CGAL_postcondition(event_coordinates()[i].stack.get().is_event()); - return event_coordinates()[i].stack.get(); + CGAL_postcondition(event_coordinates()[i].stack.value().is_event()); + return event_coordinates()[i].stack.value(); } public: @@ -1348,7 +1348,7 @@ public: } } } - return intermediate_values()[i].get(); + return intermediate_values()[i].value(); } @@ -1369,7 +1369,7 @@ public: if(! this->ptr()->content) { compute_content_and_primitive_part(); } - return this->ptr()->content.get(); + return this->ptr()->content.value(); } public: @@ -1388,7 +1388,7 @@ public: if(! this->ptr()->f_primitive) { compute_content_and_primitive_part(); } - return this->ptr()->f_primitive.get(); + return this->ptr()->f_primitive.value(); } Algebraic_kernel_with_analysis_2* kernel() const { @@ -1436,7 +1436,7 @@ private: if(! this->ptr()->sturm_habicht_of_primitive) { compute_sturm_habicht_of_primitive(); } - return this->ptr()->sturm_habicht_of_primitive.get(); + return this->ptr()->sturm_habicht_of_primitive.value(); } public: @@ -1557,7 +1557,7 @@ private: if(! this->ptr()->resultant_of_primitive_and_derivative_y) { this->ptr()->resultant_of_primitive_and_derivative_y = stha[0][0]; if(this->ptr()->resultant_of_primitive_and_derivative_y. - get().is_zero()) { + value().is_zero()) { throw internal::Zero_resultant_exception (polynomial_2()); } @@ -1581,7 +1581,7 @@ private: if(! this->ptr()->resultant_of_primitive_and_derivative_y) { compute_resultant_of_primitive_and_derivative_y(); } - return this->ptr()->resultant_of_primitive_and_derivative_y.get(); + return this->ptr()->resultant_of_primitive_and_derivative_y.value(); } private: @@ -1592,7 +1592,7 @@ private: if(! this->ptr()->resultant_of_primitive_and_derivative_x) { compute_resultant_of_primitive_and_derivative_x(); } - return this->ptr()->resultant_of_primitive_and_derivative_x.get(); + return this->ptr()->resultant_of_primitive_and_derivative_x.value(); } private: @@ -1713,20 +1713,20 @@ private: if(! this->ptr()->event_coordinates) { compute_event_coordinates(); } - return this->ptr()->event_coordinates.get(); + return this->ptr()->event_coordinates.value(); } private: // Returns the intermediate values for intervals between events - std::vector >& intermediate_values() const + std::vector >& intermediate_values() const { if(! this->ptr()->intermediate_values) { // This is created during event_coordiantes() event_coordinates(); CGAL_assertion(bool(this->ptr()->intermediate_values)); } - return this->ptr()->intermediate_values.get(); + return this->ptr()->intermediate_values.value(); } @@ -1915,7 +1915,7 @@ private: static_cast(content_roots.size())); this->ptr()->intermediate_values - = std::vector > + = std::vector > (event_coordinate_vector.size()+1); this->ptr()->event_coordinates = event_coordinate_vector; @@ -2110,7 +2110,7 @@ public: compute_horizontal_asymptotes(); } std::vector& asym_info - = this->ptr()->horizontal_asymptotes_left.get(); + = this->ptr()->horizontal_asymptotes_left.value(); CGAL_precondition(arcno>=0 && arcno(asym_info.size())); return asym_info[arcno]; @@ -2120,7 +2120,7 @@ public: compute_horizontal_asymptotes(); } std::vector& asym_info - = this->ptr()->horizontal_asymptotes_right.get(); + = this->ptr()->horizontal_asymptotes_right.value(); CGAL_precondition(arcno>=0 && arcno(asym_info.size())); return asym_info[arcno]; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h index 05b97af9bcd..868da2d3c9a 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -136,9 +136,9 @@ public: typedef std::vector Slice_info; - typedef boost::optional Lazy_slice_info; + typedef std::optional Lazy_slice_info; - typedef boost::optional Lazy_bound; + typedef std::optional Lazy_bound; typedef CGAL::internal::Event_indices Event_indices; @@ -151,11 +151,11 @@ public: typedef std::vector > Intersection_info_container; - typedef boost::optional + typedef std::optional Lazy_intersection_info_container; // For lazy evaluation of Status_line_CPA_1s. - typedef boost::optional Lazy_status_line_CPA_1; + typedef std::optional Lazy_status_line_CPA_1; //! @} @@ -191,31 +191,31 @@ private: Polynomial_2 g; - mutable boost::optional > subresultants; + mutable std::optional > subresultants; - mutable boost::optional > + mutable std::optional > principal_subresultants; - mutable boost::optional > + mutable std::optional > coprincipal_subresultants; - mutable boost::optional resultant; + mutable std::optional resultant; - mutable boost::optional > resultant_roots; - mutable boost::optional > + mutable std::optional > resultant_roots; + mutable std::optional > event_x_coordinates; - mutable boost::optional > + mutable std::optional > multiplicities_of_resultant_roots; - mutable boost::optional > stripe_values; + mutable std::optional > stripe_values; mutable std::vector< Lazy_status_line_CPA_1 > event_slices; - mutable boost::optional > intermediate_values; + mutable std::optional > intermediate_values; - mutable boost::optional< std::vector< Lazy_status_line_CPA_1 > > + mutable std::optional< std::vector< Lazy_status_line_CPA_1 > > intermediate_slices; - mutable boost::optional > event_indices; + mutable std::optional > event_indices; mutable Lazy_intersection_info_container intersection_info_container; @@ -530,7 +530,7 @@ private: /* * \brief Computes the intermediate x-coordinates and their status lines * - * In fact, it only fills the data fields with boost::none instances, + * In fact, it only fills the data fields with std::nullopt instances, * according to the lazy philosophy of the whole class. */ void compute_intermediate_values_and_slices() const; @@ -547,7 +547,7 @@ public: compute_resultant(); } CGAL_assertion(bool(this->ptr()->resultant)); - return this->ptr()->resultant.get(); + return this->ptr()->resultant.value(); } std::vector& resultant_roots() const { @@ -555,7 +555,7 @@ public: compute_resultant_roots_with_multiplicities(); } CGAL_assertion(bool(this->ptr()->resultant_roots)); - return this->ptr()->resultant_roots.get(); + return this->ptr()->resultant_roots.value(); } Algebraic_real_1& resultant_roots(size_type i) const { @@ -569,7 +569,7 @@ public: compute_resultant_roots_with_multiplicities(); } CGAL_assertion(bool(this->ptr()->multiplicities_of_resultant_roots)); - return this->ptr()->multiplicities_of_resultant_roots.get(); + return this->ptr()->multiplicities_of_resultant_roots.value(); } size_type multiplicities_of_resultant_roots(size_type i) const { @@ -586,10 +586,10 @@ public: (kernel(), resultant_roots().begin(), resultant_roots().end(), - std::back_inserter(this->ptr()->stripe_values.get())); + std::back_inserter(this->ptr()->stripe_values.value())); } CGAL_assertion(bool(this->ptr()->stripe_values)); - return this->ptr()->stripe_values.get(); + return this->ptr()->stripe_values.value(); } std::vector& event_x_coordinates() const { @@ -597,7 +597,7 @@ public: compute_event_x_coordinates_with_event_indices(); } CGAL_assertion(bool(this->ptr()->event_x_coordinates)); - return this->ptr()->event_x_coordinates.get(); + return this->ptr()->event_x_coordinates.value(); } std::vector& event_indices() const { @@ -605,7 +605,7 @@ public: compute_event_x_coordinates_with_event_indices(); } CGAL_assertion(bool(this->ptr()->event_indices)); - return this->ptr()->event_indices.get(); + return this->ptr()->event_indices.value(); } public: @@ -613,7 +613,7 @@ public: /* * \brief returns the indices of the ith event value * - * Returns a Event_indices (fg,ffy,ggy) such that + * Returns an `Event_indices` (fg,ffy,ggy) such that * the ith event root is the fgth root of the * resultant of \c f and \c g, the ffyth root of the * discriminant of \c f, and the ggyth root of the @@ -633,7 +633,7 @@ private: compute_intermediate_values_and_slices(); } CGAL_assertion(bool(this->ptr()->intermediate_values)); - return this->ptr()->intermediate_values.get(); + return this->ptr()->intermediate_values.value(); } std::vector& intermediate_slices() const { @@ -641,7 +641,7 @@ private: compute_intermediate_values_and_slices(); } CGAL_assertion(bool(this->ptr()->intermediate_slices)); - return this->ptr()->intermediate_slices.get(); + return this->ptr()->intermediate_slices.value(); } @@ -652,7 +652,7 @@ private: compute_subresultants(); } CGAL_assertion(bool(this->ptr()->subresultants)); - return this->ptr()->subresultants.get(); + return this->ptr()->subresultants.value(); } Polynomial_2& subresultants(size_type i) const { @@ -666,7 +666,7 @@ private: compute_subresultants(); } CGAL_assertion(bool(this->ptr()->principal_subresultants)); - return this->ptr()->principal_subresultants.get(); + return this->ptr()->principal_subresultants.value(); } Polynomial_1& principal_subresultants(size_type i) const { @@ -681,7 +681,7 @@ private: compute_subresultants(); } CGAL_assertion(bool(this->ptr()->coprincipal_subresultants)); - return this->ptr()->coprincipal_subresultants.get(); + return this->ptr()->coprincipal_subresultants.value(); } Polynomial_1& coprincipal_subresultants(size_type i) const { @@ -1030,7 +1030,7 @@ public: this->ptr()->event_slices[i] = create_event_slice(i); } CGAL_assertion(bool(this->ptr()->event_slices[i])); - return this->ptr()->event_slices[i].get(); + return this->ptr()->event_slices[i].value(); } @@ -1045,7 +1045,7 @@ public: } - return intermediate_slices()[i].get(); + return intermediate_slices()[i].value(); } //! Returns bound representative value at the ith interval @@ -1074,7 +1074,7 @@ public: } } CGAL_assertion(bool(intermediate_values()[i])); - return intermediate_values()[i].get(); + return intermediate_values()[i].value(); } @@ -1312,11 +1312,11 @@ void Curve_pair_analysis_2::compute_resultant() compute_subresultants(); this->ptr()->resultant - = this->ptr()->principal_subresultants.get()[0]; + = this->ptr()->principal_subresultants.value()[0]; } - if(this->ptr()->resultant.get().is_zero()) { + if(this->ptr()->resultant.value().is_zero()) { throw CGAL::internal::Zero_resultant_exception (this->ptr()->f, this->ptr()->g); @@ -1345,8 +1345,8 @@ compute_resultant_roots_with_multiplicities() const { solve_1(resultant(), std::back_inserter(res_pairs)); for(int i=0; i < static_cast(res_pairs.size()); i++ ) { - this->ptr()->resultant_roots.get().push_back(res_pairs[i].first); - this->ptr()->multiplicities_of_resultant_roots.get() + this->ptr()->resultant_roots.value().push_back(res_pairs[i].first); + this->ptr()->multiplicities_of_resultant_roots.value() .push_back(res_pairs[i].second); } @@ -1357,13 +1357,13 @@ compute_resultant_roots_with_multiplicities() const { #if CGAL_ACK_DEBUG_FLAG for(size_type i = 0; i - (this->ptr()->resultant_roots.get().size()); + (this->ptr()->resultant_roots.value().size()); i++) { CGAL_ACK_DEBUG_PRINT << "Root at " - << CGAL::to_double(this->ptr()->resultant_roots.get()[i]) + << CGAL::to_double(this->ptr()->resultant_roots.value()[i]) << " with multiplicity " - << this->ptr()->multiplicities_of_resultant_roots.get()[i] + << this->ptr()->multiplicities_of_resultant_roots.value()[i] << std::endl; } #endif @@ -1401,18 +1401,18 @@ compute_event_x_coordinates_with_event_indices() const { one_curve_events.end(), resultant_roots().begin(), resultant_roots().end(), - std::back_inserter(this->ptr()->event_x_coordinates.get()), + std::back_inserter(this->ptr()->event_x_coordinates.value()), std::back_inserter(events_type), compare); std::vector& events - = this->ptr()->event_x_coordinates.get(); + = this->ptr()->event_x_coordinates.value(); typename std::vector::iterator one_curve_it =one_curve_events_type.begin(); size_type inter_count=0, f_count=0,g_count=0; this->ptr()->event_indices = std::vector(); std::vector& event_indices - = this->ptr()->event_indices.get(); + = this->ptr()->event_indices.value(); for(size_type i=0;i(events.size());i++) { /* #if CGAL_ACK_DEBUG_FLAG @@ -1519,8 +1519,8 @@ compute_intermediate_values_and_slices() const { std::size_t size = event_x_coordinates().size()+1; this->ptr()->intermediate_values=std::vector(); this->ptr()->intermediate_slices=std::vector(); - this->ptr()->intermediate_values.get().resize(size); - this->ptr()->intermediate_slices.get().resize(size); + this->ptr()->intermediate_values.value().resize(size); + this->ptr()->intermediate_slices.value().resize(size); #if CGAL_ACK_DEBUG_FLAG CGAL_ACK_DEBUG_PRINT << "done" << std::endl; #endif @@ -1539,25 +1539,25 @@ compute_subresultants() const { if(CGAL::degree(f,1)ptr()->subresultants.get())); + (g,f,std::back_inserter(this->ptr()->subresultants.value())); #else typename CGAL::Polynomial_traits_d ::Polynomial_subresultants() - (g,f,std::back_inserter(this->ptr()->subresultants.get())); + (g,f,std::back_inserter(this->ptr()->subresultants.value())); #endif } else { #if CGAL_ACK_USE_BEZOUT_MATRIX_FOR_SUBRESULTANTS CGAL::internal::bezout_polynomial_subresultants - (f,g,std::back_inserter(this->ptr()->subresultants.get())); + (f,g,std::back_inserter(this->ptr()->subresultants.value())); #else typename CGAL::Polynomial_traits_d ::Polynomial_subresultants() - (f,g,std::back_inserter(this->ptr()->subresultants.get())); + (f,g,std::back_inserter(this->ptr()->subresultants.value())); #endif } std::vector& subresultants - = this->ptr()->subresultants.get(); + = this->ptr()->subresultants.value(); size_type n = static_cast(subresultants.size()); @@ -1584,11 +1584,11 @@ compute_subresultants() const { // This must be corrected, if f and g have same degree: if(CGAL::degree(f,1) == CGAL::degree(g,1)) { if(n>=1) { - this->ptr()->principal_subresultants.get()[n-1] + this->ptr()->principal_subresultants.value()[n-1] = Polynomial_1(CGAL::leading_coefficient(g)); } if(n>=2) { - this->ptr()->coprincipal_subresultants.get()[n-2] + this->ptr()->coprincipal_subresultants.value()[n-2] = Polynomial_1(g[CGAL::degree(g,1)-1]); } } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h index 2bd1c6515c1..a8ecf22eac1 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h @@ -127,7 +127,7 @@ public: //Arc_pair _m_num_arcs; //! sequence of arcs crossing this status line (valid only event lines) - mutable boost::optional _m_arcs; + mutable std::optional _m_arcs; //! number of arcs intersecting this status line mutable int _m_total_arcs; @@ -160,10 +160,10 @@ public: std::vector< int > multiplicities_;*/ // stores algebraic real over the vertical line - mutable std::vector >_m_xy_coords; + mutable std::vector >_m_xy_coords; // stores the isolator instance - mutable boost::optional isolator; + mutable std::optional isolator; // befriending the handle friend class Status_line_CA_1; @@ -555,7 +555,7 @@ public: //! Returns the isolator instance Bitstream_descartes& isolator() const { CGAL_assertion(bool(this->ptr()->isolator)); - return this->ptr()->isolator.get(); + return this->ptr()->isolator.value(); } //! Returns whether an isolator has been given for that status line diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h index 26fb94416d1..c3fb08048e7 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h @@ -75,7 +75,7 @@ public: // represents x-coordinate of event of rational value over interval // computed only by demand - mutable boost::optional _m_x; + mutable std::optional _m_x; // for each event point stores a pair of arcnos of the 1st and 2nd curve // or -1 if respective curve is not involved diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h index 81a74c56c38..77afa52cd80 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h @@ -81,10 +81,10 @@ public: mutable int _m_arcno; // y-coordinate - mutable boost::optional< Algebraic_real_1 > _m_y; + mutable std::optional< Algebraic_real_1 > _m_y; //! A bounding box for the given point - mutable boost::optional< std::pair > _m_bbox_2_pair; + mutable std::optional< std::pair > _m_bbox_2_pair; }; @@ -254,7 +254,7 @@ public: /*! * \brief y-coordinate of this point * - * Note: In general, this method results in a extremely large polynomial + * Note: In general, this method results in an extremely large polynomial * for the y-coordinate. It is recommended to use it carefully, * and using get_approximation_y() instead whenever approximations suffice. */ diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h index 728cb446934..6d77e38f904 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h @@ -167,7 +167,7 @@ class Lazy_alpha_nt_2 //members //the members can be updated when calling method exact() - mutable boost::optional exact_; + mutable std::optional exact_; mutable NT_approx approx_; //private functions @@ -235,7 +235,7 @@ public: const NT_exact& exact() const { - if (exact_ == boost::none) { + if (exact_ == std::nullopt) { update_exact(); approx_=to_interval(*exact_); } diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h index d753b2457cb..219c307815a 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -158,7 +158,7 @@ class Lazy_alpha_nt_3{ //members //the members can be updated when calling method exact() - mutable boost::optional exact_; + mutable std::optional exact_; mutable NT_approx approx_; //private functions @@ -229,7 +229,7 @@ public: } const NT_exact& exact() const { - if (exact_ == boost::none){ + if (exact_ == std::nullopt){ update_exact(); approx_=to_interval(*exact_); } diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_2.h b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_2.h index bf41824e4a4..13d9c23d806 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_2.h +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_2.h @@ -608,24 +608,22 @@ Vertex_handle nearest_neighbor(const Point_2& p, Vertex_handle vnear) const; /*! Returns the dual corresponding to the face handle `f`. The returned object can -be assignable to one of the following: `Site_2`, `Gt::Line_2`. +be assigned to one of the following: `Site_2`, `Gt::Line_2`. */ Gt::Object_2 dual(Face_handle f) const; /*! Returns the dual of the face to which `it` points to. The returned object can -be assignable to one of the following: `Site_2`, `Gt::Line_2`. +be assigned to one of the following: `Site_2`, `Gt::Line_2`. */ Gt::Object_2 dual(All_faces_iterator it) const; /*! Returns -the dual of the face to which `it` points to. The returned -object can be assignable to one of the following: `Site_2`, -`Gt::Line_2`. +the dual of the face to which `it` points to. */ -Gt::Object_2 dual(Finite_faces_iterator it) const; +Site dual(Finite_faces_iterator it) const; /// @} diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_vertex_base_2.h b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_vertex_base_2.h index ae9eca3dc6e..3bf702d3afd 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_vertex_base_2.h +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_vertex_base_2.h @@ -7,9 +7,12 @@ namespace CGAL { The class `Apollonius_graph_vertex_base_2` provides a model for the `ApolloniusGraphVertexBase_2` concept which is the vertex base required by the `ApolloniusGraphDataStructure_2` concept. The -class `Apollonius_graph_vertex_base_2` has two template arguments, the first being the -geometric traits of the Apollonius graph and should be a model of the -concept `ApolloniusGraphTraits_2`. The second is a Boolean which +class `Apollonius_graph_vertex_base_2` has three template arguments. + +\tparam Gt is the geometric traits of the Apollonius graph and must be a model of the +concept `ApolloniusGraphTraits_2`. + +\tparam StoreHidden is a Boolean which controls whether hidden sites are actually stored. Such a control is important if the user is not interested in hidden sites and/or if only insertions are made, in which case no hidden @@ -17,13 +20,17 @@ site can become visible. If `StoreHidden` is set to `true`, hidden sites are stored, otherwise they are discarded. By default `StoreHidden` is set to `true`. +\tparam Vb must be a model of the concept `TriangulationDSVertexBase_2` +By default this parameter is +instantiated by `Triangulation_ds_vertex_base_2<>`. + \cgalModels `ApolloniusGraphVertexBase_2` \sa `CGAL::Triangulation_data_structure_2` \sa `CGAL::Apollonius_graph_hierarchy_vertex_base_2` */ -template< typename Gt, typename StoreHidden > -class Apollonius_graph_vertex_base_2 { +template< typename Gt, typename StoreHidden, typename Vb > +class Apollonius_graph_vertex_base_2 : public Vb { public: /// \name Creation diff --git a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.cpp b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.cpp index 8a2bb5dd03c..a1032551da2 100644 --- a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.cpp +++ b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.cpp @@ -18,7 +18,7 @@ char * Option_parser::s_strategy_opts[] = { }; template -void Option_parser::my_validate(boost::any & v, +void Option_parser::my_validate(std::any & v, const std::vector & values) { typedef std::vector Vector_id; @@ -28,11 +28,11 @@ void Option_parser::my_validate(boost::any & v, if (v.empty()) { Vector_id vec; vec.push_back(MyId(i)); - v = boost::any(vec); + v = std::any(vec); } else { - Vector_id vec = boost::any_cast(v); + Vector_id vec = std::any_cast(v); vec.push_back(MyId(i)); - v = boost::any(vec); + v = std::any(vec); } return; } @@ -41,14 +41,14 @@ void Option_parser::my_validate(boost::any & v, } /* Overload the 'validate' function for the user-defined class */ -void validate(boost::any & v, const std::vector & values, +void validate(std::any & v, const std::vector & values, Option_parser::Vector_type_id * target_type, int) { Option_parser::my_validate(v, values); } /* Overload the 'validate' function for the user-defined class */ -void validate(boost::any & v, const std::vector & values, +void validate(std::any & v, const std::vector & values, Option_parser::Vector_strategy_id * target_type, int) { Option_parser::my_validate(v, values); diff --git a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.hpp b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.hpp index 4fcfc0aafd6..a20f3b804c2 100644 --- a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.hpp +++ b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/Option_parser.hpp @@ -124,7 +124,7 @@ public: unsigned int get_height() const { return m_win_height; } template - static void my_validate(boost::any & v, + static void my_validate(std::any & v, const std::vector & values); protected: diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.cpp index d54d5242074..357a0ba88e3 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.cpp @@ -135,7 +135,7 @@ static inline bool hasValidChars(const std::string& expression, int dimension) } template -boost::optional +std::optional AlgebraicCurveParser::operator()(const std::string& expression) { using Traits = CGAL::Polynomial_traits_d; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.h index 5e8ac4b0fd2..b282d228516 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/AlgebraicCurveParser.h @@ -22,12 +22,12 @@ #include #include -#include +#include template struct AlgebraicCurveParser { - boost::optional operator()(const std::string& expression); + std::optional operator()(const std::string& expression); }; #endif //ARRANGEMENT_ON_SURFACE_2_DEMO_ALGEBRAICCURVEPARSERNEW_H diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp index 86ad76fe086..d8573dfa0cb 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp @@ -961,15 +961,16 @@ findOtherInterestingPoints const CGAL::Bbox_2& allowable_range) { using Traits = demo_types::DemoTypes::Alg_seg_traits; CGAL::Bbox_2 bb = {}; - std::vector intersections; + typedef std::pair Pt_m; + std::vector intersections; for (auto it = arr->edges_begin(); it != arr->edges_end(); ++it) { for (auto& arc : getXyCurves(arr->traits())) + { if (arc.is_vertical() != it->curve().is_vertical()) - it->curve().intersections(arc, std::back_inserter(intersections)); + it->curve().intersections(arc, CGAL::dispatch_or_drop_output(std::back_inserter(intersections))); + } } - for (auto it = intersections.begin(); it != intersections.end(); it++) { - std::pair point_multiplicity; - CGAL::assign(point_multiplicity, *it); + for (auto point_multiplicity :intersections) { auto& point = point_multiplicity.first; if (point.location() == CGAL::ARR_INTERIOR) { auto xy = point.to_double(); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp index 4e3cf4cd47a..4a23e6a3e45 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp @@ -227,7 +227,7 @@ void EnvelopeCallback< Arr_>::updateEnvelope( bool lower ) { if (!e->is_empty()) { - boost::optional leftPoint, rightPoint; + std::optional leftPoint, rightPoint; if (e->left()) leftPoint = e->left()->point(); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp index 9505c6161e7..47729a77ef3 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp @@ -123,7 +123,7 @@ void GraphicsViewCurveInput::generate(CGAL::Object o) { template void GraphicsViewCurveInput:: curveInputDoneEvent(const std::vector& clickedPoints, CurveType type) { - boost::optional cv = + std::optional cv = this->curveGenerator.generate(clickedPoints, type); if (cv) { Insert_curve{}(this->arrangement, *cv); @@ -135,9 +135,9 @@ curveInputDoneEvent(const std::vector& clickedPoints, CurveType type) { template auto CurveGeneratorBase:: generate(const std::vector& clickedPoints, CurveType type) - -> boost::optional + -> std::optional { - boost::optional res; + std::optional res; switch (type) { case CurveType::Segment: res = generateSegment(clickedPoints); @@ -180,7 +180,7 @@ void CurveGeneratorBase::setTraits(const ArrTraits* traits_) template auto CurveGenerator>:: generateSegment(const std::vector& clickedPoints) - -> boost::optional + -> std::optional { Curve_2 res{clickedPoints[0], clickedPoints[1]}; return res; @@ -190,7 +190,7 @@ generateSegment(const std::vector& clickedPoints) template auto CurveGenerator>:: generatePolyline(const std::vector& clickedPoints) - -> boost::optional + -> std::optional { if (clickedPoints.size() < 2) return {}; @@ -202,7 +202,7 @@ auto CurveGenerator>:: // Curve Generator Linear Traits template auto CurveGenerator>:: -generateSegment(const std::vector& points) -> boost::optional +generateSegment(const std::vector& points) -> std::optional { Curve_2 res = Curve_2(Segment_2(points[0], points[1])); return res; @@ -211,7 +211,7 @@ generateSegment(const std::vector& points) -> boost::optional // template auto CurveGenerator>:: -generateRay(const std::vector& points) -> boost::optional { +generateRay(const std::vector& points) -> std::optional { Curve_2 res = Curve_2(Ray_2(points[0], points[1])); return res; } @@ -219,7 +219,7 @@ generateRay(const std::vector& points) -> boost::optional { // template auto CurveGenerator>:: -generateLine(const std::vector& points) -> boost::optional { +generateLine(const std::vector& points) -> std::optional { Curve_2 res = Curve_2(Line_2(points[0], points[1])); return res; } @@ -228,7 +228,7 @@ generateLine(const std::vector& points) -> boost::optional { template auto CurveGenerator>:: generateSegment(const std::vector& points) - -> boost::optional + -> std::optional { auto ctr_cv = this->traits->construct_curve_2_object(); Curve_2 res = ctr_cv(Rat_segment_2(points[0], points[1])); @@ -238,7 +238,7 @@ generateSegment(const std::vector& points) // template auto CurveGenerator>:: -generateCircle(const std::vector& points) -> boost::optional { +generateCircle(const std::vector& points) -> std::optional { auto sq_rad = (points[0].x() - points[1].x()) * (points[0].x() - points[1].x()) + (points[0].y() - points[1].y()) * (points[0].y() - points[1].y()); @@ -251,7 +251,7 @@ generateCircle(const std::vector& points) -> boost::optional { template auto CurveGenerator>:: generateEllipse(const std::vector& points) - -> boost::optional + -> std::optional { auto x1 = (CGAL::min)(points[0].x(), points[1].x()); auto y1 = (CGAL::min)(points[0].y(), points[1].y()); @@ -281,7 +281,7 @@ generateEllipse(const std::vector& points) template auto CurveGenerator>:: generateThreePointCircularArc(const std::vector& points) - -> boost::optional + -> std::optional { auto& qp1 = points[0]; auto& qp2 = points[1]; @@ -305,7 +305,7 @@ generateThreePointCircularArc(const std::vector& points) template auto CurveGenerator>:: generateFivePointConicArc(const std::vector& points) - -> boost::optional + -> std::optional { auto& qp0 = points[0]; auto& qp1 = points[1]; @@ -333,7 +333,7 @@ generateFivePointConicArc(const std::vector& points) // CurveGenerator Algebraic Traits template auto CurveGenerator>:: -generateLine(const std::vector& points) -> boost::optional { +generateLine(const std::vector& points) -> std::optional { RationalTraits ratTraits; Rational dx = points[1].x() - points[0].x(); @@ -369,7 +369,7 @@ generateLine(const std::vector& points) -> boost::optional { // template auto CurveGenerator>:: -generateCircle(const std::vector& points) -> boost::optional { +generateCircle(const std::vector& points) -> std::optional { auto sq_rad = (points[0].x() - points[1].x()) * (points[0].x() - points[1].x()) + (points[0].y() - points[1].y()) * (points[0].y() - points[1].y()); @@ -379,7 +379,7 @@ generateCircle(const std::vector& points) -> boost::optional { template auto CurveGenerator>:: generateEllipse(const std::vector& points) - -> boost::optional + -> std::optional { auto rx = (points[0].x() - points[1].x()) * (points[0].x() - points[1].x()) / 4.; @@ -394,7 +394,7 @@ generateEllipse(const std::vector& points) template auto CurveGenerator>:: generateEllipse_(const Point_2& center, Rational rxRat, Rational ryRat) - -> boost::optional + -> std::optional { RationalTraits ratTraits; @@ -428,7 +428,7 @@ template >:: generateBezier(const std::vector& clickedPoints) - -> boost::optional + -> std::optional { if (clickedPoints.size() < 2) return {}; return Curve_2{clickedPoints.begin(), clickedPoints.end()}; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInputTyped.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInputTyped.h index 2b4a68457f8..91f9cfd8109 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInputTyped.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInputTyped.h @@ -42,34 +42,34 @@ public: void setTraits(const ArrTraits* traits_); - boost::optional + std::optional generate(const std::vector& clickedPoints, CurveType type); - virtual boost::optional + virtual std::optional generateSegment(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateRay(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateLine(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generatePolyline(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateCircle(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateEllipse(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateThreePointCircularArc(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateFivePointConicArc(const std::vector&) { return {}; } - virtual boost::optional + virtual std::optional generateBezier(const std::vector&) { return {}; } const ArrTraits* traits; @@ -91,7 +91,7 @@ struct CurveGenerator> : using Super = CurveGeneratorBase; using Point_2 = typename Super::Point_2; - boost::optional + std::optional generateSegment(const std::vector&) override; }; @@ -105,7 +105,7 @@ struct CurveGenerator> : using Super = CurveGeneratorBase; using Point_2 = typename Super::Point_2; - boost::optional + std::optional generatePolyline(const std::vector&) override; }; @@ -125,18 +125,18 @@ struct CurveGenerator> : using Super = CurveGeneratorBase; using Point_2 = typename Super::Point_2; - boost::optional + std::optional generateSegment(const std::vector&) override; - boost::optional generateCircle(const std::vector&) override; + std::optional generateCircle(const std::vector&) override; - boost::optional + std::optional generateEllipse(const std::vector&) override; - boost::optional + std::optional generateThreePointCircularArc(const std::vector&) override; - boost::optional + std::optional generateFivePointConicArc(const std::vector&) override; }; @@ -154,10 +154,10 @@ struct CurveGenerator> : using Super = CurveGeneratorBase; using Point_2 = typename Super::Point_2; - boost::optional + std::optional generateSegment(const std::vector&) override; - boost::optional generateRay(const std::vector&) override; - boost::optional generateLine(const std::vector&) override; + std::optional generateRay(const std::vector&) override; + std::optional generateLine(const std::vector&) override; }; template @@ -176,13 +176,13 @@ struct CurveGenerator> : using Super = CurveGeneratorBase; using Point_2 = typename Super::Point_2; - boost::optional generateLine(const std::vector&) override; - boost::optional generateCircle(const std::vector&) override; - boost::optional + std::optional generateLine(const std::vector&) override; + std::optional generateCircle(const std::vector&) override; + std::optional generateEllipse(const std::vector&) override; private: - boost::optional generateEllipse_(const Point_2&, Rational, Rational); + std::optional generateEllipse_(const Point_2&, Rational, Rational); }; template < @@ -199,7 +199,7 @@ struct CurveGenerator< using Point_2 = typename Super::Point_2; using Curve_2 = typename ArrTraits::Curve_2; - boost::optional generateBezier(const std::vector&) override; + std::optional generateBezier(const std::vector&) override; }; template diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.cpp index 9194c35a749..cefb4e8e5c0 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.cpp @@ -16,7 +16,7 @@ #include "ArrangementTypesUtils.h" #include "PointSnapper.h" -#include +#include template class PointSnapper : public PointSnapperBase @@ -26,7 +26,7 @@ class PointSnapper : public PointSnapperBase public: PointSnapper(QGraphicsScene*, GridGraphicsItem*, Arrangement*); - boost::optional snapToArrangement(const QPointF& qpt) override; + std::optional snapToArrangement(const QPointF& qpt) override; private: Arrangement* arr; @@ -170,7 +170,7 @@ PointSnapper::PointSnapper( } template -inline boost::optional snapToArrangement( +inline std::optional snapToArrangement( const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr) { using Point_2 = PointSnapperBase::Point_2; @@ -215,7 +215,7 @@ struct SnapToArrangement { using Point_2 = PointSnapperBase::Point_2; template - boost::optional + std::optional operator()(const QPointF& qpt, const QTransform&, Arrangement*) { return Point_2{qpt.x(), qpt.y()}; @@ -226,7 +226,7 @@ struct SnapToArrangement> { using Point_2 = PointSnapperBase::Point_2; template - boost::optional operator()( + std::optional operator()( const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr) { return snapToArrangement(qpt, worldTransform, arr); @@ -237,7 +237,7 @@ struct SnapToArrangement> { using Point_2 = PointSnapperBase::Point_2; template - boost::optional operator()( + std::optional operator()( const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr) { return snapToArrangement(qpt, worldTransform, arr); @@ -248,7 +248,7 @@ struct SnapToArrangement> { using Point_2 = PointSnapperBase::Point_2; template - boost::optional operator()( + std::optional operator()( const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr) { return snapToArrangement(qpt, worldTransform, arr); @@ -257,7 +257,7 @@ struct SnapToArrangement> template auto PointSnapper::snapToArrangement(const QPointF& qpt) - -> boost::optional + -> std::optional { using Traits = typename Arrangement::Geometry_traits_2; auto view = getView(); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.h index 9829f831f5d..2d2a186235e 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointSnapper.h @@ -50,7 +50,7 @@ public: protected: PointSnapperBase(QGraphicsScene* scene, GridGraphicsItem* grid); Point_2 snapToGrid(const QPointF& qpt); - virtual boost::optional snapToArrangement(const QPointF& qpt) = 0; + virtual std::optional snapToArrangement(const QPointF& qpt) = 0; GridGraphicsItem* gridGraphicsItem; bool snapToGridEnabled; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/IntersectCurves.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/IntersectCurves.cpp index f2d154c4eac..5e98113dabc 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/IntersectCurves.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/IntersectCurves.cpp @@ -11,6 +11,8 @@ #include "IntersectCurves.h" #include "ArrangementTypes.h" +#include + template Intersect_curves::Intersect_curves(const Traits* traits) : @@ -18,12 +20,26 @@ Intersect_curves::Intersect_curves(const Traits* traits) : { } +struct Object_putter +{ + std::reference_wrapper> v; + Object_putter(std::vector& v_) + : v(std::ref(v_)) + {} + + template + void operator()(const T& t) + { + v.get().push_back(make_object(t)); + } +}; + template void Intersect_curves::operator()( const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, std::vector& output) { - this->intersect(cv1, cv2, std::back_inserter(output)); + this->intersect(cv1, cv2, boost::make_function_output_iterator(Object_putter(output))); } ARRANGEMENT_DEMO_SPECIALIZE_TRAITS(Intersect_curves) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.cpp index 5a397f53bde..df21f6699ab 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.cpp @@ -391,8 +391,8 @@ Construct_x_monotone_subcurve_2::Construct_x_monotone_subcurve_2( // template auto Construct_x_monotone_subcurve_2::operator()( - const X_monotone_curve_2& curve, const boost::optional& pLeft, - const boost::optional& pRight) -> X_monotone_curve_2 + const X_monotone_curve_2& curve, const std::optional& pLeft, + const std::optional& pRight) -> X_monotone_curve_2 { Point_2 pMin, pMax; bool unbounded_min = false; @@ -442,8 +442,8 @@ template auto Construct_x_monotone_subcurve_2 >:: operator()(const X_monotone_curve_2& curve, - const boost::optional& pLeft, - const boost::optional& pRight) -> X_monotone_curve_2 + const std::optional& pLeft, + const std::optional& pRight) -> X_monotone_curve_2 { // TODO: handle when pLeft or pRight is null @@ -486,8 +486,8 @@ template >:: operator()( - const X_monotone_curve_2& curve, const boost::optional& pLeft, - const boost::optional& pRight) -> X_monotone_curve_2 + const X_monotone_curve_2& curve, const std::optional& pLeft, + const std::optional& pRight) -> X_monotone_curve_2 { auto pMin = this->construct_min_vertex_2(curve); auto pMax = this->construct_max_vertex_2(curve); @@ -545,8 +545,8 @@ template auto Construct_x_monotone_subcurve_2< CGAL::Arr_rational_function_traits_2>:: operator()( - const X_monotone_curve_2& curve, const boost::optional& pLeft, - const boost::optional& pRight) -> X_monotone_curve_2 + const X_monotone_curve_2& curve, const std::optional& pLeft, + const std::optional& pRight) -> X_monotone_curve_2 { Point_2 pMin, pMax; bool unbounded_min = false; @@ -625,14 +625,14 @@ operator()(const X_monotone_curve_2& curve, const CoordinateType& x, Point_2 p2c1(x, CoordinateType(clipRect.ymax() + 1)); const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1); - CGAL::Object o; - CGAL::Oneset_iterator oi(o); + std::vector pairs; - this->intersectCurves(curve, verticalLine, oi); + this->intersectCurves(curve, verticalLine, + CGAL::dispatch_or_drop_output(std::back_inserter(pairs))); IntersectionResult pair; - if (CGAL::assign(pair, o)) { - Point_2 pt = pair.first; + if (!pairs.empty()) { + Point_2 pt = pairs[0].first; res = pt.y(); } return res; @@ -654,14 +654,13 @@ operator()(const X_monotone_curve_2& curve, const CoordinateType& x, Point_2 p2c1(x, CoordinateType(10000000)); // upper bounding box const X_monotone_curve_2 verticalLine = ctr_xcv(p1c1, p2c1); - CGAL::Object o; - CGAL::Oneset_iterator oi(o); + std::vector pairs; - this->intersectCurves(curve, verticalLine, oi); + this->intersectCurves(curve, verticalLine, + CGAL::dispatch_or_drop_output(std::back_inserter(pairs))); - IntersectionResult pair; - if (CGAL::assign(pair, o)) { - Point_2 pt = pair.first; + if (!pairs.empty()) { + Point_2 pt = pairs[0].first; res = pt.y(); } return res; @@ -681,15 +680,15 @@ operator()(const X_monotone_curve_2& curve, const Coordinate_type& x) Point_2 p2c1(x, Coordinate_type(clip_rect.ymax() + 1)); const X_monotone_curve_2 vertical_line = ctr_xcv(p1c1, p2c1); - CGAL::Object o; - CGAL::Oneset_iterator oi(o); - this->intersect_curves(curve, vertical_line, oi); + std::vector pairs; + + this->intersect_curves(curve, vertical_line, + CGAL::dispatch_or_drop_output(std::back_inserter(pairs))); Coordinate_type res(0); - IntersectionResult pair; - if (CGAL::assign(pair, o)) { - Point_2 pt = pair.first; + if (!pairs.empty()) { + Point_2 pt = pairs[0].first; res = pt.y(); } return res; @@ -708,15 +707,15 @@ auto Arr_compute_y_at_x_2>:: operator()(const X_monotone_curve_2& curve, const CoordinateType& x) -> CoordinateType { - CGAL::Object o; - CGAL::Oneset_iterator oi(o); Intersect_2 intersect = traits->intersect_2_object(); X_monotone_curve_2 c2 = this->makeVerticalLine(x); - intersect(curve, c2, oi); - std::pair res; - if (CGAL::assign(res, o)) { + typedef std::pair PtM; + + std::vector res; + intersect(curve, c2, CGAL::dispatch_or_drop_output(std::back_inserter(res))); + if (!res.empty()) { // TODO: handle failure case - const Point_2& p = res.first; + const Point_2& p = res[0].first; CoordinateType coord = p.y(); return coord; } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.h index b0905210094..c0971f9d8ef 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils/Utils.h @@ -479,8 +479,8 @@ public: * projection. */ X_monotone_curve_2 operator()(const X_monotone_curve_2& curve, - const boost::optional& pLeft, - const boost::optional& pRight); + const std::optional& pLeft, + const std::optional& pRight); protected: const ArrTraits* traits; @@ -524,8 +524,8 @@ public: /* Return the subcurve of curve bracketed by pLeft and pRight. */ X_monotone_curve_2 operator()(const X_monotone_curve_2& curve, - const boost::optional& pLeft, - const boost::optional& pRight ); + const std::optional& pLeft, + const std::optional& pRight ); private: const Traits& m_traits; @@ -558,8 +558,8 @@ public: Return the subcurve of curve bracketed by pLeft and pRight. */ X_monotone_curve_2 operator()(const X_monotone_curve_2& curve, - const boost::optional& pLeft, - const boost::optional& pRight); + const std::optional& pLeft, + const std::optional& pRight); protected: const ArrTraits* traits; @@ -600,8 +600,8 @@ public: * projection. */ X_monotone_curve_2 operator()(const X_monotone_curve_2& curve, - const boost::optional& pLeft, - const boost::optional& pRight); + const std::optional& pLeft, + const std::optional& pRight); protected: const Traits* traits; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index 62571bfdee9..5254543120c 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -1320,7 +1320,7 @@ Arrangement_on_surface_2::Face_const_handle `Face_const_handle`\endlink. Depending on whether the query point is located inside a face, lies on an edge, or coincides with a vertex, the appropriate handle can be obtained with value retrieval -by `boost::get` as demonstrated in the example below. +by `std::get` as demonstrated in the example below. Note that the handles returned by the \link ArrangementPointLocation_2::locate() `locate()`\endlink functions are @@ -1361,7 +1361,7 @@ The function template `locate_point()` calls an instance of the function template `print_point_location()`, which inserts the result of the query into the standard output-stream. It is listed below, and defined in the header file `point_location_utils.h`. -Observe how the function `boost::get()` is used to cast the +Observe how the function `std::get()` is used to cast the resulting object into a handle to an arrangement feature. The point-location object `pl` is assumed to be already attached to an arrangement. @@ -1383,13 +1383,13 @@ void print_point_location const Face_const_handle* f; std::cout << "The point (" << q << ") is located "; - if (f = boost::get(&obj)) // located inside a face + if (f = std::get_if(&obj)) // located inside a face std::cout << "inside " << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") << " face.\n"; - else if (e = boost::get(&obj)) // located on an edge + else if (e = std::get_if(&obj)) // located on an edge std::cout << "on an edge: " << (*e)->curve() << std::endl; - else if (v = boost::get(&obj)) // located on a vertex + else if (v = std::get_if(&obj)) // located on a vertex std::cout << "on " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; else CGAL_error_msg("Invalid object."); @@ -1603,12 +1603,12 @@ void shoot_vertical_ray(const RayShoot& vrs, const Face_const_handle* f; std::cout << "Shooting up from (" << q << ") : "; - if (v = boost::get(&obj)) // we hit a vertex + if (v = std::get_if(&obj)) // we hit a vertex std::cout << "hit " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; - else if (e = boost::get(&obj)) // we hit an edge + else if (e = std::get_if(&obj)) // we hit an edge std::cout << "hit an edge: " << (*e)->curve() << std::endl; - else if (f = boost::get(&obj)) { // we hit nothing + else if (f = std::get_if(&obj)) { // we hit nothing CGAL_assertion((*f)->is_unbounded()); std::cout << "hit nothing.\n"; } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h index 82c932fca8b..bafb54b7db7 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h @@ -22,19 +22,7 @@ the output sequence. `std::pair::%Type>`. -\cgalHeading{A Note on Backwards Compatibility} -This function used to return `CGAL::Object` up to -\cgal version 4.2. Starting with \cgal version 4.3 the return type -is determined by the metafunction `CGAL::Arr_point_location_result`. -To preserve backwards compatibility -`CGAL::Object` can be constructed from the new return type -implicitly, but switching to the new style is recommended. To enable -the old style without any overhead, the macro -`::CGAL_ARR_POINT_LOCATION_VERSION` can be defined to 1 before any -\cgal header is included. - \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template` or `CGAL::Circular_arc_2`. -It uses the boost::variant. +It uses the std::variant. \cgalModels `ArrangementTraits_2` diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h index 92490f47f2a..96796cf5213 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h @@ -53,7 +53,6 @@ insertions of curves and not deletions of them. \sa `ArrangementPointLocation_2` \sa `ArrangementVerticalRayShoot_2` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template< typename Arrangement, typename Generator > diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h index 1ef49902c8c..b79e948e3e7 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h @@ -19,7 +19,6 @@ time-consuming process when applied to dense arrangements. \sa `ArrangementPointLocation_2` \sa `ArrangementVerticalRayShoot_2` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template< typename Arrangement > diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h index 20a6787d7e5..2a48e35b399 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h @@ -1,26 +1,3 @@ -/*! -\ingroup PkgArrangementOnSurface2PointLocation - -The macro `CGAL_ARR_POINT_LOCATION_VERSION` can be used to configure -the point-location query API. In particular, it determines which version -of the result type of the point-location and vertical ray-shooting queries -should be used by models of the concepts `ArrangementPointLocation_2` -and `ArrangementVerticalRayShoot_2`, and by the free function -`locate`. The `CGAL_ARR_POINT_LOCATION_VERSION` should be defined before any \cgal header -is included. - -- `CGAL_ARR_POINT_LOCATION_VERSION` == 1, the result type is set to be `CGAL::Object`. -- `CGAL_ARR_POINT_LOCATION_VERSION` == 2, the result type is set to be -`boost::variant`, where `Vertex_const_handle`, `Halfedge_const_handle`, and -`Face_const_handle` are the corresponding nested types in a `CGAL::Arrangement_2` instance. - - -\sa `ArrangementPointLocation_2` -\sa `ArrangementVerticalRayShoot_2` -\sa `CGAL::Arr_point_location_result` -*/ -#define CGAL_ARR_POINT_LOCATION_VERSION - namespace CGAL { /*! @@ -37,16 +14,13 @@ or vertical ray-shoot query. \sa `CGAL::Arr_walk_along_line_point_location` \sa `CGAL::Arr_landmarks_point_location` \sa `CGAL::Arr_trapezoid_ric_point_location` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template struct Arr_point_location_result { /*! The type of the arrangement feature that is the result of a * point-location query or a vertical ray-shoot query, namely, - * `boost::variant` - * if `::CGAL_ARR_POINT_LOCATION_VERSION` == 2, which is the default, otherwise - * `CGAL::Object`. + * `std::variant` */ typedef unspecified_type Type; }; /* end Arr_point_location_result */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h index e662503bee4..b8187252b1c 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h @@ -32,7 +32,6 @@ This strategy supports arbitrary subdivisions, including unbounded ones. \sa `ArrangementPointLocation_2` \sa `ArrangementVerticalRayShoot_2` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template< typename Arrangement > diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h index ed9c1e12e3d..4ad6dfeb8eb 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h @@ -21,7 +21,6 @@ namespace CGAL { * \sa `ArrangementPointLocation_2` * \sa `ArrangementVerticalRayShoot_2` * \sa `CGAL::Arr_point_location_result` - * \sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h index ed5df33be96..e6141a6779d 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h @@ -29,7 +29,6 @@ of issued queries is not large. \sa `ArrangementPointLocation_2` \sa `ArrangementVerticalRayShoot_2` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ template< typename Arrangement > diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h index 5e11e857548..bdf32267331 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h @@ -17,7 +17,7 @@ public: /*! computes the intersections of `xc1` and `xc2` and writes them in an * ascending lexicographic \f$xy\f$-order into a range beginning at * `oi`. The type `OutputIterator` must dereference a polymorphic object of - * type `boost::variant` that wraps objects of type either type + * type `std::variant` that wraps objects of type either type * `pair` or * `ArrTraits::X_monotone_curve_2`. An object of the former type represents an * intersection point with its multiplicity (in case the multiplicity is diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h index db0df3c8cc8..32c5efccb0b 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h @@ -16,7 +16,7 @@ public: /*! subdivides the input curve `c` into \f$x\f$-monotone subcurves and * isolated points, and inserts the results into a range beginning at the given * output iterator `oi`. The type `OutputIterator` dereferences a - * `boost::variant` that wraps either an `ArrTraits::Point_2` object or an + * `std::variant` that wraps either an `ArrTraits::Point_2` object or an * `ArrTraits::X_monotone_curve_2` object. The operator returns a past-the-end * iterator for the output sequence. */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h index c2f6a0437f2..b2fa1c3aae4 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h @@ -10,16 +10,6 @@ containing it. In the general case, the query point is contained inside an arrangement face, but in degenerate situations it may lie on an edge or coincide with an arrangement vertex. -\cgalHeading{A note on Backwards compatibility} -The `locate` member function used to return `CGAL::Object` up to -\cgal version 4.2. Starting with \cgal version 4.3 the return type -is determined by a metafunction. To preserve backwards compatibility -`CGAL::Object` can be constructed from the new return types -implicitly, but switching to the new style is recommended. To enable -the old style without any overhead, the macro -`CGAL_ARR_POINT_LOCATION_VERSION` can be defined to 1 before any -\cgal header is included. - \cgalHasModel `CGAL::Arr_naive_point_location` \cgalHasModel `CGAL::Arr_walk_along_line_point_location` \cgalHasModel `CGAL::Arr_trapezoid_ric_point_location` @@ -30,7 +20,6 @@ the old style without any overhead, the macro \sa `CGAL::Arr_trapezoid_ric_point_location` \sa `CGAL::Arr_landmarks_point_location` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h index 4a1febdc2d2..e676fefcf16 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h @@ -18,16 +18,6 @@ emanating from the query point goes to infinity without hitting any arrangement feature on its way. In this case the unbounded face is returned. -\cgalHeading{A Note on Backwards Compatibility} -The `ray_shoot_up` and `ray_shoot_down` member functions used -to return `CGAL::Object` up to \cgal version 4.2. Starting with -\cgal version 4.3 the return type is determined by a metafunction. To -preserve backwards compatibility `CGAL::Object` can be constructed -from the new return types implicitly, but switching to the new style -is recommended. To enable the old style without any overhead, the macro -`CGAL_ARR_POINT_LOCATION_VERSION` can be defined to 1 before any -\cgal header is included. - \cgalHasModel `CGAL::Arr_naive_point_location` \cgalHasModel `CGAL::Arr_walk_along_line_point_location` \cgalHasModel `CGAL::Arr_trapezoid_ric_point_location` @@ -38,7 +28,6 @@ is recommended. To enable the old style without any overhead, the macro \sa `CGAL::Arr_trapezoid_ric_point_location` \sa `CGAL::Arr_landmarks_point_location` \sa `CGAL::Arr_point_location_result` -\sa `CGAL_ARR_POINT_LOCATION_VERSION` */ class ArrangementVerticalRayShoot_2 { diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt index 04ce3c47c28..4427a20e151 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt @@ -239,9 +239,6 @@ implemented as peripheral classes or as free (global) functions. - `CGAL::Arr_unb_planar_topology_traits_2` - `CGAL::Arr_spherical_topology_traits_2` -\cgalCRPSection{Macros} -- \link CGAL_ARR_POINT_LOCATION_VERSION `CGAL_ARR_POINT_LOCATION_VERSION` \endlink - \cgalCRPSection{Functions} - `CGAL::is_valid()` diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp index 95eb729bb66..69c4a66ea68 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp @@ -29,7 +29,7 @@ typedef Traits::Algebraic_real_1 Algebraic_real; typedef Traits::X_monotone_curve_2 X_monotone_curve; typedef Traits::Point_2 Point; -typedef boost::variant Make_x_monotone_result; +typedef std::variant Make_x_monotone_result; int main() { Traits traits; @@ -52,7 +52,7 @@ int main() { // but not in this case). std::vector segs; for(size_t i = 0; i < pre_segs.size(); ++i) { - auto* curr_p = boost::get(&pre_segs[i]); + auto* curr_p = std::get_if(&pre_segs[i]); assert(curr_p); segs.push_back(*curr_p); } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_line_arcs.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_line_arcs.cpp index 1e7854b7482..750986dda1e 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_line_arcs.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_line_arcs.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include @@ -25,7 +25,7 @@ typedef Circular_k::Circle_2 Circle_2; typedef Circular_k::Circular_arc_2 Circular_arc_2; typedef Circular_k::Line_arc_2 Line_arc_2; -typedef boost::variant< Circular_arc_2, Line_arc_2> Arc_2; +typedef std::variant< Circular_arc_2, Line_arc_2> Arc_2; typedef std::vector< Arc_2> ArcContainer; typedef CGAL::Arr_circular_line_arc_traits_2 Traits; @@ -52,7 +52,7 @@ int main() { } while((x1 == x2) && (y1 == y2)); std::cout << x1 << " " << y1 << " " << x2 << " " << y2 << std::endl; - boost::variant< Circular_arc_2, Line_arc_2 > v = + std::variant< Circular_arc_2, Line_arc_2 > v = Line_arc_2(Point_2(x1,y1), Point_2(x2,y2)); ac.push_back( v); } @@ -63,7 +63,7 @@ int main() { y1 = theRandom.get_int(random_min,random_max); } while(x1==0 && y1==0); - boost::variant< Circular_arc_2, Line_arc_2 > v = + std::variant< Circular_arc_2, Line_arc_2 > v = Circle_2( Point_2(x1,y1), x1*x1 + y1*y1); ac.push_back(v); } @@ -72,7 +72,8 @@ int main() { Point_location _pl(arr); for (ArcContainer::const_iterator it = ac.begin(); it != ac.end(); ++it) { //insert(arr,_pl,*it); - insert(arr, *it, _pl); + //DONOTCOMMIT + //~ insert(arr, *it, _pl); }; return 0; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp index e89d8b57d89..bd636bc94fe 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp @@ -45,7 +45,7 @@ int main() { Point_location pl(arr); const Point q{_7_halves, 7}; Point_location::result_type obj = pl.locate(q); - auto* e = boost::get(&obj); + auto* e = std::get_if(&obj); // Split the edge e to two edges e1 and e2; auto e1 = arr.split_edge(arr.non_const_handle(*e), q); diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp index 51112be6c50..59a0203a4b4 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp @@ -32,7 +32,7 @@ int main() { // the boundary of the face that contains it. Point q(4, 1); auto obj = pl.locate(q); - auto* f = boost::get(&obj); + auto* f = std::get_if(&obj); std::cout << "The query point (" << q << ") is located in: "; print_face(*f); diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location_utils.h b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location_utils.h index 70bc38bce3f..d5a729edc6d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location_utils.h +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location_utils.h @@ -4,33 +4,6 @@ //----------------------------------------------------------------------------- // Print the result of a point-location query. // -#if CGAL_ARR_POINT_LOCATION_VERSION < 2 -template -void print_point_location(const typename Arrangement_::Point_2& q, - CGAL::Object obj) -{ - typedef Arrangement_ Arrangement_2; - typename Arrangement_2::Vertex_const_handle v; - typename Arrangement_2::Halfedge_const_handle e; - typename Arrangement_2::Face_const_handle f; - - std::cout << "The point (" << q << ") is located "; - if (CGAL::assign(f, obj)) { // q is located inside a face - if (f->is_unbounded()) - std::cout << "inside the unbounded face." << std::endl; - else std::cout << "inside a bounded face." << std::endl; - } - else if (CGAL::assign(e, obj)) { // q is located on an edge - std::cout << "on an edge: " << e->curve() << std::endl; - } - else if (CGAL::assign(v, obj)) { // q is located on a vertex - if (v->is_isolated()) - std::cout << "on an isolated vertex: " << v->point() << std::endl; - else std::cout << "on a vertex: " << v->point() << std::endl; - } - else CGAL_error_msg( "Invalid object."); -} -#else template void print_point_location (const typename Arrangement_::Point_2& q, @@ -46,18 +19,17 @@ void print_point_location const Face_const_handle* f; std::cout << "The point (" << q << ") is located "; - if ((f = boost::get(&obj))) // inside a face + if ((f = std::get_if(&obj))) // inside a face std::cout << "inside " << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") << " face." << std::endl; - else if ((e = boost::get(&obj))) // on an edge + else if ((e = std::get_if(&obj))) // on an edge std::cout << "on an edge: " << (*e)->curve() << std::endl; - else if ((v = boost::get(&obj))) // on a vertex + else if ((v = std::get_if(&obj))) // on a vertex std::cout << "on " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; else CGAL_error_msg("Invalid object."); } -#endif //----------------------------------------------------------------------------- // Perform a point-location query and print the result. @@ -101,12 +73,12 @@ void shoot_vertical_ray(const VerticalRayShooting& vrs, std::cout << "Shooting up from (" << q << ") : hit "; - if ((v = boost::get(&obj))) // hit a vertex + if ((v = std::get_if(&obj))) // hit a vertex std::cout << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; - else if ((e = boost::get(&obj)) ) // hit an edge + else if ((e = std::get_if(&obj)) ) // hit an edge std::cout << "an edge: " << (*e)->curve() << std::endl; - else if ((f = boost::get(&obj))) { // hit nothing + else if ((f = std::get_if(&obj))) { // hit nothing assert((*f)->is_unbounded()); std::cout << "nothing." << std::endl; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp index 287fd51786a..70184f7f4bb 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp @@ -24,7 +24,7 @@ typedef Polycurve_bezier_traits::Point_2 Point; typedef Polycurve_bezier_traits::X_monotone_curve_2 X_mono_polycurve; typedef CGAL::Arrangement_2 Arrangement_2; -typedef boost::variant Make_x_monotone_result; +typedef std::variant Make_x_monotone_result; int main() { Polycurve_bezier_traits pc_traits; @@ -58,7 +58,7 @@ int main() { // convert it into x-monotone bezier curve. std::vector obj_vector; bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector)); - auto* x_seg_p = boost::get(&obj_vector[0]); + auto* x_seg_p = std::get_if(&obj_vector[0]); x_curves.push_back(*x_seg_p); } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp index 1ba6d9b5232..98515d5d0c9 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp @@ -99,15 +99,15 @@ protected: for (auto it = results.begin(); it != results.end(); ++it) { std::cout << "The point (" << it->first << ") is located "; if (const Face_const_handle* f = - boost::get(&(it->second))) // inside a face + std::get_if(&(it->second))) // inside a face std::cout << "inside " << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") << " face.\n"; else if (const Halfedge_const_handle* e = - boost::get(&(it->second))) // on an edge + std::get_if(&(it->second))) // on an edge std::cout << "on an edge: " << (*e)->curve() << std::endl; else if (const Vertex_const_handle* v = - boost::get(&(it->second))) // on a vertex + std::get_if(&(it->second))) // on a vertex std::cout << "on " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp index 831e0e44395..0b31dc9655b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp @@ -8,9 +8,9 @@ #include "arr_linear.h" -typedef boost::variant Cell_type; -typedef boost::optional Vert_decomp_type; +typedef std::optional Vert_decomp_type; typedef std::pair Vert_decomp_pair; typedef std::pair Vert_decomp_entry; typedef std::list Vert_decomp_list; @@ -41,10 +41,10 @@ int main() { std::cout << " feature below: "; if (! curr.first) std::cout << "EMPTY"; else { - auto* vh = boost::get(&*(curr.first));; + auto* vh = std::get_if(&*(curr.first));; if (vh) std::cout << '(' << (*vh)->point() << ')'; else { - auto* hh = boost::get(&*(curr.first)); + auto* hh = std::get_if(&*(curr.first)); if (! (*hh)->is_fictitious()) std::cout << '[' << (*hh)->curve() << ']'; else std::cout << "NONE"; @@ -54,10 +54,10 @@ int main() { std::cout << " feature above: "; if (! curr.second) std::cout << "EMPTY\n"; else { - auto* vh = boost::get(&*(curr.second));; + auto* vh = std::get_if(&*(curr.second));; if (vh) std::cout << '(' << (*vh)->point() << ")\n"; else { - auto* hh = boost::get(&*(curr.second)); + auto* hh = std::get_if(&*(curr.second)); if (! (*hh)->is_fictitious()) std::cout << '[' << (*hh)->curve() << "]\n"; else std::cout << "NONE\n"; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h index 7aedff1530d..461cadf34a1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h @@ -499,7 +499,7 @@ public: template OutputIterator operator() (const Curve_2& B, OutputIterator oi) const { - typedef boost::variant + typedef std::variant Make_x_monotone_result; typedef typename Bounding_traits::Vertical_tangency_point Vertical_tangency_point; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h index 90ae69d90ca..bb60e54d224 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h @@ -114,13 +114,13 @@ public: auto obj = p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y); // Return a handle to the DCEL feature. - DFace** f_p = boost::get(&obj); + DFace** f_p = std::get_if(&obj); if (f_p) return (Pl_result::make_result(p_arr->_const_handle_for(*f_p))); - DHalfedge** he_p = boost::get(&obj); + DHalfedge** he_p = std::get_if(&obj); if (he_p) return (Pl_result::make_result(p_arr->_const_handle_for(*he_p))); - DVertex** v_p = boost::get(&obj); + DVertex** v_p = std::get_if(&obj); if (v_p) return (Pl_result::make_result(p_arr->_const_handle_for(*v_p))); // We should never reach here: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h index 85f1b7c5acf..af9b28db6f2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h @@ -25,7 +25,7 @@ #include -#include +#include #include namespace CGAL { @@ -267,11 +267,11 @@ public: template OutputIterator x_monotone_segment(Curve_2 cv, Point_2 p, - boost::optional start, - boost::optional end, + std::optional start, + std::optional end, OutputIterator out) const { - typedef boost::variant + typedef std::variant Make_x_monotone_result; //CGAL_assertion(is_one_one(cv,p)); @@ -286,46 +286,46 @@ public: this->_ckva()->make_x_monotone_2_object()(cv, std::back_inserter(arcs)); auto it = arcs.begin(); auto helper = it; - const auto* it_seg_p = boost::get(&(*it)); + const auto* it_seg_p = std::get_if(&(*it)); while (it != arcs.end()) { if ( on_arc(p, *it_seg_p) ) break; it++; - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); } - bool left_on_arc = start && on_arc(start.get(), *it_seg_p); - bool right_on_arc = end && on_arc(end.get(), *it_seg_p); + bool left_on_arc = start && on_arc(start.value(), *it_seg_p); + bool right_on_arc = end && on_arc(end.value(), *it_seg_p); if ( left_on_arc && right_on_arc ) { - segs.push_back(it_seg_p->trim(start.get(),end.get())); + segs.push_back(it_seg_p->trim(start.value(),end.value())); } if (left_on_arc && (!right_on_arc)) { if (!it_seg_p->is_finite(CGAL::ARR_MAX_END) || - !equal(start.get(),right(*it_seg_p))) { + !equal(start.value(),right(*it_seg_p))) { if (it_seg_p->is_finite(CGAL::ARR_MIN_END) && - equal(start.get(),left(*it_seg_p))) + equal(start.value(),left(*it_seg_p))) { segs.push_back(*it_seg_p); } else { X_monotone_curve_2 split1,split2; - it_seg_p->split(start.get(),split1,split2); + it_seg_p->split(start.value(),split1,split2); segs.push_back(split2); } } } if ((!left_on_arc) && right_on_arc) { if (!it_seg_p->is_finite(CGAL::ARR_MIN_END) || - ! equal(left(*it_seg_p), end.get())) + ! equal(left(*it_seg_p), end.value())) { if (it_seg_p->is_finite(CGAL::ARR_MAX_END) && - equal(end.get(), right(*it_seg_p))) + equal(end.value(), right(*it_seg_p))) { segs.push_back(*it_seg_p); } else { X_monotone_curve_2 split1,split2; - it_seg_p->split(end.get(), split1, split2); + it_seg_p->split(end.value(), split1, split2); segs.push_back(split1); } } @@ -348,14 +348,14 @@ public: } CGAL_assertion(it != arcs.begin()); it--; - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); while (! on_arc(point_it, *it_seg_p)) { CGAL_assertion(it != arcs.begin()); it--; - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); } - if (start && on_arc(start.get(),*it_seg_p)) { - segs.push_front(it_seg_p->trim(start.get(), right(*it_seg_p))); + if (start && on_arc(start.value(),*it_seg_p)) { + segs.push_front(it_seg_p->trim(start.value(), right(*it_seg_p))); break; } else { @@ -365,7 +365,7 @@ public: } if (! right_on_arc) { it = helper; // reset - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); Point_2 point_it; while (true) { if (it_seg_p->is_finite(CGAL::ARR_MAX_END) && @@ -378,14 +378,14 @@ public: } it++; CGAL_assertion(it != arcs.end()); - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); while(! on_arc(point_it, *it_seg_p)) { it++; CGAL_assertion(it != arcs.end()); - it_seg_p = boost::get(&(*it)); + it_seg_p = std::get_if(&(*it)); } - if(end && on_arc(end.get(),*it_seg_p)) { - segs.push_back(it_seg_p->trim(left(*it_seg_p),end.get())); + if(end && on_arc(end.value(),*it_seg_p)) { + segs.push_back(it_seg_p->trim(left(*it_seg_p),end.value())); break; } else { @@ -407,19 +407,19 @@ public: Site_of_point site_of_p, OutputIterator out) const { if(site_of_p==POINT_IN_INTERIOR) { - return x_monotone_segment(cv,p,boost::none, boost::none,out); + return x_monotone_segment(cv,p,std::nullopt, std::nullopt,out); } else if(site_of_p==MIN_ENDPOINT) { return x_monotone_segment(cv, p, - boost::optional(p), - boost::none, + std::optional(p), + std::nullopt, out); } CGAL_assertion(site_of_p==MAX_ENDPOINT); return x_monotone_segment(cv, p, - boost::none, - boost::optional(p), + std::nullopt, + std::optional(p), out); } @@ -468,15 +468,15 @@ public: return x_monotone_segment (cv, end_left, - boost::optional(end_left), - boost::optional(end_right), + std::optional(end_left), + std::optional(end_right), out); } else { return x_monotone_segment (cv, end_right, - boost::optional(end_left), - boost::optional(end_right), + std::optional(end_left), + std::optional(end_right), out); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h index af58c261240..42715621e4b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h @@ -41,7 +41,7 @@ namespace Ss2 = Surface_sweep_2; * \param oi Output: An output iterator for the query results. * \pre The value-type of PointsIterator is Arrangement::Point_2, * and the value-type of OutputIterator is is pair, - * where Result is boost::optional >. * It represents the arrangement feature containing the point. @@ -105,7 +105,7 @@ locate(const Arrangement_on_surface_2& arr, } } - // Obtain a extended traits-class object. + // Obtain an extended traits-class object. const Gt2* geom_traits = arr.geometry_traits(); /* We would like to avoid copy construction of the geometry traits class. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index 8686132cc41..4d0d46c8de1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -14,7 +14,7 @@ #ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H -#include +#include #include @@ -305,7 +305,7 @@ public: * \pre The curve has a boundary condition in either x or y. * \return An object that wraps the curve end. */ - boost::optional > + std::optional > place_boundary_vertex(Face*, const X_monotone_curve_2&, Arr_curve_end, @@ -314,7 +314,7 @@ public: { // This function should never be called: CGAL_error(); - return boost::none; + return std::nullopt; } /*! Locate the predecessor halfedge for the given curve around a given @@ -347,13 +347,13 @@ public: * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - boost::variant + std::variant locate_curve_end(const X_monotone_curve_2&, Arr_curve_end, Arr_parameter_space /* ps_x */, Arr_parameter_space /* ps_y */) { - typedef boost::variant Result; + typedef std::variant Result; // This function should never be called: CGAL_error(); Vertex* v(nullptr); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index 64f7cd6dea9..f6fbe621739 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -584,9 +584,6 @@ public: template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { - typedef boost::variant - Make_x_monotone_result; - // Increment the serial number of the curve cv, which will serve as its // unique identifier. unsigned int index = 0; @@ -594,10 +591,10 @@ public: if (cv.orientation() == COLLINEAR) { // The curve is a line segment. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv.supporting_line(), - cv.source(), - cv.target(), - index)); + *oi++ = X_monotone_curve_2(cv.supporting_line(), + cv.source(), + cv.target(), + index); return oi; } @@ -608,8 +605,8 @@ public: if (sign_rad == ZERO) { // Create an isolated point. - *oi++ = Make_x_monotone_result(Point_2(circ.center().x(), - circ.center().y())); + *oi++ = Point_2(circ.center().x(), + circ.center().y()); return oi; } @@ -622,59 +619,59 @@ public: CGAL_assertion (n_vpts == 2); // Subdivide the circle into two arcs (an upper and a lower half). - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], vpts[1], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], vpts[1], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[1], vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[1], vpts[0], + cv.orientation(), + index); } else { // Act according to the number of vertical tangency points. if (n_vpts == 2) { // Subdivide the circular arc into three x-monotone arcs. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), vpts[0], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], vpts[1], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], vpts[1], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[1], - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[1], + cv.target(), + cv.orientation(), + index); } else if (n_vpts == 1) { // Subdivide the circular arc into two x-monotone arcs. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), - vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), + vpts[0], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], + cv.target(), + cv.orientation(), + index); } else { CGAL_assertion(n_vpts == 0); // The arc is already x-monotone: - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), + cv.target(), + cv.orientation(), + index); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h index 6827889a4f1..151bcf5644a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h @@ -178,17 +178,17 @@ public: template OutputIterator operator()(const Curve_2& arc, OutputIterator oi) const { - typedef boost::variant + typedef std::variant Make_x_monotone_result; - std::vector objs; + std::vector objs; CircularKernel().make_x_monotone_2_object()(arc, std::back_inserter(objs)); for (const auto& obj : objs) { - if (const auto* p = CGAL::object_cast(&obj)) { + if (const auto* p = std::get_if(&obj)) { *oi++ = Make_x_monotone_result(*p); continue; } - if (const auto* xcv = CGAL::object_cast(&obj)) { + if (const auto* xcv = std::get_if(&obj)) { *oi++ = Make_x_monotone_result(*xcv); continue; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h index 4d5c07d46ea..b1783f8c3ec 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h @@ -35,7 +35,7 @@ #include -#include +#include #include #include @@ -51,17 +51,17 @@ namespace CGAL { OutputIterator res2) { typedef typename CK::Circular_arc_point_2 Point_2; - typedef boost::variant X_monotone_curve_2; - typedef boost::variant + typedef std::variant X_monotone_curve_2; + typedef std::variant Make_x_monotone_result; for (auto it = res1.begin(); it != res1.end(); ++it) { if (const Arc1* arc = CGAL::object_cast(&*it)) { - boost::variant v = *arc; + std::variant v = *arc; *res2++ = Make_x_monotone_result(v); } else if (const Arc2* line = CGAL::object_cast(&*it)) { - boost::variant v = *line; + std::variant v = *line; *res2++ = Make_x_monotone_result(v); } else if (const Point_2* p = CGAL::object_cast(&*it)) { @@ -81,27 +81,27 @@ namespace CGAL { Circular_arc_point_2; result_type - operator()(const boost::variant< Arc1, Arc2 > &a1, - const boost::variant< Arc1, Arc2 > &a2, + operator()(const std::variant< Arc1, Arc2 > &a1, + const std::variant< Arc1, Arc2 > &a2, const Circular_arc_point_2 &p) const { - if ( const Arc1* arc1 = boost::get( &a1 ) ){ - if ( const Arc1* arc2 = boost::get( &a2 ) ){ + if ( const Arc1* arc1 = std::get_if( &a1 ) ){ + if ( const Arc1* arc2 = std::get_if( &a2 ) ){ return CircularKernel() .compare_y_to_right_2_object()(*arc1, *arc2, p); } else { - const Arc2* arc2e = boost::get( &a2 ); + const Arc2* arc2e = std::get_if( &a2 ); return CircularKernel() .compare_y_to_right_2_object()(*arc1, *arc2e, p); } } - const Arc2* arc1 = boost::get( &a1 ); - if ( const Arc1* arc2 = boost::get( &a2 ) ){ + const Arc2* arc1 = std::get_if( &a1 ); + if ( const Arc1* arc2 = std::get_if( &a2 ) ){ return CircularKernel() .compare_y_to_right_2_object()(*arc1, *arc2, p); } - const Arc2* arc2e = boost::get( &a2 ); + const Arc2* arc2e = std::get_if( &a2 ); return CircularKernel() .compare_y_to_right_2_object()(*arc1, *arc2e, p); } @@ -110,7 +110,6 @@ namespace CGAL { template class Variant_Equal_2 - : public boost::static_visitor { public : @@ -136,7 +135,7 @@ namespace CGAL { : public CircularKernel::Equal_2 { public: - typedef boost::variant< Arc1, Arc2 > Curve_2; + typedef std::variant< Arc1, Arc2 > Curve_2; typedef bool result_type; using CircularKernel::Equal_2::operator(); typedef typename CircularKernel::Circular_arc_point_2 @@ -169,7 +168,7 @@ namespace CGAL { result_type operator()(const Curve_2 &a0, const Curve_2 &a1) const { - return boost::apply_visitor + return std::visit ( Variant_Equal_2(), a0, a1 ); } @@ -188,20 +187,20 @@ namespace CGAL { result_type operator() (const Circular_arc_point_2 &p, - const boost::variant< Arc1, Arc2 > &A1) const + const std::variant< Arc1, Arc2 > &A1) const { - if ( const Arc1* arc1 = boost::get( &A1 ) ){ + if ( const Arc1* arc1 = std::get_if( &A1 ) ){ return CircularKernel().compare_y_at_x_2_object()(p, *arc1); } else { - const Arc2* arc2 = boost::get( &A1 ); + const Arc2* arc2 = std::get_if( &A1 ); return CircularKernel().compare_y_at_x_2_object()(p, *arc2); } } }; template - class Variant_Do_overlap_2 : public boost::static_visitor + class Variant_Do_overlap_2 { public: template < typename T > @@ -229,10 +228,10 @@ namespace CGAL { typedef bool result_type; result_type - operator()(const boost::variant< Arc1, Arc2 > &A0, - const boost::variant< Arc1, Arc2 > &A1) const + operator()(const std::variant< Arc1, Arc2 > &A0, + const std::variant< Arc1, Arc2 > &A1) const { - return boost::apply_visitor + return std::visit ( Variant_Do_overlap_2(), A0, A1 ); } }; @@ -248,23 +247,17 @@ namespace CGAL { template < class OutputIterator,class Not_X_Monotone > OutputIterator - operator()(const boost::variant &A, + operator()(const std::variant &A, OutputIterator res) const { - if ( const Arc1* arc1 = boost::get( &A ) ) { - std::vector container; - CircularKernel(). - make_x_monotone_2_object()(*arc1,std::back_inserter(container)); - return object_to_object_variant - (container, res); + if ( const Arc1* arc1 = std::get_if( &A ) ) { + return CircularKernel(). + make_x_monotone_2_object()(*arc1, res); } else { - const Arc2* arc2 = boost::get( &A ); - std::vector container; - CircularKernel(). - make_x_monotone_2_object()(*arc2,std::back_inserter(container)); - return object_to_object_variant - (container, res); + const Arc2* arc2 = std::get_if( &A ); + return CircularKernel(). + make_x_monotone_2_object()(*arc2, res); } } }; @@ -278,23 +271,23 @@ namespace CGAL { template < class OutputIterator > OutputIterator - operator()(const boost::variant< Arc1, Arc2 > &c1, - const boost::variant< Arc1, Arc2 > &c2, + operator()(const std::variant< Arc1, Arc2 > &c1, + const std::variant< Arc1, Arc2 > &c2, OutputIterator oi) const { - if ( const Arc1* arc1 = boost::get( &c1 ) ){ - if ( const Arc1* arc2 = boost::get( &c2 ) ){ + if ( const Arc1* arc1 = std::get_if( &c1 ) ){ + if ( const Arc1* arc2 = std::get_if( &c2 ) ){ return CircularKernel().intersect_2_object()(*arc1, *arc2, oi); } - const Arc2* arc2 = boost::get( &c2 ); + const Arc2* arc2 = std::get_if( &c2 ); return CircularKernel().intersect_2_object()(*arc1, *arc2, oi); } - const Arc2* arc1e = boost::get( &c1 ); - if ( const Arc1* arc2 = boost::get( &c2 ) ){ + const Arc2* arc1e = std::get_if( &c1 ); + if ( const Arc1* arc2 = std::get_if( &c2 ) ){ return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi); } - const Arc2* arc2 = boost::get( &c2 ); + const Arc2* arc2 = std::get_if( &c2 ); return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi); } @@ -309,13 +302,13 @@ namespace CGAL { Circular_arc_point_2; typedef void result_type; result_type - operator()(const boost::variant< Arc1, Arc2 > &A, + operator()(const std::variant< Arc1, Arc2 > &A, const Circular_arc_point_2 &p, - boost::variant< Arc1, Arc2 > &ca1, - boost::variant< Arc1, Arc2 > &ca2) const + std::variant< Arc1, Arc2 > &ca1, + std::variant< Arc1, Arc2 > &ca2) const { // TODO : optimize by extracting the references from the variants ? - if ( const Arc1* arc1 = boost::get( &A ) ){ + if ( const Arc1* arc1 = std::get_if( &A ) ){ Arc1 carc1; Arc1 carc2; CircularKernel().split_2_object()(*arc1, p, carc1, carc2); @@ -325,7 +318,7 @@ namespace CGAL { } else{ - const Arc2* arc2 = boost::get( &A ); + const Arc2* arc2 = std::get_if( &A ); Arc2 cline1; Arc2 cline2; CircularKernel().split_2_object()(*arc2, p, cline1, cline2); @@ -340,8 +333,6 @@ namespace CGAL { template class Variant_Construct_min_vertex_2 - : public boost::static_visitor - { typedef typename CircularKernel::Circular_arc_point_2 Circular_arc_point_2; @@ -372,9 +363,9 @@ namespace CGAL { //std::remove_reference_t result_type - operator() (const boost::variant< Arc1, Arc2 > & cv) const + operator() (const std::variant< Arc1, Arc2 > & cv) const { - return boost::apply_visitor + return std::visit ( Variant_Construct_min_vertex_2(), cv ); } }; @@ -385,8 +376,6 @@ namespace CGAL { template class Variant_Construct_max_vertex_2 - : public boost::static_visitor { typedef typename CircularKernel::Circular_arc_point_2 Circular_arc_point_2; @@ -422,16 +411,15 @@ namespace CGAL { //std::remove_reference result_type - operator() (const boost::variant< Arc1, Arc2 > & cv) const + operator() (const std::variant< Arc1, Arc2 > & cv) const { - return boost::apply_visitor + return std::visit ( Variant_Construct_max_vertex_2(), cv ); } }; template class Variant_Is_vertical_2 - : public boost::static_visitor { public : @@ -449,9 +437,9 @@ namespace CGAL { public: typedef bool result_type; - bool operator() (const boost::variant< Arc1, Arc2 >& cv) const + bool operator() (const std::variant< Arc1, Arc2 >& cv) const { - return boost::apply_visitor + return std::visit ( Variant_Is_vertical_2(), cv ); } }; @@ -459,7 +447,7 @@ namespace CGAL { } - // a empty class used to have different types between Curve_2 and X_monotone_curve_2 + // an empty class used to have different types between Curve_2 and X_monotone_curve_2 // in Arr_circular_line_arc_traits_2. namespace internal_Argt_traits{ struct Not_X_Monotone{}; @@ -499,8 +487,8 @@ namespace CGAL { typedef internal_Argt_traits::Not_X_Monotone Not_X_Monotone; - typedef boost::variant< Arc1, Arc2, Not_X_Monotone > Curve_2; - typedef boost::variant< Arc1, Arc2 > X_monotone_curve_2; + typedef std::variant< Arc1, Arc2, Not_X_Monotone > Curve_2; + typedef std::variant< Arc1, Arc2 > X_monotone_curve_2; private: CircularKernel ck; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index f7b77c63a43..3576237f699 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -863,8 +862,6 @@ public: */ template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { - typedef boost::variant - Make_x_monotone_result; auto ctr_xcv = m_traits.construct_x_monotone_curve_2_object(); @@ -878,7 +875,7 @@ public: auto n_vtan_ps = m_traits.vertical_tangency_points(cv, vtan_ps); if (n_vtan_ps == 0) { // In case the given curve is already x-monotone: - *oi++ = Make_x_monotone_result(ctr_xcv(cv, conic_id)); + *oi++ = ctr_xcv(cv, conic_id); return oi; } @@ -890,19 +887,15 @@ public: // In case the curve is a full conic, split it into two x-monotone // arcs, one going from ps[0] to ps[1], and the other from ps[1] to // ps[0]. - *oi++ = Make_x_monotone_result(ctr_xcv(cv, vtan_ps[0], vtan_ps[1], - conic_id)); - *oi++ = Make_x_monotone_result(ctr_xcv(cv, vtan_ps[1], vtan_ps[0], - conic_id)); + *oi++ = ctr_xcv(cv, vtan_ps[0], vtan_ps[1], conic_id); + *oi++ = ctr_xcv(cv, vtan_ps[1], vtan_ps[0], conic_id); } else { if (n_vtan_ps == 1) { // Split the arc into two x-monotone sub-curves: one going from the // arc source to ps[0], and the other from ps[0] to the target. - *oi++ = Make_x_monotone_result(ctr_xcv(cv, cv.source(), vtan_ps[0], - conic_id)); - *oi++ = Make_x_monotone_result(ctr_xcv(cv, vtan_ps[0], cv.target(), - conic_id)); + *oi++ = ctr_xcv(cv, cv.source(), vtan_ps[0], conic_id); + *oi++ = ctr_xcv(cv, vtan_ps[0], cv.target(), conic_id); } else { CGAL_assertion(n_vtan_ps == 2); @@ -932,16 +925,16 @@ public: } // Split the arc into three x-monotone sub-curves. - *oi++ = Make_x_monotone_result(ctr_xcv(cv, cv.source(), - vtan_ps[ind_first], - conic_id)); + *oi++ = ctr_xcv(cv, cv.source(), + vtan_ps[ind_first], + conic_id); - *oi++ = Make_x_monotone_result(ctr_xcv(cv, vtan_ps[ind_first], - vtan_ps[ind_second], - conic_id)); + *oi++ = ctr_xcv(cv, vtan_ps[ind_first], + vtan_ps[ind_second], + conic_id); - *oi++ = Make_x_monotone_result(ctr_xcv(cv, vtan_ps[ind_second], - cv.target(), conic_id)); + *oi++ = ctr_xcv(cv, vtan_ps[ind_second], + cv.target(), conic_id); } } @@ -1315,17 +1308,15 @@ public: OutputIterator intersect(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Intersection_map& inter_map, - OutputIterator oi) const { - typedef boost::variant - Intersection_result; - + OutputIterator oi) const + { if (m_traits.has_same_supporting_conic(xcv1, xcv2)) { // Check for overlaps between the two arcs. X_monotone_curve_2 overlap; if (compute_overlap(xcv1, xcv2, overlap)) { // There can be just a single overlap between two x-monotone arcs: - *oi++ = Intersection_result(overlap); + *oi++ = overlap; return oi; } @@ -1338,22 +1329,22 @@ public: auto eq = alg_kernel->equal_2_object(); if (eq(xcv1.left(), xcv2.left())) { Intersection_point ip(xcv1.left(), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } if (eq(xcv1.right(), xcv2.right())) { Intersection_point ip(xcv1.right(), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } if (eq(xcv1.left(), xcv2.right())) { Intersection_point ip(xcv1.left(), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } if (eq(xcv1.right(), xcv2.left())) { Intersection_point ip(xcv1.right(), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } return oi; @@ -1396,7 +1387,7 @@ public: if (m_traits.is_between_endpoints(xcv1, (*iter).first) && m_traits.is_between_endpoints(xcv2, (*iter).first)) { - *oi++ = Intersection_result(*iter); + *oi++ = *iter; } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h index 1455a276f6d..d0a68b2885b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h @@ -23,7 +23,7 @@ #include -#include +#include #include #include @@ -126,9 +126,9 @@ public: template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { - typedef boost::variant + typedef std::variant Base_make_x_monotone_result; - typedef boost::variant + typedef std::variant Make_x_monotone_result; // Make the original curve x-monotone. @@ -138,12 +138,12 @@ public: // Attach the data to each of the resulting x-monotone curves. X_monotone_curve_data xdata = Convert()(cv.data()); for (const auto& base_obj : base_objects) { - if (const auto* bxcv = boost::get(&base_obj)) { + if (const auto* bxcv = std::get_if(&base_obj)) { *oi++ = Make_x_monotone_result(X_monotone_curve_2(*bxcv, xdata)); continue; } // Current object is an isolated point: Leave it as is. - const auto* bp = boost::get(&base_obj); + const auto* bp = std::get_if(&base_obj); CGAL_assertion(bp); *oi++ = Make_x_monotone_result(*bp); } @@ -208,9 +208,7 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; - typedef boost::variant + typedef std::variant Intersection_base_result; // Use the base functor to obtain all intersection objects. @@ -223,19 +221,19 @@ public: // Go over all intersection objects and prepare the output. for (const auto& item : base_objects) { const Base_x_monotone_curve_2* base_cv = - boost::get(&item); + std::get_if(&item); if (base_cv != nullptr) { // The current intersection object is an overlapping x-monotone // curve: Merge the data fields of both intersecting curves and // associate the result with the overlapping curve. X_monotone_curve_2 cv(*base_cv, Merge()(cv1.data(), cv2.data())); - *oi++ = Intersection_result(cv); + *oi++ = cv; continue; } // The current intersection object is an intersection point: // Copy it as is. - const Intersection_point* ip = boost::get(&item); - *oi++ = Intersection_result(*ip); + const Intersection_point* ip = std::get_if(&item); + *oi++ = *ip; } return oi; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 3dde86da5a9..411dda8c5e8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include @@ -1463,7 +1463,7 @@ public: bool operator()(const X_monotone_curve_2& xc1, const X_monotone_curve_2& xc2) const { const Kernel& kernel = m_traits; - typename Kernel::Equal_3 equal_3 = kernel.equal_3_object(); + auto equal_3 = kernel.equal_3_object(); if (xc1.is_full() || xc2.is_full()) { if (!xc1.is_full() || !xc2.is_full()) return false; auto opposite_3 = kernel.construct_opposite_direction_3_object(); @@ -2091,8 +2091,8 @@ public: */ template OutputIterator operator()(const Curve_2& c, OutputIterator oi) const { - using Make_x_monotone_result = - boost::variant; + using Make_x_monotone_result = std::variant; + // std::cout << "full: " << c.is_full() << std::endl; // std::cout << "vert: " << c.is_vertical() << std::endl; // std::cout << "xmon: " << c.is_x_monotone() << std::endl; @@ -2256,8 +2256,7 @@ public: const Point_2& source = xc.source(); const Point_2& target = xc.target(); CGAL_precondition_code(const Kernel& kernel = m_traits); - CGAL_precondition_code - (typename Kernel::Equal_3 equal_3 = kernel.equal_3_object()); + CGAL_precondition_code(auto equal_3 = kernel.equal_3_object()); CGAL_precondition(!equal_3(Direction_3(p), Direction_3(source))); CGAL_precondition(!equal_3(Direction_3(p), Direction_3(target))); @@ -2346,8 +2345,7 @@ public: Project project, OutputIterator oi) const { using Intersection_point = std::pair; - using Intersection_result = - boost::variant; + const Kernel& kernel = m_traits; typename Kernel::Equal_2 equal = kernel.equal_2_object(); @@ -2362,14 +2360,14 @@ public: if (equal(l1, r1)) { bool is_full = equal(l2, r2); X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true, is_full); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } if (equal(l2, r2)) { CGAL_assertion(! equal(l1, r1)); // already handled above X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2383,19 +2381,19 @@ public: // 5. l1 = r2 < r1 < l2 = l1 | One overlap (handled above) if (in_between(r1, r2, l2)) { // Case 1. - *oi++ = Intersection_result(Intersection_point(l1_3, 1)); + *oi++ = Intersection_point(l1_3, 1); return oi; } if (equal(r1, l2)) { // Case 2. - *oi++ = Intersection_result(Intersection_point(l1_3, 1)); - *oi++ = Intersection_result(Intersection_point(l2_3, 1)); + *oi++ = Intersection_point(l1_3, 1); + *oi++ = Intersection_point(l2_3, 1); return oi; } CGAL_assertion(in_between(r1, l2, r2)); // Case 3. X_monotone_curve_2 xc(l2_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2408,12 +2406,12 @@ public: // 5. l1 < l1 = r1 = l2 < r2 | One overlap (handled above) if (in_between(r2, r1, l1)) { // Case 1. - *oi++ = Intersection_result(Intersection_point(l2_3, 1)); + *oi++ = Intersection_point(l2_3, 1); return oi; } // Case 3. X_monotone_curve_2 xc(l1_3, r2_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2425,13 +2423,13 @@ public: if (in_between(r1, l2, r2) || equal(r1, r2)) { // Cases 1 & 2 X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } // Case 3 CGAL_assertion(in_between(r2, l2, r1)); X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2443,13 +2441,13 @@ public: if (in_between(l1, r2, l2)) { // Cases 1 X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } // Case 3 CGAL_assertion(in_between(l1, l2, l2)); X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2467,12 +2465,12 @@ public: if (in_between(l2, r2, l1)) { // Case 2 X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } // Case 3 X_monotone_curve_2 xc(l2_3, r1_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2482,12 +2480,12 @@ public: // Case 4 if (in_between(l1, r1, l2)) { X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } // Case 5 X_monotone_curve_2 xc(l1_3, r2_3, normal, vertical, true); - *oi++ = Intersection_result(xc); + *oi++ = xc; return oi; } @@ -2578,14 +2576,11 @@ public: CGAL_precondition(!xc1.is_degenerate()); CGAL_precondition(!xc2.is_degenerate()); - using Equal_3 = typename Kernel::Equal_3; using Intersection_point = std::pair; - using Intersection_result = - boost::variant; const Kernel& kernel = m_traits; - Equal_3 equal_3 = kernel.equal_3_object(); + auto equal_3 = kernel.equal_3_object(); const Direction_3& normal1 = xc1.normal(); const Direction_3& normal2 = xc2.normal(); @@ -2604,9 +2599,9 @@ public: (res && (xc1.is_directed_right() != xc2.is_directed_right()))) { if (xc1.left().is_min_boundary() && xc2.left().is_min_boundary()) - *oi++ = Intersection_result(Intersection_point(xc1.left(), 1)); + *oi++ = Intersection_point(xc1.left(), 1); if (xc1.right().is_max_boundary() && xc2.right().is_max_boundary()) - *oi++ = Intersection_result(Intersection_point(xc1.right(), 1)); + *oi++ = Intersection_point(xc1.right(), 1); return oi; } @@ -2614,11 +2609,11 @@ public: * the other arc is completely overlapping. */ if (xc1.left().is_min_boundary() && xc1.right().is_max_boundary()) { - *oi++ = Intersection_result(xc2); + *oi++ = xc2; return oi; } if (xc2.left().is_min_boundary() && xc2.right().is_max_boundary()) { - *oi++ = Intersection_result(xc1); + *oi++ = xc1; return oi; } /*! Find an endpoint that does not coincide with a pole, and project @@ -2666,12 +2661,12 @@ public: // Observe that xc1 and xc2 may share two endpoints. Point_2 ed = m_traits.construct_point_2_object()(v.direction()); if (is_in_between(ed, xc1) && is_in_between(ed, xc2)) - *oi++ = Intersection_result(Intersection_point(ed, 1)); + *oi++ = Intersection_point(ed, 1); Vector_3 vo(kernel.construct_opposite_vector_3_object()(v)); Point_2 edo = m_traits.construct_point_2_object()(vo.direction()); if (is_in_between(edo, xc1) && is_in_between(edo, xc2)) - *oi++ = Intersection_result(Intersection_point(edo, 1)); + *oi++ = Intersection_point(edo, 1); return oi; } @@ -2710,7 +2705,7 @@ public: (xc2.is_full() || xc2.is_meridian())) return false; const Kernel& kernel = m_traits; - typename Kernel::Equal_3 equal = kernel.equal_3_object(); + auto equal = kernel.equal_3_object(); // Down cast to pass to kernel member functions const Direction_3& xc1_left = xc1.left(); @@ -2788,7 +2783,7 @@ public: } const Kernel& kernel = m_traits; - typename Kernel::Equal_3 equal = kernel.equal_3_object(); + auto equal = kernel.equal_3_object(); // Down cast to pass to kernel member functions const Direction_3& xc1_right = xc1.right(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h index ba37b21f187..d966a52b41a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h @@ -201,7 +201,7 @@ public: * intersection or a plane in case plane1 and plane2 coincide. */ template -boost::variant > +std::variant > intersect(const Arr_plane_3 & plane1, const Arr_plane_3 & plane2) { @@ -209,7 +209,7 @@ intersect(const Arr_plane_3 & plane1, typedef typename Kernel::Direction_3 Direction_3; typedef typename Kernel::Line_3 Line_3; typedef typename Kernel::FT FT; - typedef boost::variant > Intersection_result; + typedef std::variant > Intersection_result; // We know that the plane goes through the origin const FT& a1 = plane1.a(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h index e287978f9e3..705682f05ca 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h @@ -1264,22 +1264,22 @@ private: Control_points aux_vec; auto res1 = f_intersect(skew1a, skew2a); - const Point_2* p1 = boost::get(&*res1); + const Point_2* p1 = std::get_if(&*res1); if (! p1) CGAL_error(); aux_vec.push_back(*p1); auto res2 = f_intersect(skew1a, skew2b); - const Point_2* p2 = boost::get(&*res2); + const Point_2* p2 = std::get_if(&*res2); if (! p2) CGAL_error(); aux_vec.push_back(*p2); auto res3 = f_intersect(skew1b, skew2a); - const Point_2* p3 = boost::get(&*res3); + const Point_2* p3 = std::get_if(&*res3); if (! p3) CGAL_error(); aux_vec.push_back(*p3); auto res4 = f_intersect (skew1b, skew2b); - const Point_2* p4 = boost::get(&*res4); + const Point_2* p4 = std::get_if(&*res4); if (! p4) CGAL_error(); aux_vec.push_back(*p4); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h index cf7d00135b0..f8589b2953b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h @@ -318,13 +318,11 @@ public: Bezier_cache& cache, OutputIterator oi) const { - typedef boost::variant Intersection_result; - // In case we have two x-monotone subcurves of the same Bezier curve, // check if they have a common left endpoint. if (_curve.is_same(cv._curve)) { if (left().is_same(cv.left()) || left().is_same(cv.right())) - *oi++ = Intersection_result(Intersection_point(left(), 0)); + *oi++ = Intersection_point(left(), 0); } // Compute the intersections of the two sucurves. Note that for caching @@ -341,7 +339,7 @@ public: // In case of overlap, just report the overlapping subcurve. if (do_ovlp) { - *oi++ = Intersection_result(ovlp_cv); + *oi++ = ovlp_cv; return oi; } @@ -349,14 +347,14 @@ public: // xy-lexicorgraphical order, and insert them to the output iterator. std::sort(ipts.begin(), ipts.end(), Less_intersection_point(cache)); for (auto ip_it = ipts.begin(); ip_it != ipts.end(); ++ip_it) { - *oi++ = Intersection_result(*ip_it); + *oi++ = *ip_it; } // In case we have two x-monotone subcurves of the same Bezier curve, // check if they have a common right endpoint. if (_curve.is_same(cv._curve)) { if (right().is_same(cv.left()) || right().is_same(cv.right())) { - *oi++ = Intersection_result(Intersection_point(right(), 0)); + *oi++ = Intersection_point(right(), 0); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h index c6f11cc8a34..f46489ba969 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h @@ -995,9 +995,6 @@ public: OutputIterator intersect(const Self& cv, OutputIterator oi, Intersection_map* inter_map = nullptr) const { - typedef std::pair Intersection_point; - typedef boost::variant Intersection_result; - // First check whether the two arcs have the same supporting curve. if (has_same_supporting_curve(cv)) { // Check for overlaps between the two arcs. @@ -1005,7 +1002,7 @@ public: if (_compute_overlap(cv, overlap)) { // There can be just a single overlap between two x-monotone arcs: - *oi++ = Intersection_result(overlap); + *oi++ = overlap; return oi; } @@ -1016,11 +1013,11 @@ public: // intersection points we report. Multiplicity mult = 0; if (left().equals(cv.left()) || left().equals(cv.right())) { - *oi++ = Intersection_result(std::make_pair(left(), mult)); + *oi++ = std::make_pair(left(), mult); } if (right().equals(cv.right()) || right().equals(cv.left())) { - *oi++ = Intersection_result(std::make_pair(right(), mult)); + *oi++ = std::make_pair(right(), mult); } return oi; @@ -1072,7 +1069,7 @@ public: if (this->_is_between_endpoints (iter->first) && cv._is_between_endpoints (iter->first)) { - *oi++ = Intersection_result(*iter); + *oi++ = *iter; } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h index 20ccbe9c758..9c0cda934db 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h @@ -125,7 +125,7 @@ public: template OutputIterator operator()(const Curve_2& line, OutputIterator oi) const { - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; *oi++ = Make_x_monotone_result(line); return oi; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h index b2354fe9895..f712190f0df 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include @@ -1249,7 +1249,7 @@ public: OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { // Wrap the segment with a variant. - typedef boost::variant + typedef std::variant Make_x_monotone_result; *oi++ = Make_x_monotone_result(cv); return oi; @@ -1326,8 +1326,6 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; CGAL_precondition(! cv1.is_degenerate()); CGAL_precondition(! cv2.is_degenerate()); @@ -1340,7 +1338,7 @@ public: if (! res) return oi; // Check whether we have a single intersection point. - const Point_2* ip = boost::get(&*res); + const Point_2* ip = std::get_if(&*res); if (ip != nullptr) { // Check whether the intersection point ip lies on both segments. const bool ip_on_cv1 = cv1.is_vertical() ? @@ -1354,7 +1352,7 @@ public: // Create a pair representing the point with its multiplicity, // which is always 1 for line segments. Intersection_point ip_mult(*ip, 1); - *oi++ = Intersection_result(ip_mult); + *oi++ = ip_mult; } } return oi; @@ -1398,14 +1396,14 @@ public: if (cmp_res == SMALLER) { // We have discovered a true overlapping subcurve: - *oi++ = Intersection_result(ovlp); + *oi++ = ovlp; } else if (cmp_res == EQUAL) { // The two objects have the same supporting line, but they just share // a common endpoint. Thus we have an intersection point, but we leave // the multiplicity of this point undefined. Intersection_point ip_mult(ovlp.left(), 0); - *oi++ = Intersection_result(ip_mult); + *oi++ = ip_mult; } return oi; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h index 42d0457c32b..58acefda211 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h @@ -27,7 +27,7 @@ * functors required by the concept it models. */ -#include +#include #include #include @@ -131,7 +131,7 @@ public: OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { // Wrap the segment with a variant. - typedef boost::variant + typedef std::variant Make_x_monotone_result; *oi++ = Make_x_monotone_result(cv); return oi; @@ -224,8 +224,6 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; const Kernel& kernel = m_traits; auto res = kernel.intersect_2_object()(cv1, cv2); @@ -234,19 +232,19 @@ public: if (! res) return oi; // Check if the intersection is a point: - const Point_2* p_p = boost::get(&*res); + const Point_2* p_p = std::get_if(&*res); if (p_p != nullptr) { // Create a pair representing the point with its multiplicity, // which is always 1 for line segments for all practical purposes. // If the two segments intersect at their endpoints, then the // multiplicity is undefined, but we deliberately ignore it for // efficiency reasons. - *oi++ = Intersection_result(Intersection_point(*p_p, 1)); + *oi++ = Intersection_point(*p_p, 1); return oi; } // The intersection is a segment. - const X_monotone_curve_2* cv_p = boost::get(&*res); + const X_monotone_curve_2* cv_p = std::get_if(&*res); CGAL_assertion(cv_p != nullptr); Comparison_result cmp1 = m_traits.compare_endpoints_xy_2_object()(cv1); @@ -257,11 +255,11 @@ public: // in the overlap segment if (m_traits.compare_endpoints_xy_2_object()(*cv_p) != cmp1) { auto ctr_opposite = kernel.construct_opposite_segment_2_object(); - *oi++ = Intersection_result(ctr_opposite(*cv_p)); + *oi++ = ctr_opposite(*cv_p); return oi; } } - *oi++ = Intersection_result(*cv_p); + *oi++ = *cv_p; return oi; } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index 19a95a662f6..2951b1983fe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -24,7 +24,7 @@ */ #include -#include +#include #include #include #include @@ -231,7 +231,7 @@ overlay(const Arrangement_on_surface_2& arr1 xcvs_vec[i] = Ovl_x_monotone_curve_2(eit2->curve(), invalid_he1, he2); } - // Obtain a extended traits-class object and define the sweep-line visitor. + // Obtain an extended traits-class object and define the sweep-line visitor. const typename Arr_res::Traits_adaptor_2* traits_adaptor = arr.traits_adaptor(); @@ -284,8 +284,8 @@ overlay(const Arrangement_on_surface_2& arr1 if (vit1->is_isolated()) { typename Arr_a::Vertex_const_handle v1 = vit1; pts_vec[i++] = - Ovl_point_2(vit1->point(), boost::make_optional(Cell_handle_red(v1)), - boost::optional()); + Ovl_point_2(vit1->point(), std::make_optional(Cell_handle_red(v1)), + std::optional()); } } @@ -294,8 +294,8 @@ overlay(const Arrangement_on_surface_2& arr1 if (vit2->is_isolated()) { typename Arr_b::Vertex_const_handle v2 = vit2; pts_vec[i++] = - Ovl_point_2(vit2->point(), boost::optional(), - boost::make_optional(Cell_handle_blue(v2))); + Ovl_point_2(vit2->point(), std::optional(), + std::make_optional(Cell_handle_blue(v2))); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h index ce95e1da07a..b83ca0189e2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h @@ -411,7 +411,7 @@ public: } }; - /*! Obtain a Equal_2 function object. */ + /*! Obtain an `Equal_2` function object. */ Equal_2 equal_2_object() const { return (Equal_2(m_base_traits->equal_2_object())); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h index 71059ab2be4..61fe87106b5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h @@ -26,8 +26,8 @@ #include #include -#include -#include +#include +#include namespace CGAL { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index 8f28269f199..188343887bc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -75,7 +75,7 @@ Arr_trapezoid_ric_point_location::locate(const Point_2& p) const case TD::POINT: { //p is interior so it should fall on Td_active_vertex - Td_active_vertex& v (boost::get(tr)); + Td_active_vertex& v (std::get(tr)); CGAL_TRAP_PRINT_DEBUG("POINT"); CGAL_assertion(!v.vertex()->is_at_open_boundary()); return make_result(v.vertex()); @@ -84,7 +84,7 @@ Arr_trapezoid_ric_point_location::locate(const Point_2& p) const case TD::CURVE: { - Td_active_edge& e (boost::get(tr)); + Td_active_edge& e (std::get(tr)); Halfedge_const_handle h = e.halfedge(); CGAL_TRAP_PRINT_DEBUG("CURVE"); if ( m_traits->is_in_x_range_2_object()(h->curve(),p) && @@ -100,7 +100,7 @@ Arr_trapezoid_ric_point_location::locate(const Point_2& p) const case TD::TRAPEZOID: { - Td_active_trapezoid t (boost::get(tr)); + Td_active_trapezoid t (std::get(tr)); Halfedge_const_handle h = t.top(); CGAL_TRAP_PRINT_DEBUG("TRAPEZOID"); bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p)) @@ -160,7 +160,7 @@ Arr_trapezoid_ric_point_location:: _get_unbounded_face(const Td_map_item& item,const Point_2& p, Arr_not_all_sides_oblivious_tag) const { - Td_active_trapezoid tr (boost::get(item)); + Td_active_trapezoid tr (std::get(item)); // Halfedge_const_handle h = tr.top(); if (!tr.is_on_top_boundary() || !tr.is_on_bottom_boundary()) { //if one of top or bottom edges is defined @@ -184,13 +184,13 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p, Td_map_item& left_v_item = td.locate(tr.left(),td_lt); CGAL_assertion(td_lt == TD::POINT); Halfedge_const_handle he; - if (boost::get(&left_v_item) != nullptr) { - Td_active_vertex v(boost::get(left_v_item)); + if (std::get_if(&left_v_item) != nullptr) { + Td_active_vertex v(std::get(left_v_item)); he = v.cw_he(); } else { Td_active_fictitious_vertex - v(boost::get(left_v_item)); + v(std::get(left_v_item)); he = v.cw_he(); } //cw_he() holds the "smallest" curve clockwise starting from 12 o'clock @@ -216,13 +216,13 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p, Td_map_item& right_v_item = td.locate(tr.right(),td_lt); CGAL_assertion(td_lt == TD::POINT); Halfedge_const_handle he; - if (boost::get(&right_v_item)!= nullptr) { - Td_active_vertex v(boost::get(right_v_item)); + if (std::get_if(&right_v_item)!= nullptr) { + Td_active_vertex v(std::get(right_v_item)); he = v.cw_he(); } else { Td_active_fictitious_vertex - v(boost::get(right_v_item)); + v(std::get(right_v_item)); he = v.cw_he(); } //its cw_he() holds the "smallest" curve clockwise starting from @@ -270,13 +270,13 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const case TD::POINT: { //p fell on Td_active_vertex - Td_active_vertex& v (boost::get(item)); + Td_active_vertex& v (std::get(item)); return (make_result(v.vertex())); } break; case TD::CURVE: { - Td_active_edge& e (boost::get(item)); + Td_active_edge& e (std::get(item)); Halfedge_const_handle h = e.halfedge(); if ((shoot_up && h->direction() == ARR_LEFT_TO_RIGHT) || @@ -289,7 +289,7 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const break; case TD::TRAPEZOID: { - Td_active_trapezoid trpz (boost::get(item)); + Td_active_trapezoid trpz (std::get(item)); Halfedge_const_handle h = (shoot_up) ? trpz.top() : trpz.bottom(); bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p)) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h index 169864e1de1..9904b170542 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h @@ -22,7 +22,7 @@ */ #include -#include +#include #include @@ -92,9 +92,9 @@ public: // type flag + on boundaries flags, // left-bottom neighbor trapezoid, left-top neighbor trapezoid, // right-bottom neighbor trapezoid, right-top neighbor trapezoid - typedef Td_ninetuple, - boost::variant, - boost::variant, + std::variant, + std::variant >, Halfedge_const_handle, unsigned char, @@ -239,7 +239,7 @@ public: Curve_end v_ce(left()->curve_end()); ptr()->e2 = (std::shared_ptr)(new X_monotone_curve_2(v_ce.cv())); - //CGAL_assertion(boost::get>( &(ptr()->e2)) != nullptr); + //CGAL_assertion(std::get>( &(ptr()->e2)) != nullptr); ptr()->e1 = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END; @@ -443,8 +443,8 @@ public: CGAL_TD_INLINE Vertex_const_handle left_unsafe() const { CGAL_precondition(is_active()); - CGAL_assertion(boost::get(&(ptr()->e0)) != nullptr); - return boost::get(ptr()->e0); + CGAL_assertion(std::get(&(ptr()->e0)) != nullptr); + return std::get(ptr()->e0); } /*! Access trapezoid left. @@ -466,8 +466,8 @@ public: CGAL_TD_INLINE Vertex_const_handle right_unsafe() const { CGAL_precondition(is_active()); - CGAL_assertion(boost::get(&(ptr()->e1)) != nullptr); - return boost::get(ptr()->e1); + CGAL_assertion(std::get(&(ptr()->e1)) != nullptr); + return std::get(ptr()->e1); } /*! Access trapezoid right. @@ -489,8 +489,8 @@ public: CGAL_TD_INLINE Halfedge_const_handle bottom_unsafe () const { CGAL_precondition(is_active()); - CGAL_assertion(boost::get(&(ptr()->e2)) != nullptr); - return boost::get(ptr()->e2); + CGAL_assertion(std::get(&(ptr()->e2)) != nullptr); + return std::get(ptr()->e2); } /*! Access trapezoid bottom. @@ -526,8 +526,8 @@ public: CGAL_precondition(type() == TD_VERTEX); CGAL_precondition(!is_on_boundaries()); - CGAL_assertion(boost::get( &(ptr()->e0)) != nullptr); - return boost::get( ptr()->e0 ); + CGAL_assertion(std::get( &(ptr()->e0)) != nullptr); + return std::get( ptr()->e0 ); } CGAL_TD_INLINE std::pair curve_end_pair_for_boundary_rem_vtx() const @@ -536,13 +536,13 @@ public: CGAL_precondition(type() == TD_VERTEX); CGAL_precondition(is_on_boundaries()); - CGAL_assertion(boost::get( &(ptr()->e1)) != nullptr); - CGAL_assertion(boost::get >(&(ptr()->e2)) != nullptr); - X_monotone_curve_2* cv_ptr = (boost::get >(ptr()->e2)).get(); + CGAL_assertion(std::get( &(ptr()->e1)) != nullptr); + CGAL_assertion(std::get >(&(ptr()->e2)) != nullptr); + X_monotone_curve_2* cv_ptr = (std::get >(ptr()->e2)).get(); CGAL_assertion(cv_ptr != nullptr); Arr_curve_end ce = - (boost::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? + (std::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? ARR_MIN_END : ARR_MAX_END; return std::make_pair(cv_ptr, ce); @@ -554,13 +554,13 @@ public: CGAL_precondition(type() == TD_VERTEX); CGAL_precondition(is_on_boundaries()); - CGAL_assertion(boost::get( &(ptr()->e1)) != nullptr); - CGAL_assertion(boost::get >(&(ptr()->e2)) != nullptr); - X_monotone_curve_2* cv_ptr = (boost::get >(ptr()->e2)).get(); + CGAL_assertion(std::get( &(ptr()->e1)) != nullptr); + CGAL_assertion(std::get >(&(ptr()->e2)) != nullptr); + X_monotone_curve_2* cv_ptr = (std::get >(ptr()->e2)).get(); CGAL_assertion(cv_ptr != nullptr); Arr_curve_end ce = - (boost::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? + (std::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? ARR_MIN_END : ARR_MAX_END; return Curve_end(*cv_ptr, ce); @@ -571,13 +571,13 @@ public: CGAL_precondition(!is_active()); CGAL_precondition(type() == TD_VERTEX); - CGAL_assertion(boost::get( &(ptr()->e1)) != nullptr); - CGAL_assertion(boost::get >(&(ptr()->e2)) != nullptr); - X_monotone_curve_2* cv_ptr = (boost::get >(ptr()->e2)).get(); + CGAL_assertion(std::get( &(ptr()->e1)) != nullptr); + CGAL_assertion(std::get >(&(ptr()->e2)) != nullptr); + X_monotone_curve_2* cv_ptr = (std::get >(ptr()->e2)).get(); CGAL_assertion(cv_ptr != nullptr); Arr_curve_end ce = - (boost::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? + (std::get(ptr()->e1) == CGAL_TD_CV_MIN_END) ? ARR_MIN_END : ARR_MAX_END; return Curve_end(*cv_ptr, ce); @@ -587,8 +587,8 @@ public: { CGAL_precondition(!is_active() && type() == TD_EDGE); - CGAL_assertion(boost::get >(&(ptr()->e2)) != nullptr); - X_monotone_curve_2* cv_ptr = (boost::get >(ptr()->e2)).get(); + CGAL_assertion(std::get >(&(ptr()->e2)) != nullptr); + X_monotone_curve_2* cv_ptr = (std::get >(ptr()->e2)).get(); CGAL_assertion(cv_ptr != nullptr); return *cv_ptr; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h index f901bb72565..f08890e4623 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h @@ -21,7 +21,7 @@ */ #include -#include +#include #include @@ -145,13 +145,13 @@ public: //Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbors. */ - inline void init_neighbors(boost::optional next) + inline void init_neighbors(std::optional> next) { - set_next((next) ? *next : Td_map_item(0)); + set_next((next) ? next->get() : Td_map_item(0)); } /*! \copydoc init_neighbors * \deprecated please use #init_neighbors */ - CGAL_DEPRECATED inline void init_neighbours(boost::optional next) + CGAL_DEPRECATED inline void init_neighbours(std::optional> next) { init_neighbors(next); } /*! Set the DAG node. */ @@ -199,10 +199,10 @@ public: /*! Constructor given Vertex & Halfedge handles. */ Td_active_edge (Halfedge_const_handle he , Dag_node* node = 0, - boost::optional next = boost::none) + std::optional> next = std::nullopt) { - PTR = new Data(he, (next) ? *next : Td_map_item(0), node); + PTR = new Data(he, (next) ? next->get() : Td_map_item(0), node); //m_dag_node = node; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h index 06e13b29c24..f709a463bc1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h @@ -21,7 +21,7 @@ */ #include -#include +#include #include #ifdef CGAL_TD_DEBUG diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h index 06b384daed9..6b9486e4e60 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #ifdef CGAL_TD_DEBUG @@ -163,18 +163,18 @@ private: //Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbors. */ - inline void init_neighbors(boost::optional lb, boost::optional lt, - boost::optional rb, boost::optional rt) + inline void init_neighbors(std::optional> lb, std::optional> lt, + std::optional> rb, std::optional> rt) { - set_lb((lb) ? *lb : Td_map_item(0)); - set_lt((lt) ? *lt : Td_map_item(0)); - set_rb((rb) ? *rb : Td_map_item(0)); - set_rt((rt) ? *rt : Td_map_item(0)); + set_lb((lb) ? lb->get() : Td_map_item(0)); + set_lt((lt) ? lt->get() : Td_map_item(0)); + set_rb((rb) ? rb->get() : Td_map_item(0)); + set_rt((rt) ? rt->get() : Td_map_item(0)); } /*! \copydoc init_neighbors * \deprecated please use #init_neighbors */ - CGAL_DEPRECATED inline void init_neighbours(boost::optional lb, boost::optional lt, - boost::optional rb, boost::optional rt) + CGAL_DEPRECATED inline void init_neighbours(std::optional> lb, std::optional> lt, + std::optional> rb, std::optional> rt) { init_neighbors(lb, lt, rb, rt); } /*! Set the DAG node. */ @@ -267,14 +267,14 @@ private: /*! Constructor given Vertex & Halfedge handles. */ Td_active_trapezoid (Vertex_const_handle l, Vertex_const_handle r, Halfedge_const_handle b, Halfedge_const_handle t, - boost::optional lb = boost::none, - boost::optional lt = boost::none, - boost::optional rb = boost::none, - boost::optional rt = boost::none, + std::optional> lb = std::nullopt, + std::optional> lt = std::nullopt, + std::optional> rb = std::nullopt, + std::optional> rt = std::nullopt, Dag_node* node = 0) { - PTR = new Data (l, r, b, t, (lb) ? *lb : Td_map_item(0), (lt) ? *lt : Td_map_item(0), - (rb) ? *rb : Td_map_item(0), (rt) ? *rt : Td_map_item(0), node); + PTR = new Data (l, r, b, t, (lb) ? lb->get() : Td_map_item(0), (lt) ? lt->get() : Td_map_item(0), + (rb) ? rb->get() : Td_map_item(0), (rt) ? rt->get() : Td_map_item(0), node); //m_dag_node = node; } @@ -459,14 +459,14 @@ private: Td_map_item item (*this); - if (ptr()->rb.which() != 0) + if (ptr()->rb.index() != 0) { - Self tr(boost::get(rb())); + Self tr(std::get(rb())); tr.set_lb(item); } - if (ptr()->rt.which() != 0) + if (ptr()->rt.index() != 0) { - Self tr(boost::get(rt())); + Self tr(std::get(rt())); tr.set_lt(item); } CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary()); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h index 514686d303d..23cbc480c9b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h @@ -21,7 +21,7 @@ */ #include -#include +#include #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag_node.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag_node.h index 72fd48526c8..340bb0b6d7a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag_node.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag_node.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace CGAL { @@ -112,7 +112,7 @@ protected: public: - class clear_neighbors_visitor : public boost::static_visitor< void > + class clear_neighbors_visitor { public: void operator()(Td_active_trapezoid& t) const @@ -142,7 +142,7 @@ protected: //d'tor ~Node() { - boost::apply_visitor(clear_neighbors_visitor(), m_data); + std::visit(clear_neighbors_visitor(), m_data); } bool is_inner_node() const //MICHAL: a node with only left child (like removed node) will be considered as a leaf diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h index 55c8e5a457b..97de5cae60a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h @@ -21,7 +21,7 @@ */ #include -#include +#include #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h index db3019d46b7..eea96c8327f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h @@ -21,7 +21,7 @@ */ #include -#include +#include #ifdef CGAL_TD_DEBUG diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h index 908be87c078..312d7d8c506 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h @@ -21,7 +21,7 @@ */ #include -#include +#include #ifdef CGAL_TD_DEBUG diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h index e9cad94daf8..76640144604 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h @@ -21,7 +21,7 @@ */ #include -#include +#include #ifdef CGAL_TD_DEBUG diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h index 45ba665a1d5..391fb264658 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h @@ -113,7 +113,7 @@ public: Td_inactive_fictitious_vertex; //! type of td map item (Td_halfedge, Td_vertex or Td_trapezoid) - typedef boost::variant< Td_nothing, + typedef std::variant< Td_nothing, Td_active_trapezoid, Td_inactive_trapezoid, Td_active_edge, Td_inactive_edge, Td_active_vertex, Td_active_fictitious_vertex, @@ -895,8 +895,8 @@ public: CGAL_precondition(is_active(left_item) && is_active(right_item)); CGAL_precondition(is_td_trapezoid(left_item) && is_td_trapezoid(right_item)); - Td_active_trapezoid left (boost::get(left_item)); - Td_active_trapezoid right(boost::get(right_item)); + Td_active_trapezoid left (std::get(left_item)); + Td_active_trapezoid right(std::get(right_item)); if (left.is_on_bottom_boundary()) return (right.is_on_bottom_boundary()); @@ -915,8 +915,8 @@ public: CGAL_precondition(is_active(left_item) && is_active(right_item)); CGAL_precondition(is_td_trapezoid(left_item) && is_td_trapezoid(right_item)); - Td_active_trapezoid left (boost::get(left_item)); - Td_active_trapezoid right(boost::get(right_item)); + Td_active_trapezoid left (std::get(left_item)); + Td_active_trapezoid right(std::get(right_item)); if (left.is_on_top_boundary()) return (right.is_on_top_boundary()); @@ -957,13 +957,13 @@ public: //returns true if the trapezoid is a curve bool is_empty_item(const Td_map_item& tr) const { - return (tr.which() == 0); + return (tr.index() == 0); } //returns true if the trapezoid is a point or a curve bool is_trapezoid(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_TRAPEZOID: case TD_INACTIVE_TRAPEZOID: @@ -976,7 +976,7 @@ public: //returns true if the map item is a vertex bool is_td_vertex(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_VERTEX: case TD_ACTIVE_FICTITIOUS_VERTEX: @@ -991,7 +991,7 @@ public: //returns true if the map item is an edge bool is_td_edge(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_EDGE: case TD_INACTIVE_EDGE: @@ -1004,7 +1004,7 @@ public: //returns true if the map item is an edge bool is_td_trapezoid(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_TRAPEZOID: case TD_INACTIVE_TRAPEZOID: @@ -1017,7 +1017,7 @@ public: //returns true if the trapezoid is a curve bool is_fictitious_vertex(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_FICTITIOUS_VERTEX: case TD_INACTIVE_FICTITIOUS_VERTEX: @@ -1030,7 +1030,7 @@ public: //returns true if the trapezoid is a curve bool is_active(const Td_map_item& tr) const { - switch (tr.which()) + switch (tr.index()) { case TD_ACTIVE_TRAPEZOID: case TD_ACTIVE_EDGE: @@ -1049,7 +1049,7 @@ public: CGAL_precondition(is_active(item)); //MICHAL: assumes item is of active edge item - also fails in case of a vertical asymptote //MICHAL: check when this is used exactly - Td_active_edge& e (boost::get(item)); + Td_active_edge& e (std::get(item)); Halfedge_const_handle he = e.halfedge(); return (this->compare_curve_end_x_2_object() (Curve_end(he,ARR_MIN_END), Curve_end(he,ARR_MAX_END))== EQUAL); @@ -1061,7 +1061,7 @@ public: { CGAL_precondition( is_active(item) ); CGAL_precondition( is_td_trapezoid(item) ); - Td_active_trapezoid tr (boost::get(item)); + Td_active_trapezoid tr (std::get(item)); return ( tr.is_on_left_boundary() || diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h index 097e12d0dcb..1a3549c0008 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -93,16 +93,16 @@ struct Non_recursive_td_map_item_destructor void operator()(Td_active_trapezoid& item) { - boost::apply_visitor(m_child_visitor, item.lb()); - boost::apply_visitor(m_child_visitor, item.lt()); - boost::apply_visitor(m_child_visitor, item.rb()); - boost::apply_visitor(m_child_visitor, item.rt()); + std::visit(m_child_visitor, item.lb()); + std::visit(m_child_visitor, item.lt()); + std::visit(m_child_visitor, item.rb()); + std::visit(m_child_visitor, item.rt()); item.clear_neighbors(); } void operator()(Td_active_edge& item) { - boost::apply_visitor(m_child_visitor, item.next()); + std::visit(m_child_visitor, item.next()); item.set_next(Td_map_item(0)); } @@ -124,7 +124,7 @@ struct Non_recursive_td_map_item_destructor { Td_map_item item = queue.back(); queue.pop_back(); - boost::apply_visitor(item_visitor, item); + std::visit(item_visitor, item); } } @@ -138,7 +138,7 @@ struct Non_recursive_td_map_item_destructor { Td_map_item item = queue.back(); queue.pop_back(); - boost::apply_visitor(item_visitor, item); + std::visit(item_visitor, item); } } }; @@ -272,7 +272,7 @@ public: Base_map_item_iterator() : traits(0), m_cur_item(Td_map_item(0)){ } Base_map_item_iterator(const Traits* traits_, - boost::optional curr = boost::none) + std::optional curr = std::nullopt) :traits(traits_), m_cur_item((curr) ? *curr : Td_map_item(0) ) { } Base_map_item_iterator(const Base_map_item_iterator &it) @@ -332,12 +332,12 @@ public: public: //constructors In_face_iterator(const Traits* traits_, Halfedge_const_handle sep, - boost::optional curr = boost::none) + std::optional> curr = std::nullopt) :Base_map_item_iterator(traits_,curr), m_sep(sep->curve()) { } In_face_iterator(const Traits* traits_, const X_monotone_curve_2& sep, - boost::optional curr = boost::none) + std::optional> curr = std::nullopt) :Base_map_item_iterator(traits_,curr), m_sep(sep) { } @@ -384,7 +384,7 @@ public: if (traits->is_td_trapezoid(m_cur_item)) { //if the map item is a trapezoid - Td_active_trapezoid tr (boost::get(m_cur_item)); + Td_active_trapezoid tr (std::get(m_cur_item)); #ifndef CGAL_TD_DEBUG CGAL_warning_code(Dag_node* tt = tr.dag_node();) @@ -436,7 +436,7 @@ public: { //if the map item is an edge - Td_active_edge e (boost::get(m_cur_item)); + Td_active_edge e (std::get(m_cur_item)); CGAL_assertion_code(Dag_node* tt = e.dag_node();) CGAL_assertion(tt != nullptr); CGAL_assertion(tt->is_inner_node()); @@ -453,7 +453,7 @@ public: while(traits->is_td_vertex(m_cur_item)) { Dag_node* node = - boost::apply_visitor(dag_node_visitor(),m_cur_item); + std::visit(dag_node_visitor(),m_cur_item); m_cur_item = node->left_child().get_data(); } @@ -481,7 +481,7 @@ public: CGAL_precondition (!traits->is_empty_item(m_cur_item)); CGAL_precondition (traits->is_active(m_cur_item) && traits->is_td_trapezoid(m_cur_item)); - return boost::get(m_cur_item); + return std::get(m_cur_item); } Td_active_edge& e() @@ -489,13 +489,13 @@ public: CGAL_precondition (!traits->is_empty_item(m_cur_item)); CGAL_precondition (traits->is_active(m_cur_item) && traits->is_td_edge(m_cur_item)); - return boost::get(m_cur_item); + return std::get(m_cur_item); } }; /*! Visitors for accessing td map items methods */ - class rb_visitor : public boost::static_visitor + class rb_visitor { public: Td_map_item operator()(Td_active_trapezoid& t) const @@ -511,7 +511,7 @@ public: } }; - class set_rb_visitor : public boost::static_visitor + class set_rb_visitor { public: set_rb_visitor (const Td_map_item& rb) : m_rb(rb) {} @@ -532,7 +532,7 @@ public: const Td_map_item& m_rb; }; - class rt_visitor : public boost::static_visitor + class rt_visitor { public: Td_map_item operator()(Td_active_trapezoid& t) const @@ -548,7 +548,7 @@ public: } }; - class set_rt_visitor : public boost::static_visitor + class set_rt_visitor { public: set_rt_visitor (const Td_map_item& rt) : m_rt(rt) {} @@ -568,7 +568,7 @@ public: const Td_map_item& m_rt; }; - class lb_visitor : public boost::static_visitor + class lb_visitor { public: Td_map_item operator()(Td_active_trapezoid& t) const @@ -584,7 +584,7 @@ public: } }; - class set_lb_visitor : public boost::static_visitor + class set_lb_visitor { public: set_lb_visitor (const Td_map_item& lb) : m_lb(lb) {} @@ -604,7 +604,7 @@ public: const Td_map_item& m_lb; }; - class set_lt_visitor : public boost::static_visitor + class set_lt_visitor { public: set_lt_visitor (const Td_map_item& lt) : m_lt(lt) {} @@ -624,7 +624,7 @@ public: const Td_map_item& m_lt; }; - class bottom_he_visitor : public boost::static_visitor + class bottom_he_visitor { public: Halfedge_const_handle operator()(Td_active_trapezoid& t) const @@ -640,7 +640,7 @@ public: } }; - class set_bottom_he_visitor : public boost::static_visitor< void > + class set_bottom_he_visitor { public: set_bottom_he_visitor (Halfedge_const_handle he) : m_bottom_he(he) {} @@ -659,7 +659,7 @@ public: Halfedge_const_handle m_bottom_he; }; - class top_he_visitor : public boost::static_visitor + class top_he_visitor { public: Halfedge_const_handle operator()(Td_active_trapezoid& t) const @@ -675,7 +675,7 @@ public: } }; - class set_top_he_visitor : public boost::static_visitor + class set_top_he_visitor { public: set_top_he_visitor (Halfedge_const_handle he) : m_top_he(he) {} @@ -694,7 +694,7 @@ public: Halfedge_const_handle m_top_he; }; - class cw_he_visitor : public boost::static_visitor< Halfedge_const_handle > + class cw_he_visitor { public: Halfedge_const_handle operator()(Td_active_vertex& t) const @@ -716,7 +716,8 @@ public: /*! A visitor to set the cw halfedge of a vertex node. */ - class set_cw_he_visitor : public boost::static_visitor { + class set_cw_he_visitor + { public: set_cw_he_visitor(Halfedge_const_handle he) : m_cw_he(he) {} @@ -734,7 +735,8 @@ public: /*! A visitor to reset the cw halfedge of a vertex node. */ - class reset_cw_he_visitor : public boost::static_visitor { + class reset_cw_he_visitor + { public: void operator()(Td_active_vertex& t) const { t.reset_cw_he(); } @@ -744,7 +746,7 @@ public: void operator()(T& /*t*/) const { CGAL_assertion(false); } }; - class dag_node_visitor : public boost::static_visitor + class dag_node_visitor { public: Dag_node* operator()(Td_nothing& /* t */) const @@ -765,7 +767,7 @@ public: } }; - class set_dag_node_visitor : public boost::static_visitor + class set_dag_node_visitor { public: set_dag_node_visitor(Dag_node* node):m_node(node) {} @@ -789,30 +791,29 @@ public: Dag_node* m_node; }; - class curve_end_for_fict_vertex_visitor : - public boost::static_visitor > + class curve_end_for_fict_vertex_visitor { public: - boost::optional operator()(Td_active_fictitious_vertex& t) const + std::optional operator()(Td_active_fictitious_vertex& t) const { return t.curve_end(); } - boost::optional + std::optional operator()(Td_inactive_fictitious_vertex& t) const { return t.curve_end(); } template < typename T > - boost::optional operator()(T& /* t */) const + std::optional operator()(T& /* t */) const { CGAL_assertion(false); - return boost::none; + return std::nullopt; } }; - class point_for_vertex_visitor : public boost::static_visitor< Point > + class point_for_vertex_visitor { public: Point operator()(Td_active_vertex& t) const @@ -833,30 +834,28 @@ public: } }; - class curve_end_for_active_vertex_visitor : - public boost::static_visitor > + class curve_end_for_active_vertex_visitor { public: - boost::optional operator()(Td_active_vertex& t) const + std::optional operator()(Td_active_vertex& t) const { return t.curve_end(); } - boost::optional operator()(Td_active_fictitious_vertex& t) const + std::optional operator()(Td_active_fictitious_vertex& t) const { return t.curve_end(); } template < typename T > - boost::optional operator()(T& /* t */) const + std::optional operator()(T& /* t */) const { CGAL_assertion(false); - return boost::none; + return std::nullopt; } }; - class vertex_for_active_vertex_visitor : - public boost::static_visitor + class vertex_for_active_vertex_visitor { public: Vertex_const_handle operator()(Td_active_vertex& t) const @@ -877,27 +876,26 @@ public: } }; - class cv_for_edge_visitor : - public boost::static_visitor > + class cv_for_edge_visitor { public: - boost::optional + std::optional> operator()(Td_active_edge& t) const { return t.halfedge()->curve(); } - boost::optional + std::optional> operator()(Td_inactive_edge& t) const { return t.curve(); } template - boost::optional operator()(T& /* t */) const + std::optional> operator()(T& /* t */) const { CGAL_assertion(false); - return boost::none; + return std::nullopt; } }; @@ -998,11 +996,11 @@ protected: bool is_fict_vtx = traits->is_fictitious_vertex(vtx_item); if (is_fict_vtx) { return (compare(t, - *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(), + *(std::visit(curve_end_for_fict_vertex_visitor(), vtx_item))) == SMALLER); } else { - return (compare(t, boost::apply_visitor(point_for_vertex_visitor(), + return (compare(t, std::visit(point_for_vertex_visitor(), vtx_item)) == SMALLER); } } @@ -1039,12 +1037,12 @@ protected: bool is_fict_vtx = traits->is_fictitious_vertex(vtx_item); if (is_fict_vtx) { return (compare(t, - *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(), + *(std::visit(curve_end_for_fict_vertex_visitor(), vtx_item))) == LARGER); } else { return (compare(t, - boost::apply_visitor(point_for_vertex_visitor(), + std::visit(point_for_vertex_visitor(), vtx_item)) == LARGER); } } @@ -1058,12 +1056,12 @@ protected: bool is_fict_vtx = traits->is_fictitious_vertex(vtx_item); if (is_fict_vtx) { return equal(t, - *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(), + *(std::visit(curve_end_for_fict_vertex_visitor(), vtx_item))); } else { return equal(t, - boost::apply_visitor(point_for_vertex_visitor(), + std::visit(point_for_vertex_visitor(), vtx_item)); } } @@ -1090,24 +1088,24 @@ protected: //if ( traits->is_fictitious_vertex(item) ) //{ // CGAL_precondition(traits->equal_curve_end_2_object() - // (Curve_end(cv,ARR_MIN_END), *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),item)))); + // (Curve_end(cv,ARR_MIN_END), *(std::visit(curve_end_for_fict_vertex_visitor(),item)))); //} //else //{ // CGAL_precondition(traits->equal_curve_end_2_object() - // (Curve_end(cv,ARR_MIN_END), boost::apply_visitor(point_for_vertex_visitor(), item))); + // (Curve_end(cv,ARR_MIN_END), std::visit(point_for_vertex_visitor(), item))); //} //find the node of the curve's leftmost trapezoid Dag_node cv_leftmost_node(left_cv_end_node.right_child()); if (traits->is_fictitious_vertex(item) ) { - Curve_end ce( *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(), + Curve_end ce( *(std::visit(curve_end_for_fict_vertex_visitor(), item))); search_using_dag_with_cv(cv_leftmost_node, traits, ce, &cv, cres); } else { - Point p( boost::apply_visitor(point_for_vertex_visitor(), item)); + Point p( std::visit(point_for_vertex_visitor(), item)); search_using_dag_with_cv(cv_leftmost_node, traits, p, &cv, cres); } return cv_leftmost_node; @@ -1159,8 +1157,8 @@ protected: if (traits->is_empty_item(left_item) || traits->is_empty_item(right_item)) return false; - Td_active_trapezoid& left (boost::get(left_item)); - Td_active_trapezoid& right (boost::get(right_item)); + Td_active_trapezoid& left (std::get(left_item)); + Td_active_trapezoid& right (std::get(right_item)); if (traits->is_trapezoids_top_equal(left,right) && traits->is_trapezoids_bottom_equal(left,right) && @@ -1966,7 +1964,7 @@ public: for (typename std::list::iterator it = representatives.begin(); it != representatives.end(); ++it) { - Td_active_edge e(boost::get(*it)); + Td_active_edge e(std::get(*it)); container.push_back(e.halfedge()); //it represents an active trapezoid } } @@ -2152,7 +2150,7 @@ private: // traits may be initialized later m_dag_root = new Dag_node(Td_active_trapezoid()); //(*m_dag_root)->set_dag_node(m_dag_root); - boost::apply_visitor(set_dag_node_visitor(m_dag_root), + std::visit(set_dag_node_visitor(m_dag_root), m_dag_root->get_data()); m_number_of_curves = 0; @@ -2200,11 +2198,11 @@ private: //{ // if ( traits->is_fictitious_vertex(item) ) // { - // res = traits->equal_curve_end_2_object()(ce, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),item))); + // res = traits->equal_curve_end_2_object()(ce, *(std::visit(curve_end_for_fict_vertex_visitor(),item))); // } // else // { - // res = traits->equal_curve_end_2_object()(ce, boost::apply_visitor(point_for_vertex_visitor(), item)); + // res = traits->equal_curve_end_2_object()(ce, std::visit(point_for_vertex_visitor(), item)); // } //} if (traits->is_td_trapezoid(item)) @@ -2218,11 +2216,11 @@ private: //{ // if ( traits->is_fictitious_vertex(item) ) // { - // res = traits->equal_curve_end_2_object()(ce, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),item))); + // res = traits->equal_curve_end_2_object()(ce, *(std::visit(curve_end_for_fict_vertex_visitor(),item))); // } // else // { - // res = traits->equal_curve_end_2_object()(ce, boost::apply_visitor(point_for_vertex_visitor(), item)); + // res = traits->equal_curve_end_2_object()(ce, std::visit(point_for_vertex_visitor(), item)); // } //} if (traits->is_td_trapezoid(item)) @@ -2234,7 +2232,7 @@ private: lt=POINT; else { - Td_active_trapezoid tr (boost::get(item)); + Td_active_trapezoid tr (std::get(item)); lt = tr.is_on_boundaries()? UNBOUNDED_TRAPEZOID : TRAPEZOID; } } @@ -2343,12 +2341,12 @@ private: // if the map item represents a fictitious vertex if (traits->is_fictitious_vertex(item)) { - const Curve_end left_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),item))); + const Curve_end left_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),item))); print_ce_data(left_ce.cv(), left_ce.ce(), out); } else // if the map item represents a vertex { - Point p = boost::apply_visitor(point_for_vertex_visitor(),item); + Point p = std::visit(point_for_vertex_visitor(),item); print_point_data(p, out); } out << " (void *)left_child: " << (void*)(&(curr.left_child())) @@ -2363,7 +2361,7 @@ private: { // bool is_active = traits->is_active(item); // if the map item represents an edge - const X_monotone_curve_2& he_cv = *(boost::apply_visitor(cv_for_edge_visitor(), item)); + const X_monotone_curve_2& he_cv = *(std::visit(cv_for_edge_visitor(), item)); // so top() is a real Halfedge with a curve() if curr is active // or curr holds the curve if curr is not active diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h index 15c72e81945..9b0a7617114 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h @@ -52,7 +52,7 @@ split_trapezoid_by_vertex(Dag_node& split_node, Dag_node left_node, right_node; if (traits->is_td_trapezoid(curr_item)) { - Td_active_trapezoid& tr(boost::get(curr_item)); + Td_active_trapezoid& tr(std::get(curr_item)); CGAL_warning(traits->is_in_closure(tr, traits->vtx_to_ce(v))); @@ -63,9 +63,9 @@ split_trapezoid_by_vertex(Dag_node& split_node, (v, tr.right(), tr.bottom(), tr.top())); Td_active_trapezoid& - left_tr(boost::get(left_node.get_data())); + left_tr(std::get(left_node.get_data())); Td_active_trapezoid& - right_tr(boost::get(right_node.get_data())); + right_tr(std::get(right_node.get_data())); CGAL_warning(traits->is_trapezoids_top_equal(left_tr,right_tr)); CGAL_warning(traits->is_trapezoids_bottom_equal(left_tr,right_tr)); @@ -77,25 +77,25 @@ split_trapezoid_by_vertex(Dag_node& split_node, right_tr.init_neighbors(left_node.get_data(), left_node.get_data(), tr.rb(), tr.rt()); if (!traits->is_empty_item(tr.lb())) { - Td_active_trapezoid& lb(boost::get(tr.lb())); + Td_active_trapezoid& lb(std::get(tr.lb())); lb.set_rb(left_node.get_data()); } if (!traits->is_empty_item(tr.lt())) { - Td_active_trapezoid& lt(boost::get(tr.lt())); + Td_active_trapezoid& lt(std::get(tr.lt())); lt.set_rt(left_node.get_data()); } if (!traits->is_empty_item(tr.rb())) { - Td_active_trapezoid& rb(boost::get(tr.rb())); + Td_active_trapezoid& rb(std::get(tr.rb())); rb.set_lb(right_node.get_data()); } if (!traits->is_empty_item(tr.rt())) { - Td_active_trapezoid& rt(boost::get(tr.rt())); + Td_active_trapezoid& rt(std::get(tr.rt())); rt.set_lt(right_node.get_data()); } } else { // the curr_item is an edge - Td_active_edge& e(boost::get(curr_item)); + Td_active_edge& e(std::get(curr_item)); CGAL_warning(traits->is_in_closure(e, traits->vtx_to_ce(v))); @@ -103,13 +103,13 @@ split_trapezoid_by_vertex(Dag_node& split_node, right_node.set_data(Td_active_edge(e.halfedge())); - Td_active_edge& left_e(boost::get(left_node.get_data())); - Td_active_edge& right_e(boost::get(right_node.get_data())); + Td_active_edge& left_e(std::get(left_node.get_data())); + Td_active_edge& right_e(std::get(right_node.get_data())); //CGAL_warning(left_e.is_on_left_boundary() == e.is_on_left_boundary()); //CGAL_warning(right_e.is_on_right_boundary() == e.is_on_right_boundary()); - left_e.init_neighbors(boost::none); + left_e.init_neighbors(std::nullopt); //left_e.init_neighbors(e.lb(),e.lt(),Td_map_item(),right_node.get_data()); right_e.init_neighbors(e.next()); //right_e.init_neighbors(left_node.get_data(),left_node.get_data(),e.rb(),e.rt()); @@ -132,10 +132,10 @@ split_trapezoid_by_vertex(Dag_node& split_node, const Dag_node* left_ptr = &split_node.left_child(); const Dag_node* right_ptr = &split_node.right_child(); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)left_ptr), + std::visit(set_dag_node_visitor((Dag_node*)left_ptr), left_ptr->get_data()); //(*left_ptr)->set_dag_node((Dag_node*)left_ptr); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)right_ptr), + std::visit(set_dag_node_visitor((Dag_node*)right_ptr), right_ptr->get_data()); //(*right_ptr)->set_dag_node((Dag_node*)right_ptr); @@ -219,7 +219,7 @@ deactivate_trapezoid(Dag_node& trpz_node, Dag_node* active_node) const CGAL_precondition(traits->is_active(trpz_node.get_data())); CGAL_precondition(traits->is_td_trapezoid(trpz_node.get_data())); if (Td_active_trapezoid* trap = - boost::get(&trpz_node.get_data())) + std::get_if(&trpz_node.get_data())) trap->non_recursive_clear_neighbors(); trpz_node.set_data(Td_inactive_trapezoid()); if (active_node) trpz_node.set_left_child(*active_node); @@ -233,11 +233,11 @@ deactivate_vertex(Dag_node& vtx_node) const CGAL_precondition(traits->is_td_vertex(vtx_node.get_data())); if (traits->is_fictitious_vertex(vtx_node.get_data())) { Td_active_fictitious_vertex& - v(boost::get(vtx_node.get_data())); + v(std::get(vtx_node.get_data())); vtx_node.set_data(Td_inactive_fictitious_vertex(v.vertex(), &vtx_node)); } else { - Td_active_vertex& v(boost::get(vtx_node.get_data())); + Td_active_vertex& v(std::get(vtx_node.get_data())); vtx_node.set_data(Td_inactive_vertex(v.vertex(), &vtx_node)); } } @@ -274,7 +274,7 @@ split_trapezoid_by_halfedge(Dag_node& split_node, CGAL_precondition(traits->is_td_trapezoid(split_node.get_data())); Td_map_item curr_item(split_node.get_data()); - Td_active_trapezoid& split_tr = boost::get(curr_item); + Td_active_trapezoid& split_tr = std::get(curr_item); // sets left and right according to td_edge's source and target positions // sets bottom and top to Halfedge itself @@ -303,37 +303,37 @@ split_trapezoid_by_halfedge(Dag_node& split_node, // CGAL_TD_ON_BOTTOM_BOUNDARY ))); Td_active_trapezoid& bottom = - boost::get(bottom_node.get_data()); + std::get(bottom_node.get_data()); Td_active_trapezoid& top = - boost::get(top_node.get_data()); + std::get(top_node.get_data()); - top.init_neighbors(prev_top_tr, split_tr.lt(), boost::none , split_tr.rt()); + top.init_neighbors(prev_top_tr, split_tr.lt(), std::nullopt , split_tr.rt()); bottom.init_neighbors(split_tr.lb(), prev_bottom_tr, split_tr.rb(), - boost::none); + std::nullopt); if (!traits->is_empty_item(prev_bottom_tr)) { Td_active_trapezoid& - prev_btm(boost::get(prev_bottom_tr)); + prev_btm(std::get(prev_bottom_tr)); prev_btm.set_rt(bottom_node.get_data()); } if (!traits->is_empty_item(prev_top_tr)) { - Td_active_trapezoid& prev_top(boost::get(prev_top_tr)); + Td_active_trapezoid& prev_top(std::get(prev_top_tr)); prev_top.set_rb(top_node.get_data()); } if (!traits->is_empty_item(split_tr.lb())) { - Td_active_trapezoid& lb(boost::get(split_tr.lb())); + Td_active_trapezoid& lb(std::get(split_tr.lb())); lb.set_rb(bottom_node.get_data()); } if (!traits->is_empty_item(split_tr.lt())) { - Td_active_trapezoid& lt(boost::get(split_tr.lt())); + Td_active_trapezoid& lt(std::get(split_tr.lt())); lt.set_rt(top_node.get_data()); } if (!traits->is_empty_item(split_tr.rb())) { - Td_active_trapezoid& rb(boost::get(split_tr.rb())); + Td_active_trapezoid& rb(std::get(split_tr.rb())); rb.set_lb(bottom_node.get_data()); } if (!traits->is_empty_item(split_tr.rt())) { - Td_active_trapezoid& rt(boost::get(split_tr.rt())); + Td_active_trapezoid& rt(std::get(split_tr.rt())); rt.set_lt(top_node.get_data()); } split_node.replace(sep,bottom_node,top_node); //nodes depth are updated here @@ -348,14 +348,14 @@ split_trapezoid_by_halfedge(Dag_node& split_node, const Dag_node* bottomPtr = &split_node.left_child(); const Dag_node* topPtr = &split_node.right_child(); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)bottomPtr), + std::visit(set_dag_node_visitor((Dag_node*)bottomPtr), bottomPtr->get_data()); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)topPtr), + std::visit(set_dag_node_visitor((Dag_node*)topPtr), topPtr->get_data()); - // Td_active_edge& new_e = boost::get(split_node.get_data()); + // Td_active_edge& new_e = std::get(split_node.get_data()); if (!traits->is_empty_item(prev_e)) { - Td_active_edge& e( boost::get(prev_e)); + Td_active_edge& e( std::get(prev_e)); e.set_next(split_node.get_data()); } //update these trapezoids pointers. @@ -404,14 +404,14 @@ update_vtx_with_new_edge(Halfedge_const_handle he, //set cw to hold the halfedge whose source is p, // which is clockwise "smallest" starting from top (12 o'clock) - Halfedge_const_handle cw_he(boost::apply_visitor(cw_he_visitor(), vtx_item)); + Halfedge_const_handle cw_he(std::visit(cw_he_visitor(), vtx_item)); if (traits->compare_cw_around_point_2_object()(he->curve(), is_edge_to_right(he,p), cw_he->curve(), is_edge_to_right(cw_he,p), p) == SMALLER) { - boost::apply_visitor(set_cw_he_visitor(he),vtx_item);//v_tr->set_top(he); + std::visit(set_cw_he_visitor(he),vtx_item);//v_tr->set_top(he); } return vtx_item; @@ -430,7 +430,7 @@ insert_curve_at_vtx_using_dag(Halfedge_const_handle he, { CGAL_precondition(lt==TRAPEZOID || lt==UNBOUNDED_TRAPEZOID); - Dag_node* node = boost::apply_visitor(dag_node_visitor(), item); + Dag_node* node = std::visit(dag_node_visitor(), item); CGAL_assertion(node != nullptr); CGAL_assertion(he != m_empty_he_handle); @@ -458,13 +458,13 @@ insert_curve_at_vtx_using_dag(Halfedge_const_handle he, // CGAL_precondition(traits->is_td_vertex(vtx_item)); // CGAL_precondition(traits->is_active(vtx_item)); // -// Halfedge_const_handle cw_he (boost::apply_visitor(cw_he_visitor(), vtx_item)); +// Halfedge_const_handle cw_he (std::visit(cw_he_visitor(), vtx_item)); // // //make sure the cw_he is added in same direction as before // // such that vtx_item is the source (done inside the set methods) // if (cw_he == old_he || cw_he->twin() == old_he) // { -// boost::apply_visitor(set_cw_he_visitor(new_he), vtx_item); +// std::visit(set_cw_he_visitor(new_he), vtx_item); // } //} @@ -479,12 +479,12 @@ update_vtx_cw_he_after_merge(const X_monotone_curve_2& old_cv, CGAL_precondition(traits->is_td_vertex(vtx_item)); CGAL_precondition(traits->is_active(vtx_item)); - Halfedge_const_handle cw_he(boost::apply_visitor(cw_he_visitor(), vtx_item)); + Halfedge_const_handle cw_he(std::visit(cw_he_visitor(), vtx_item)); //make sure the cw_he is added in same direction as before // such that v_tr is the source (done inside the set methods) if (traits->equal_2_object()(cw_he->curve(), old_cv)) - boost::apply_visitor(set_cw_he_visitor(new_he), vtx_item); + std::visit(set_cw_he_visitor(new_he), vtx_item); } //----------------------------------------------------------------------------- @@ -499,12 +499,12 @@ update_vtx_cw_he_after_remove(Halfedge_const_handle old_he, CGAL_precondition(traits->is_td_vertex(vtx_item)); CGAL_precondition(traits->is_active(vtx_item)); - Halfedge_const_handle cw_he(boost::apply_visitor(cw_he_visitor(), vtx_item)); + Halfedge_const_handle cw_he(std::visit(cw_he_visitor(), vtx_item)); if ((old_he == cw_he) || (old_he->twin() == cw_he)) { Halfedge_const_handle new_he = cw_he->twin()->next(); if (new_he != cw_he) - boost::apply_visitor(set_cw_he_visitor(new_he), vtx_item); - else boost::apply_visitor(reset_cw_he_visitor(), vtx_item); // dangling edge removed + std::visit(set_cw_he_visitor(new_he), vtx_item); + else std::visit(reset_cw_he_visitor(), vtx_item); // dangling edge removed } } @@ -520,20 +520,20 @@ update_vtx_cw_he_after_remove(Halfedge_const_handle old_he, // CGAL_precondition(traits->is_td_vertex(vtx_item)); // CGAL_precondition(traits->is_active(vtx_item)); // -// Halfedge_const_handle top_he (boost::apply_visitor(top_he_visitor(), vtx_item)); -// Halfedge_const_handle bottom_he (boost::apply_visitor(bottom_he_visitor(), vtx_item)); +// Halfedge_const_handle top_he (std::visit(top_he_visitor(), vtx_item)); +// Halfedge_const_handle bottom_he (std::visit(bottom_he_visitor(), vtx_item)); // // //make sure the top & bottom are added in same direction as before // // such that sep is the source (done inside the set methods) // if ((top_he == he1) || (top_he == he1->twin()) || // (top_he == he2) || (top_he == he2->twin()) ) // { -// boost::apply_visitor(set_top_he_visitor(new_he), vtx_item); //v_tr.set_top(new_he); +// std::visit(set_top_he_visitor(new_he), vtx_item); //v_tr.set_top(new_he); // } // if ((bottom_he == he1) || (bottom_he == he1->twin()) || // (bottom_he == he2) || (bottom_he == he2->twin()) ) // { -// boost::apply_visitor(set_bottom_he_visitor(new_he), vtx_item); //v_tr.set_bottom(new_he); +// std::visit(set_bottom_he_visitor(new_he), vtx_item); //v_tr.set_bottom(new_he); // } //} @@ -561,22 +561,22 @@ update_map_items_after_merge(In_face_iterator& it, CGAL_assertion(traits->is_active(curr_item)); if (traits->is_td_edge(curr_item)) { - Td_active_edge& e(boost::get(curr_item)); + Td_active_edge& e(std::get(curr_item)); if (e.halfedge() == old_he || e.halfedge() == old_he->twin()) e.set_halfedge(new_he); } else if (traits->is_td_trapezoid(curr_item)) { - Td_active_trapezoid& tr(boost::get(curr_item)); + Td_active_trapezoid& tr(std::get(curr_item)); if (tr.bottom() == old_he || tr.bottom() == old_he->twin()) tr.set_bottom(new_he); if (tr.top() == old_he || tr.top() == old_he->twin()) tr.set_top(new_he); } else { //if is_td_vertex - Halfedge_const_handle cw_he(boost::apply_visitor(cw_he_visitor(), + Halfedge_const_handle cw_he(std::visit(cw_he_visitor(), curr_item)); if (cw_he == old_he || cw_he == old_he->twin()) - boost::apply_visitor(set_cw_he_visitor(new_he), curr_item); + std::visit(set_cw_he_visitor(new_he), curr_item); } last_item = *it; @@ -615,20 +615,20 @@ search_using_dag(Dag_node& curr_node, if (traits->is_td_vertex(curr_item)) { // the curr_item represents a vertex //bool is_fict_vtx = traits->is_fictitious_vertex(curr_item); - //if ((is_fict_vtx && is_end_point_left_low(p, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)))) || - // (!is_fict_vtx && is_end_point_left_low(p, boost::apply_visitor(point_for_vertex_visitor(), curr_item))) ) + //if ((is_fict_vtx && is_end_point_left_low(p, *(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)))) || + // (!is_fict_vtx && is_end_point_left_low(p, std::visit(point_for_vertex_visitor(), curr_item))) ) if (is_end_point_left_low(p, curr_node)) { curr_node = curr_node.left_child(); continue; } - //else if ((is_fict_vtx && is_end_point_right_top(p, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)))) || - // (!is_fict_vtx && is_end_point_right_top(p, boost::apply_visitor(point_for_vertex_visitor(), curr_item))) ) + //else if ((is_fict_vtx && is_end_point_right_top(p, *(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)))) || + // (!is_fict_vtx && is_end_point_right_top(p, std::visit(point_for_vertex_visitor(), curr_item))) ) else if (is_end_point_right_top(p, curr_node)) { curr_node = curr_node.right_child(); continue; } - //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || - // (!is_fict_vtx && traits->equal_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item), p)) ) + //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || + // (!is_fict_vtx && traits->equal_2_object()(std::visit(point_for_vertex_visitor(), curr_item), p)) ) else if (are_equal_end_points(p, curr_node)) { if (he == m_empty_he_handle) { // he is the empty handle @@ -663,13 +663,13 @@ search_using_dag(Dag_node& curr_node, are_equal_end_points(p,curr_node)); //(is_fict_vtx && - // (is_end_point_left_low(p,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // is_end_point_right_top(p,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)),p))) || + // (is_end_point_left_low(p,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // is_end_point_right_top(p,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)),p))) || // (!is_fict_vtx && - // (is_end_point_left_low(p,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // is_end_point_right_top(p,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // traits->equal_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item),p)))); + // (is_end_point_left_low(p,std::visit(point_for_vertex_visitor(), curr_item)) || + // is_end_point_right_top(p,std::visit(point_for_vertex_visitor(), curr_item)) || + // traits->equal_2_object()(std::visit(point_for_vertex_visitor(), curr_item),p)))); return Locate_type(); } @@ -678,7 +678,7 @@ search_using_dag(Dag_node& curr_node, // curr_item represents an edge, // so top() is a real Halfedge with a curve() if curr_item is active // or curr_item holds the curve if it is not active - const X_monotone_curve_2& he_cv = *(boost::apply_visitor(cv_for_edge_visitor(), curr_item)); + const X_monotone_curve_2& he_cv = *(std::visit(cv_for_edge_visitor(), curr_item)); Comparison_result cres = traits->compare_y_at_x_2_object()(p, he_cv); if (cres == SMALLER) { @@ -753,7 +753,7 @@ search_using_dag(Dag_node& curr_node, else { // if is_degenerate() == 0, meaning: curr_item is a real trapezoid if (traits->is_active(curr_item)) { - Td_active_trapezoid& tr = boost::get(curr_item); + Td_active_trapezoid& tr = std::get(curr_item); return tr.is_on_boundaries() ? UNBOUNDED_TRAPEZOID : TRAPEZOID; } curr_node = curr_node.left_child(); @@ -810,30 +810,30 @@ search_using_dag(Dag_node& curr_node, // bool is_fict_vtx = traits->is_fictitious_vertex(curr_item); // if (is_fict_vtx) // { -// Curve_end vtx_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))); +// Curve_end vtx_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))); // print_ce_data(vtx_ce.cv(), vtx_ce.ce(), out); // } // else // { -// print_point_data(boost::apply_visitor(point_for_vertex_visitor(),curr_item), out); +// print_point_data(std::visit(point_for_vertex_visitor(),curr_item), out); // } // -// if ((is_fict_vtx && is_end_point_left_low(p, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)))) || -// (!is_fict_vtx && is_end_point_left_low(p, boost::apply_visitor(point_for_vertex_visitor(),curr_item))) ) +// if ((is_fict_vtx && is_end_point_left_low(p, *(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)))) || +// (!is_fict_vtx && is_end_point_left_low(p, std::visit(point_for_vertex_visitor(),curr_item))) ) // { // out << " Going left " << std::endl; // curr_node = curr_node.left_child(); // continue; // } -// else if ((is_fict_vtx && is_end_point_right_top(p, *(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)))) || -// (!is_fict_vtx && is_end_point_right_top(p, boost::apply_visitor(point_for_vertex_visitor(),curr_item))) ) +// else if ((is_fict_vtx && is_end_point_right_top(p, *(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)))) || +// (!is_fict_vtx && is_end_point_right_top(p, std::visit(point_for_vertex_visitor(),curr_item))) ) // { // out << " Going right " << std::endl; // curr_node = curr_node.right_child(); // continue; // } -// else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || -// (!is_fict_vtx && traits->equal_2_object()(boost::apply_visitor(point_for_vertex_visitor(),curr_item), p)) ) +// else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || +// (!is_fict_vtx && traits->equal_2_object()(std::visit(point_for_vertex_visitor(),curr_item), p)) ) // { // out << " Equal to query " << std::endl; // if (he == m_empty_he_handle) //if he is the empty handle @@ -876,7 +876,7 @@ search_using_dag(Dag_node& curr_node, // // if curr_item represents an edge, // // so top() is a real Halfedge with a curve() if curr_item is active // // or curr_item holds the curve if it is not active -// const X_monotone_curve_2& he_cv = *(boost::apply_visitor(cv_for_edge_visitor(), curr_item)); +// const X_monotone_curve_2& he_cv = *(std::visit(cv_for_edge_visitor(), curr_item)); // // out << " EDGE : " ; // if (traits->is_active(curr_item)) @@ -951,7 +951,7 @@ search_using_dag(Dag_node& curr_node, // if (traits->is_active(curr_item)) // { // out << " (active) "; -// Td_active_trapezoid tr = boost::get(curr_item); +// Td_active_trapezoid tr = std::get(curr_item); // if (tr.is_on_boundaries()) // out << " UNBOUNDED! "; // else @@ -1023,20 +1023,20 @@ search_using_dag_with_cv(Dag_node& curr_node, if (traits->is_td_vertex(curr_item)) { // the curr_item represents a vertex //bool is_fict_vtx = traits->is_fictitious_vertex(curr_item); - //if ((is_fict_vtx && is_end_point_right_top(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || - // (!is_fict_vtx && is_end_point_right_top(boost::apply_visitor(point_for_vertex_visitor(), curr_item), ce)) ) + //if ((is_fict_vtx && is_end_point_right_top(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || + // (!is_fict_vtx && is_end_point_right_top(std::visit(point_for_vertex_visitor(), curr_item), ce)) ) if (is_end_point_left_low(ce, curr_node)) { curr_node = curr_node.left_child(); continue; } - //else if ((is_fict_vtx && is_end_point_left_low(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || - // (!is_fict_vtx && is_end_point_left_low(boost::apply_visitor(point_for_vertex_visitor(), curr_item), ce)) ) + //else if ((is_fict_vtx && is_end_point_left_low(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || + // (!is_fict_vtx && is_end_point_left_low(std::visit(point_for_vertex_visitor(), curr_item), ce)) ) else if (is_end_point_right_top(ce, curr_node)) { curr_node = curr_node.right_child(); continue; } - //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || - // (!is_fict_vtx && traits->equal_curve_end_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item), ce)) ) + //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), ce)) || + // (!is_fict_vtx && traits->equal_curve_end_2_object()(std::visit(point_for_vertex_visitor(), curr_item), ce)) ) else if (are_equal_end_points(ce, curr_node)) { if (!p_cv) { // p_cv was not given @@ -1070,13 +1070,13 @@ search_using_dag_with_cv(Dag_node& curr_node, is_end_point_right_top(ce, curr_node) || are_equal_end_points(ce, curr_node)); //(is_fict_vtx && - // (is_end_point_left_low(ce,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // is_end_point_right_top(ce,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)),ce))) || + // (is_end_point_left_low(ce,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // is_end_point_right_top(ce,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)),ce))) || // (!is_fict_vtx && - // (is_end_point_left_low(ce,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // is_end_point_right_top(ce,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // traits->equal_curve_end_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item),ce)))); + // (is_end_point_left_low(ce,std::visit(point_for_vertex_visitor(), curr_item)) || + // is_end_point_right_top(ce,std::visit(point_for_vertex_visitor(), curr_item)) || + // traits->equal_curve_end_2_object()(std::visit(point_for_vertex_visitor(), curr_item),ce)))); return Locate_type(); } } @@ -1086,7 +1086,7 @@ search_using_dag_with_cv(Dag_node& curr_node, // or curr_item holds the curve if it is not active const X_monotone_curve_2& he_cv = - *(boost::apply_visitor(cv_for_edge_visitor(), curr_item)); + *(std::visit(cv_for_edge_visitor(), curr_item)); Comparison_result cres = traits->compare_curve_end_y_at_x_2_object()(ce, he_cv); if (cres == SMALLER) { @@ -1174,7 +1174,7 @@ search_using_dag_with_cv(Dag_node& curr_node, else { // if is_degenerate() == 0, meaning: curr_item is a real trapezoid if (traits->is_active(curr_item)) { - Td_active_trapezoid& tr = boost::get(curr_item); + Td_active_trapezoid& tr = std::get(curr_item); return tr.is_on_boundaries() ? UNBOUNDED_TRAPEZOID : TRAPEZOID; } curr_node = curr_node.left_child(); @@ -1213,20 +1213,20 @@ search_using_dag_with_cv(Dag_node& curr_node, if (traits->is_td_vertex(curr_item)) { // the curr_item represents a vertex //bool is_fict_vtx = traits->is_fictitious_vertex(curr_item); - //if ((is_fict_vtx && is_end_point_right_top(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || - // (!is_fict_vtx && is_end_point_right_top(boost::apply_visitor(point_for_vertex_visitor(), curr_item), p)) ) + //if ((is_fict_vtx && is_end_point_right_top(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || + // (!is_fict_vtx && is_end_point_right_top(std::visit(point_for_vertex_visitor(), curr_item), p)) ) if (is_end_point_left_low(p, curr_node)) { curr_node = curr_node.left_child(); continue; } - //else if ((is_fict_vtx && is_end_point_left_low(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || - // (!is_fict_vtx && is_end_point_left_low(boost::apply_visitor(point_for_vertex_visitor(), curr_item), p)) ) + //else if ((is_fict_vtx && is_end_point_left_low(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || + // (!is_fict_vtx && is_end_point_left_low(std::visit(point_for_vertex_visitor(), curr_item), p)) ) else if (is_end_point_right_top(p, curr_node)) { curr_node = curr_node.right_child(); continue; } - //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || - // (!is_fict_vtx && traits->equal_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item), p)) ) + //else if ((is_fict_vtx && traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), p)) || + // (!is_fict_vtx && traits->equal_2_object()(std::visit(point_for_vertex_visitor(), curr_item), p)) ) else if (are_equal_end_points(p, curr_node)) { if (!p_cv) { // p_cv was not given @@ -1260,13 +1260,13 @@ search_using_dag_with_cv(Dag_node& curr_node, is_end_point_right_top(p, curr_node) || are_equal_end_points(p, curr_node)); //CGAL_assertion((is_fict_vtx && - // (is_end_point_left_low(p,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // is_end_point_right_top(p,*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item))) || - // traits->equal_curve_end_2_object()(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)),p))) || + // (is_end_point_left_low(p,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // is_end_point_right_top(p,*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item))) || + // traits->equal_curve_end_2_object()(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)),p))) || // (!is_fict_vtx && - // (is_end_point_left_low(p,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // is_end_point_right_top(p,boost::apply_visitor(point_for_vertex_visitor(), curr_item)) || - // traits->equal_2_object()(boost::apply_visitor(point_for_vertex_visitor(), curr_item),p)))); + // (is_end_point_left_low(p,std::visit(point_for_vertex_visitor(), curr_item)) || + // is_end_point_right_top(p,std::visit(point_for_vertex_visitor(), curr_item)) || + // traits->equal_2_object()(std::visit(point_for_vertex_visitor(), curr_item),p)))); return Locate_type(); } } @@ -1275,7 +1275,7 @@ search_using_dag_with_cv(Dag_node& curr_node, // so top() is a real Halfedge with a curve() if curr_item is active // or curr_item holds the curve if it is not active const X_monotone_curve_2& he_cv = - *(boost::apply_visitor(cv_for_edge_visitor(), curr_item)); + *(std::visit(cv_for_edge_visitor(), curr_item)); Comparison_result cres = traits->compare_y_at_x_2_object()(p, he_cv); if (cres == SMALLER) { curr_node = curr_node.left_child(); @@ -1351,7 +1351,7 @@ search_using_dag_with_cv(Dag_node& curr_node, else { // is_degenerate() == 0, meaning: curr_item is a real trapezoid if (traits->is_active(curr_item)) { - Td_active_trapezoid& tr = boost::get(curr_item); + Td_active_trapezoid& tr = std::get(curr_item); return tr.is_on_boundaries() ? UNBOUNDED_TRAPEZOID : TRAPEZOID; } curr_node = curr_node.left_child(); @@ -1377,7 +1377,7 @@ container2dag(Nodes_map& ar, int left, int right, int& num_of_new_nodes) const CGAL_assertion(traits->is_active(item)); CGAL_assertion(traits->is_td_trapezoid(item)); Dag_node& tr_node( ar.find(d)->second); - Td_active_trapezoid& tr(boost::get(tr_node.get_data())); + Td_active_trapezoid& tr(std::get(tr_node.get_data())); Vertex_const_handle v = tr.right(); Curve_end ce(traits->vtx_to_ce(v)); @@ -1397,15 +1397,15 @@ container2dag(Nodes_map& ar, int left, int right, int& num_of_new_nodes) const } num_of_new_nodes++; - boost::apply_visitor(set_dag_node_visitor((Dag_node*)&(curr_node.left_child())), curr_node.left_child().get_data()); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)&(curr_node.right_child())), curr_node.right_child().get_data()); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)&curr_node), + std::visit(set_dag_node_visitor((Dag_node*)&(curr_node.left_child())), curr_node.left_child().get_data()); + std::visit(set_dag_node_visitor((Dag_node*)&(curr_node.right_child())), curr_node.right_child().get_data()); + std::visit(set_dag_node_visitor((Dag_node*)&curr_node), curr_node.get_data()); //curr_node.left_child()->set_dag_node(&curr_node.left_child()); //curr_node.right_child()->set_dag_node(&curr_node.right_child()); //curr_node->set_dag_node(&curr_node);// fake temporary node deactivate_vertex(curr_node); //curr_node->remove(); // mark as deleted - boost::apply_visitor(set_dag_node_visitor((Dag_node*)nullptr), + std::visit(set_dag_node_visitor((Dag_node*)nullptr), curr_node.get_data());//curr_node->set_dag_node(0); return curr_node; @@ -1423,7 +1423,7 @@ is_last_edge(Halfedge_const_handle /* he */ , Td_map_item& vtx_item) CGAL_precondition(traits->is_active(vtx_item)); Vertex_const_handle - v(boost::apply_visitor(vertex_for_active_vertex_visitor(), vtx_item)); + v(std::visit(vertex_for_active_vertex_visitor(), vtx_item)); typename Arrangement_on_surface_2::Halfedge_around_vertex_const_circulator first, second; @@ -1518,13 +1518,13 @@ Trapezoidal_decomposition_2::insert(Halfedge_const_handle he) // locate and insert end points of the input halfedge to the Td_map_item // Dag if needed - Dag_node p1_node(*(boost::apply_visitor(dag_node_visitor(), p1_item))); - //Dag_node p2_node(*(boost::apply_visitor(dag_node_visitor(), p2_item)));// Not in use + Dag_node p1_node(*(std::visit(dag_node_visitor(), p1_item))); + //Dag_node p2_node(*(std::visit(dag_node_visitor(), p2_item)));// Not in use // create the Td_map_item iterator for traveling along the Trapezoids that // intersect the input Halfedge, using left-low to right-high order In_face_iterator it = follow_curve(p1_node,he,LARGER); - boost::optional curr_trp = boost::none; + std::optional curr_trp = std::nullopt; Td_map_item prev = p1_item; Td_map_item prev_bottom_tr = Td_map_item(0); //active_tr Td_map_item prev_top_tr = Td_map_item(0); //active_tr @@ -1539,7 +1539,7 @@ Trapezoidal_decomposition_2::insert(Halfedge_const_handle he) while(!!it) { //this means as long as the iterator is valid curr_trp = it.trp(); - CGAL_assertion(curr_trp != boost::none); + CGAL_assertion(curr_trp != std::nullopt); prev_bottom_tr = (*curr_trp).lb(); prev_top_tr = (*curr_trp).lt(); @@ -1568,7 +1568,7 @@ Trapezoidal_decomposition_2::insert(Halfedge_const_handle he) traits->is_active(new_btm_item)); if (merge_if_possible(prev_bottom_tr, new_btm_item)) { Dag_node* left_child_node = - boost::apply_visitor(dag_node_visitor(),prev_bottom_tr); + std::visit(dag_node_visitor(),prev_bottom_tr); node->set_left_child(*left_child_node); old_bottom_tr = prev_bottom_tr; m_number_of_dag_nodes--; //update number of nodes in the DAG after merge @@ -1581,7 +1581,7 @@ Trapezoidal_decomposition_2::insert(Halfedge_const_handle he) CGAL_assertion(traits->is_td_trapezoid(new_top_item) && traits->is_active(new_top_item)); if (merge_if_possible(prev_top_tr, new_top_item)) { - Dag_node* right_child_node = boost::apply_visitor(dag_node_visitor(), + Dag_node* right_child_node = std::visit(dag_node_visitor(), prev_top_tr); node->set_right_child(*right_child_node); old_top_tr = prev_top_tr; @@ -1654,12 +1654,12 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) if (lt1 != POINT || lt2 != POINT) return; - CGAL_warning(boost::apply_visitor(dag_node_visitor(), p1_item) != nullptr); - CGAL_warning(boost::apply_visitor(dag_node_visitor(), p2_item) != nullptr); + CGAL_warning(std::visit(dag_node_visitor(), p1_item) != nullptr); + CGAL_warning(std::visit(dag_node_visitor(), p2_item) != nullptr); //retrieve the Dag_nodes of the two point-degenerate trapezoid - Dag_node& p1_node = *(boost::apply_visitor(dag_node_visitor(), p1_item)); - Dag_node& p2_node = *(boost::apply_visitor(dag_node_visitor(), p2_item)); + Dag_node& p1_node = *(std::visit(dag_node_visitor(), p1_item)); + Dag_node& p2_node = *(std::visit(dag_node_visitor(), p2_item)); //calculate the immediate lower, central and upper neighborhood of // the curve in the data structure @@ -1725,7 +1725,7 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) //copy trapezoid data from btm and top trapezoids Dag_node& new_node = (new_array.find(sz))->second; ++sz; - Td_active_trapezoid& tr(boost::get(new_node.get_data())); + Td_active_trapezoid& tr(std::get(new_node.get_data())); tr.set_dag_node(&new_node); tr.set_lb(btm_it_tr.lb()); tr.set_lt(top_it_tr.lt()); @@ -1741,13 +1741,13 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) } if (!traits->is_empty_item(tr.lb())) { Td_map_item lb_item = tr.lb(); - Td_active_trapezoid& lb_tr(boost::get(lb_item)); + Td_active_trapezoid& lb_tr(std::get(lb_item)); lb_tr.set_rb(new_node.get_data()); } if (!traits->is_empty_item(tr.lt())) { Td_map_item lt_item = tr.lt(); - Td_active_trapezoid& lt_tr(boost::get(lt_item)); + Td_active_trapezoid& lt_tr(std::get(lt_item)); lt_tr.set_rt(new_node.get_data()); } @@ -1769,23 +1769,23 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) if (!btm_it || (inc_btm && !traits->is_trpz_bottom_equal(old_tr_item, *curr_it))) { - Td_map_item rb(boost::apply_visitor(rb_visitor(), old_tr_item)); + Td_map_item rb(std::visit(rb_visitor(), old_tr_item)); if (!traits->is_empty_item(rb)) { - boost::apply_visitor(set_lb_visitor(last_new_tr_item), rb); + std::visit(set_lb_visitor(last_new_tr_item), rb); //rb->set_lb(last_new_tr); - boost::apply_visitor(set_rb_visitor(rb), last_new_tr_item); + std::visit(set_rb_visitor(rb), last_new_tr_item); //last_new_tr->set_rb(rb); } } if (!top_it || (!inc_btm && !traits->is_trpz_top_equal(old_tr_item,*curr_it))) { - Td_map_item rt(boost::apply_visitor(rt_visitor(), old_tr_item)); + Td_map_item rt(std::visit(rt_visitor(), old_tr_item)); if (!traits->is_empty_item(rt)) { - boost::apply_visitor(set_lt_visitor(last_new_tr_item), rt); + std::visit(set_lt_visitor(last_new_tr_item), rt); //rt->set_lt(last_new_tr); - boost::apply_visitor(set_rt_visitor(rt), last_new_tr_item); + std::visit(set_rt_visitor(rt), last_new_tr_item); //last_new_tr->set_rt(rt); } } @@ -1793,7 +1793,7 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) //set the no longer relevant trapezoids as removed and add the new nodes // as their replacement - Dag_node* last_tr_node(boost::apply_visitor(dag_node_visitor(), + Dag_node* last_tr_node(std::visit(dag_node_visitor(), last_tr_item)); if (prev_inc_btm != inc_btm) { @@ -1827,7 +1827,7 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) // update the dag node pointer in the trapezoid const Dag_node* real = &last_tr_node->left_child(); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)real),real->get_data()); //(*real)->set_dag_node((Dag_node*)real); + std::visit(set_dag_node_visitor((Dag_node*)real),real->get_data()); //(*real)->set_dag_node((Dag_node*)real); } while(!end_reached); @@ -1853,18 +1853,18 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) m_number_of_dag_nodes += num_of_new_nodes; //new node (tmp) was added const Dag_node* real = &tr.dag_node()->left_child(); - boost::apply_visitor(set_dag_node_visitor((Dag_node*)real),real->get_data()); //(*real)->set_dag_node((Dag_node*)real); + std::visit(set_dag_node_visitor((Dag_node*)real),real->get_data()); //(*real)->set_dag_node((Dag_node*)real); if (!traits->is_empty_item(rb)) { - boost::apply_visitor(set_rb_visitor(rb),last_new_tr_item); + std::visit(set_rb_visitor(rb),last_new_tr_item); //last_new_tr->set_rb(rb); - boost::apply_visitor(set_lb_visitor(last_new_tr_item),rb); + std::visit(set_lb_visitor(last_new_tr_item),rb); //rb->set_lb(last_new_tr); } if (!traits->is_empty_item(rt)) { - boost::apply_visitor(set_rt_visitor(rt),last_new_tr_item); + std::visit(set_rt_visitor(rt),last_new_tr_item); //last_new_tr->set_rt(rt); - boost::apply_visitor(set_lt_visitor(last_new_tr_item),rt); + std::visit(set_lt_visitor(last_new_tr_item),rt); //rt->set_lt(last_new_tr); } @@ -1876,7 +1876,7 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) //Base_trapezoid_iterator last_mid = mid_it; Dag_node* e_node = nullptr; while (!!++mid_it) { - e_node = boost::apply_visitor(dag_node_visitor(),*last_edge_fragment_it); + e_node = std::visit(dag_node_visitor(),*last_edge_fragment_it); deactivate_edge(removed_cv_ptr,*e_node); //last_mid->remove(); last_edge_fragment_it = mid_it; } @@ -1885,7 +1885,7 @@ void Trapezoidal_decomposition_2::remove(Halfedge_const_handle he) //4. remove adjacency at right end point //remove the final trapezoid representing the removed halfedge - e_node = boost::apply_visitor(dag_node_visitor(),*last_edge_fragment_it); + e_node = std::visit(dag_node_visitor(),*last_edge_fragment_it); deactivate_edge(removed_cv_ptr,*e_node); //last_mid->remove(); //----------------------------------- @@ -1945,7 +1945,7 @@ vertical_ray_shoot(const Point & p,Locate_type & lt, p x------x */ - Td_active_trapezoid& tr(boost::get(item)); + Td_active_trapezoid& tr(std::get(item)); if ((up_direction && !tr.is_on_right_boundary() && (traits->compare_curve_end_x_2_object() @@ -2637,9 +2637,9 @@ merge_edge(Halfedge_const_handle he1, Td_map_item mrgp_item = locate(ce, lt); //varifying that all trapezoids are not nullptr and are of type POINT - CGAL_warning(boost::apply_visitor(dag_node_visitor(), leftp_item) != nullptr); - CGAL_warning(boost::apply_visitor(dag_node_visitor(), rightp_item)!= nullptr); - CGAL_warning(boost::apply_visitor(dag_node_visitor(), mrgp_item) != nullptr); + CGAL_warning(std::visit(dag_node_visitor(), leftp_item) != nullptr); + CGAL_warning(std::visit(dag_node_visitor(), rightp_item)!= nullptr); + CGAL_warning(std::visit(dag_node_visitor(), mrgp_item) != nullptr); //define the left curve and the right curve, according // to the common point (that is merged) @@ -2679,8 +2679,8 @@ merge_edge(Halfedge_const_handle he1, #endif //get the nodes of leftmost point and merge point - Dag_node& leftp_node = *(boost::apply_visitor(dag_node_visitor(), leftp_item)); - Dag_node& mrgp_node = *(boost::apply_visitor(dag_node_visitor(), mrgp_item)); + Dag_node& leftp_node = *(std::visit(dag_node_visitor(), leftp_item)); + Dag_node& mrgp_node = *(std::visit(dag_node_visitor(), mrgp_item)); //set iterators for below left curve, on left curve & above left curve In_face_iterator @@ -2760,15 +2760,15 @@ merge_edge(Halfedge_const_handle he1, merge_if_possible(below_cv_left, below_cv_right); // mark older trapezoids as inactive - nodes depth are updated here - Dag_node* above_cv_right_node(boost::apply_visitor(dag_node_visitor(), + Dag_node* above_cv_right_node(std::visit(dag_node_visitor(), above_cv_right)); - Dag_node* above_cv_left_node(boost::apply_visitor(dag_node_visitor(), + Dag_node* above_cv_left_node(std::visit(dag_node_visitor(), above_cv_left)); deactivate_trapezoid( *above_cv_right_node, above_cv_left_node); //above_cv_right->remove(above_cv_left->dag_node()); - Dag_node* below_cv_right_node(boost::apply_visitor(dag_node_visitor(), + Dag_node* below_cv_right_node(std::visit(dag_node_visitor(), below_cv_right)); - Dag_node* below_cv_left_node(boost::apply_visitor(dag_node_visitor(), + Dag_node* below_cv_left_node(std::visit(dag_node_visitor(), below_cv_left)); deactivate_trapezoid( *below_cv_right_node, below_cv_left_node); //below_cv_right->remove(below_cv_left->dag_node()); @@ -2788,7 +2788,7 @@ merge_edge(Halfedge_const_handle he1, CGAL_assertion(traits->is_td_edge(on_cv_left) && traits->is_active(on_cv_left)); - Td_active_edge& e_left(boost::get(on_cv_left)); + Td_active_edge& e_left(std::get(on_cv_left)); e_left.set_next(on_cv_right); CGAL_assertion(traits->is_td_edge(on_cv_right) && @@ -2830,17 +2830,17 @@ longest_query_path_length_rec(bool minus_inf, Dag_node& min_node, if (!minus_inf && !plus_inf) { Td_map_item min_node_item(min_node.get_data()); if (traits->is_fictitious_vertex(min_node_item)) { - const Curve_end min_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),min_node_item))); + const Curve_end min_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),min_node_item))); Td_map_item max_node_item(max_node.get_data()); if (traits->is_fictitious_vertex(max_node_item)) { - const Curve_end max_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),max_node_item))); + const Curve_end max_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),max_node_item))); //min-fict, max-fict if (!is_end_point_left_low(min_ce, max_ce)) return 0; } else { - const Point& max_p(boost::apply_visitor(point_for_vertex_visitor(), + const Point& max_p(std::visit(point_for_vertex_visitor(), max_node_item)); //min-fict, max-pt @@ -2849,18 +2849,18 @@ longest_query_path_length_rec(bool minus_inf, Dag_node& min_node, } } else { - const Point& min_p(boost::apply_visitor(point_for_vertex_visitor(), + const Point& min_p(std::visit(point_for_vertex_visitor(), min_node_item)); Td_map_item max_node_item(max_node.get_data()); if (traits->is_fictitious_vertex(max_node_item)) { - const Curve_end max_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),max_node_item))); + const Curve_end max_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),max_node_item))); //min-pt, max-fict if (!is_end_point_left_low(min_p, max_ce)) return 0; } else { - const Point& max_p(boost::apply_visitor(point_for_vertex_visitor(), + const Point& max_p(std::visit(point_for_vertex_visitor(), max_node_item)); //min-pt, max-pt @@ -2893,19 +2893,19 @@ longest_query_path_length_rec(bool minus_inf, Dag_node& min_node, if (!minus_inf) { Td_map_item min_node_item(min_node.get_data()); if (traits->is_fictitious_vertex(min_node_item)) { - const Curve_end min_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),min_node_item))); + const Curve_end min_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),min_node_item))); //if smaller than the point represented by min_node - //if ((is_fict_vtx && is_end_point_left_low(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), min_ce)) || - // (!is_fict_vtx && is_end_point_left_low(boost::apply_visitor(point_for_vertex_visitor(), curr_item), min_ce) )) + //if ((is_fict_vtx && is_end_point_left_low(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), min_ce)) || + // (!is_fict_vtx && is_end_point_left_low(std::visit(point_for_vertex_visitor(), curr_item), min_ce) )) if (is_end_point_right_top(min_ce, node)) { new_min_node = min_node; } } else { - const Point& min_p(boost::apply_visitor(point_for_vertex_visitor(),min_node_item)); + const Point& min_p(std::visit(point_for_vertex_visitor(),min_node_item)); //if smaller than the point represented by min_node - //if ((is_fict_vtx && is_end_point_left_low(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), min_p)) || - // (!is_fict_vtx && is_end_point_left_low(boost::apply_visitor(point_for_vertex_visitor(), curr_item), min_p) )) + //if ((is_fict_vtx && is_end_point_left_low(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), min_p)) || + // (!is_fict_vtx && is_end_point_left_low(std::visit(point_for_vertex_visitor(), curr_item), min_p) )) if (is_end_point_right_top(min_p, node)) { new_min_node = min_node; } @@ -2917,21 +2917,21 @@ longest_query_path_length_rec(bool minus_inf, Dag_node& min_node, if (!plus_inf) { Td_map_item max_node_item(max_node.get_data()); if (traits->is_fictitious_vertex(max_node_item)) { - const Curve_end max_ce(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),max_node_item))); + const Curve_end max_ce(*(std::visit(curve_end_for_fict_vertex_visitor(),max_node_item))); //if larger than the point represented by max_node - //if ((is_fict_vtx && is_end_point_right_top(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), max_ce)) || - // (!is_fict_vtx && is_end_point_right_top(boost::apply_visitor(point_for_vertex_visitor(), curr_item), max_ce) )) + //if ((is_fict_vtx && is_end_point_right_top(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), max_ce)) || + // (!is_fict_vtx && is_end_point_right_top(std::visit(point_for_vertex_visitor(), curr_item), max_ce) )) if (is_end_point_left_low(max_ce, node)) { new_max_node = max_node; } } else { - const Point& max_p(boost::apply_visitor(point_for_vertex_visitor(), + const Point& max_p(std::visit(point_for_vertex_visitor(), max_node_item)); //if smaller than the point represented by min_node - //if ((is_fict_vtx && is_end_point_right_top(*(boost::apply_visitor(curve_end_for_fict_vertex_visitor(),curr_item)), max_p)) || - // (!is_fict_vtx && is_end_point_right_top(boost::apply_visitor(point_for_vertex_visitor(), curr_item), max_p) )) + //if ((is_fict_vtx && is_end_point_right_top(*(std::visit(curve_end_for_fict_vertex_visitor(),curr_item)), max_p)) || + // (!is_fict_vtx && is_end_point_right_top(std::visit(point_for_vertex_visitor(), curr_item), max_p) )) if (is_end_point_left_low(max_p, node)) { new_max_node = max_node; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h index 1fae9de1d30..50aa748ba72 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h @@ -15,41 +15,10 @@ #include #include +#include -// The macro CGAL_ARR_POINT_LOCATION_VERSION controls which version of the -// point location is used. Currently two values are supported: -// 1. Point location with CGAL::Object -// 2. Point location with boost::optional > -// The default value is 2. - -#if !defined(CGAL_ARR_POINT_LOCATION_VERSION) -#define CGAL_ARR_POINT_LOCATION_VERSION 2 -#endif - -#include - -#include -#include - -#ifdef CGAL_CFG_BOOST_VARIANT_SWAP_BUG -#if CGAL_ARR_POINT_LOCATION_VERSION > 1 -#include -// workaround for this bug: -// https://svn.boost.org/trac/boost/ticket/2839 -namespace boost{ namespace detail { namespace variant { - -template -inline void move_swap( - ::CGAL::I_Filtered_const_iterator& lhs, - ::CGAL::I_Filtered_const_iterator& rhs) -{ - ::CGAL::I_Filtered_const_iterator tmp( boost::detail::variant::move(lhs) ); - lhs = boost::detail::variant::move(rhs); - rhs = boost::detail::variant::move(tmp); -} -} } } -#endif -#endif +#include +#include namespace CGAL { @@ -61,46 +30,27 @@ struct Arr_point_location_result { typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; -#if CGAL_ARR_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object Type; -#else - typedef typename boost::variant Type; -#endif typedef Type type; - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. + // This function returns a result_type constructor + // to generate return values. // In theory a one parameter variant could be returned, but this _could_ // lead to conversion overhead, and so we rather go for the real type. // Overloads for empty returns are also provided. -#if CGAL_ARR_POINT_LOCATION_VERSION < 2 - template - static - inline Type make_result(T t) { return CGAL::make_object(t); } - - static - inline CGAL::Object empty_optional_result() { return CGAL::Object(); } - - template - static - inline const T* assign(const Type* obj) { return CGAL::object_cast(obj); } -#else template static inline Type make_result(T t) { return Type(t); } static - inline boost::optional empty_optional_result() - { return boost::optional(); } + inline std::optional empty_optional_result() + { return std::optional(); } template static - inline const T* assign(const Type* obj) { return boost::get(obj); } -#endif // CGAL_ARR_POINT_LOCATION_VERSION < 2 + inline const T* assign(const Type* obj) { return std::get_if(obj); } //this one is only to remove warnings in functions static diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index db9b12395f9..488ed21dea7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -185,9 +185,9 @@ public: OutputIterator operator_impl(const Curve_2& cv, OutputIterator oi, Arr_all_sides_oblivious_tag) const { - typedef boost::variant + typedef std::variant Make_x_monotone_subresult; - typedef boost::variant + typedef std::variant Make_x_monotone_result; // If the polycurve is empty, return. @@ -212,7 +212,7 @@ public: for (auto its = cv.subcurves_begin(); its != cv.subcurves_end(); ++its) make_seg_x_monotone(*its, std::back_inserter(x_seg_objects)); auto it = x_seg_objects.begin(); - const auto* x_seg_p = boost::get(&(*it)); + const auto* x_seg_p = std::get_if(&(*it)); #if ! defined (CGAL_NO_ASSERTIONS) CGAL_assertion(x_seg_p != nullptr); #endif @@ -260,7 +260,7 @@ public: #endif for (++it; it != x_seg_objects.end(); ++it) { - const auto* x_seg_p = boost::get(&(*it)); + const auto* x_seg_p = std::get_if(&(*it)); #if ! defined (CGAL_NO_ASSERTIONS) CGAL_assertion(x_seg_p != nullptr); #endif @@ -318,9 +318,9 @@ public: OutputIterator operator_impl(const Curve_2& cv, OutputIterator oi, Arr_not_all_sides_oblivious_tag) const { - typedef boost::variant + typedef std::variant Make_x_monotone_subresult; - typedef boost::variant + typedef std::variant Make_x_monotone_result; // If the polycurve is empty, return. @@ -350,7 +350,7 @@ public: for (auto its = cv.subcurves_begin(); its != cv.subcurves_end(); ++its) make_seg_x_monotone(*its, std::back_inserter(x_seg_objects)); auto it = x_seg_objects.begin(); - const auto* x_seg_p = boost::get(&(*it)); + const auto* x_seg_p = std::get_if(&(*it)); #if ! defined (CGAL_NO_ASSERTIONS) CGAL_assertion(x_seg_p != nullptr); #endif @@ -398,7 +398,7 @@ public: #endif for (++it; it != x_seg_objects.end(); ++it) { - const auto* x_seg_p = boost::get(&(*it)); + const auto* x_seg_p = std::get_if(&(*it)); #if ! defined (CGAL_NO_ASSERTIONS) CGAL_assertion(x_seg_p != nullptr); #endif @@ -696,10 +696,9 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_base_result; - typedef boost::variant - Intersection_result; + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); auto cmp_y_at_x = m_poly_traits.compare_y_at_x_2_object(); @@ -744,7 +743,7 @@ public: // cv1's right endpoint equals cv2's left endpoint // Thus we can return this single(!) intersection point Intersection_point p(max_vertex(cv1[i1]), 0); - *oi++ = Intersection_result(p); + *oi++ = p; return oi; } dir1 == SMALLER ? @@ -767,7 +766,7 @@ public: // cv2's right endpoint equals cv1's left endpoint // Thus we can return this single(!) intersection point Intersection_point p(max_vertex(cv2[i2]), 0); - *oi++ = Intersection_result(p); + *oi++ = p; return oi; } @@ -824,7 +823,7 @@ public: intersect(cv1[i1], cv2[i2], std::back_inserter(xections)); for (const auto& xection : xections) { const X_monotone_subcurve_2* subcv_p = - boost::get(&xection); + std::get_if(&xection); if (subcv_p != nullptr) { ocv.push_back(*subcv_p); oi = output_ocv (ocv, invert_ocv, oi); @@ -832,8 +831,8 @@ public: } const Intersection_point* p_p = - boost::get(&xection); - if (p_p != nullptr) *oi++ = Intersection_result(*p_p); + std::get_if(&xection); + if (p_p != nullptr) *oi++ = *p_p; } } else if (right_coincides && left_coincides) { @@ -846,7 +845,7 @@ public: for (const auto& item : sub_xections) { const X_monotone_subcurve_2* x_seg = - boost::get(&item); + std::get_if(&item); if (x_seg != nullptr) { X_monotone_subcurve_2 seg = *x_seg; // We maintain the variant that if the input curves have opposite @@ -863,7 +862,7 @@ public: } const Intersection_point* p_ptr = - boost::get(&item); + std::get_if(&item); if (p_ptr != nullptr) { // Any point that is not equal to the max_vertex of the // subcurve should be inserted into oi. @@ -871,7 +870,7 @@ public: // will be taken care of as the min_vertex of in the next // iteration. if (! equal(p_ptr->first, max_vertex(cv1[i1]))) - *oi++ = Intersection_result(*p_ptr); + *oi++ = *p_ptr; } } } @@ -896,11 +895,11 @@ public: // it multiplicity 0. if (left_res == SMALLER) { Intersection_point p(min_vertex(cv2[i2]), 0); - *oi++ = Intersection_result(p); + *oi++ = p; } else { Intersection_point p(min_vertex(cv1[i1]), 0); - *oi++ = Intersection_result(p); + *oi++ = p; } } } @@ -941,7 +940,7 @@ public: (i1 != Polycurve_traits_2::INVALID_INDEX) ? return_point(max_vertex(cv1[i1+1]), 0) : return_point(max_vertex(cv1[0]), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } else if (right_res == LARGER) { ip = (dir2 == SMALLER) ? @@ -949,7 +948,7 @@ public: (i2 != Polycurve_traits_2::INVALID_INDEX) ? return_point(max_vertex(cv2[i2+1]), 0) : return_point(max_vertex(cv2[0]), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } else if (((i1 > 0) && (dir1 == SMALLER)) || ((i1 < n1) && (dir1 != SMALLER)) || @@ -961,7 +960,7 @@ public: (i1 != Polycurve_traits_2::INVALID_INDEX) ? return_point(max_vertex(cv1[i1+1]), 0) : return_point(max_vertex(cv1[0]), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } else { CGAL_assertion_msg((dir2 == SMALLER && i2 > 0) || @@ -976,7 +975,7 @@ public: (i2 != Polycurve_traits_2::INVALID_INDEX) ? return_point(max_vertex(cv2[i2+1]), 0) : return_point(max_vertex(cv2[0]), 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } } @@ -989,15 +988,12 @@ public: inline OutputIterator output_ocv (std::vector& ocv, bool invert_ocv, OutputIterator oi) const { - typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; X_monotone_curve_2 curve; if (invert_ocv) std::reverse (ocv.begin(), ocv.end()); for (X_monotone_subcurve_2& sc : ocv) curve.push_back (sc); - *(oi ++) = Intersection_result(curve); + *(oi ++) = curve; ocv.clear(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h index 8b076506227..3f49b0f2221 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -2038,8 +2038,6 @@ public: OutputIterator intersect(const Self& arc, OutputIterator oi, const Cache& cache) const { - typedef boost::variant Intersection_result; - CGAL_precondition(this->is_valid()); CGAL_precondition(this->is_continuous()); CGAL_precondition(arc.is_valid()); @@ -2047,7 +2045,7 @@ public: if (this->equals(arc)) { Self overlap_arc(*this); - *oi++ = Intersection_result(overlap_arc); + *oi++ = overlap_arc; return oi; } @@ -2170,7 +2168,7 @@ public: (this->SRC_AT_Y_MINUS_INFTY | this->SRC_AT_Y_PLUS_INFTY) == 0) { Intersection_point ip(p_left, 0); - *oi++ = Intersection_result(ip); + *oi++ = ip; } return oi; @@ -2189,7 +2187,7 @@ public: this->IS_DIRECTED_RIGHT | this->IS_CONTINUOUS | this->IS_VALID); - *oi++ = Intersection_result(overlap_arc); + *oi++ = overlap_arc; return oi; } @@ -2221,7 +2219,7 @@ public: Algebraic_point_2 p(this->_f, *x_iter); // Output the intersection point: Intersection_point ip(p, *m_iter); - *oi++ = Intersection_result(ip); + *oi++ = ip; } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h index 6e775b4917f..f908224fe26 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h @@ -827,7 +827,7 @@ public: template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { - typedef boost::variant + typedef std::variant Make_x_monotone_result; // Make the rational arc continuous. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h index e4828c134c4..b080305c6f8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h @@ -25,7 +25,7 @@ #include -#include +#include #include #include @@ -566,7 +566,7 @@ public: OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { // Wrap the segment with a variant. - typedef boost::variant + typedef std::variant Make_x_monotone_result; *oi++ = Make_x_monotone_result(cv); return oi; @@ -706,8 +706,6 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; // Early ending with Bbox overlapping test if (! do_bboxes_overlap(cv1, cv2)) return oi; @@ -724,7 +722,7 @@ public: CGAL_assertion(bool(res)); // Check if we have a single intersection point. - const Point_2* ip = boost::get(&*res); + const Point_2* ip = std::get_if(&*res); if (ip != nullptr) { CGAL_assertion(cv1.is_vertical() ? m_traits.is_in_y_range_2_object()(cv1, *ip) : @@ -733,7 +731,7 @@ public: m_traits.is_in_y_range_2_object()(cv2, *ip) : m_traits.is_in_x_range_2_object()(cv2, *ip)); Intersection_point ip_mult(*ip, 1); - *oi++ = Intersection_result(ip_mult); + *oi++ = ip_mult; return oi; } @@ -754,7 +752,7 @@ public: // a common endpoint. Thus we have an intersection point, but we leave // the multiplicity of this point undefined. Intersection_point ip_mult(p_r, 0); - *oi++ = Intersection_result(ip_mult); + *oi++ = ip_mult; return oi; } @@ -765,17 +763,17 @@ public: // in the overlap segment if (cv1.is_directed_right()) { X_monotone_curve_2 overlap_seg(cv1.line(), p_l, p_r); - *oi++ = Intersection_result(overlap_seg); + *oi++ = overlap_seg; return oi; } X_monotone_curve_2 overlap_seg(cv1.line(), p_r, p_l); - *oi++ = Intersection_result(overlap_seg); + *oi++ = overlap_seg; return oi; } // cv1 and cv2 have opposite directions, the overlap segment // will be directed from left to right X_monotone_curve_2 overlap_seg(cv1.line(), p_l, p_r); - *oi++ = Intersection_result(overlap_seg); + *oi++ = overlap_seg; return oi; } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h index 099f46edcd6..ab14028c080 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h @@ -26,7 +26,7 @@ #include #include -#include +#include namespace CGAL { @@ -57,11 +57,7 @@ public: typedef Result_type result_type; protected: -#if CGAL_ARR_POINT_LOCATION_VERSION < 2 - typedef Result_type Optional_result_type; -#else - typedef typename boost::optional Optional_result_type; -#endif + typedef typename std::optional Optional_result_type; typedef typename Topology_traits::Dcel Dcel; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; @@ -71,13 +67,8 @@ protected: const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits. const Topology_traits* m_topol_traits; // Its associated topology traits. -#if CGAL_ARR_POINT_LOCATION_VERSION < 2 - inline bool optional_empty(const CGAL::Object& obj) const { return obj.empty(); } - inline const Result_type& optional_assign(const CGAL::Object& t) const { return t; } -#else - inline bool optional_empty(const boost::optional& t) const { return (!t); } - inline const Result_type& optional_assign(const boost::optional& t) const { return *t; } -#endif + inline bool optional_empty(const std::optional& t) const { return (!t); } + inline const Result_type& optional_assign(const std::optional& t) const { return *t; } template Result_type make_result(T t) const { return Result::make_result(t); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h index 54264ab18e6..f9f58734738 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h @@ -154,14 +154,14 @@ public: OutputIterator insert(const Vector_3 & normal1, const Vector_3 & normal2, OutputIterator oi) { - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::list x_objects; make_x_monotone(normal1, normal2, std::back_inserter(x_objects)); auto it = x_objects.begin(); - const auto* xc = boost::get(&(*it)); + const auto* xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "1.a. insert_in_face_interior(" << *xc << ")" << std::endl; #endif @@ -172,7 +172,7 @@ public: ++it; if (it == x_objects.end()) return oi; - xc = boost::get(&(*it)); + xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "1.b. insert_from_vertex(" << *xc << ")" << std::endl; #endif @@ -195,14 +195,14 @@ public: const Vector_3 & normal2, OutputIterator oi) { - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::list x_objects; make_x_monotone(normal1, normal2, std::back_inserter(x_objects)); auto it = x_objects.begin(); - const auto* xc = boost::get(&(*it)); + const auto* xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "2.a. insert_from_vertex(" << *xc << ", " << vertex1->point() << ")" << std::endl; @@ -216,7 +216,7 @@ public: ++it; if (it == x_objects.end()) return oi; - xc = boost::get(&(*it)); + xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "2.b. insert_from_vertex(" << *xc << ")" << std::endl; #endif @@ -239,7 +239,7 @@ public: const Vector_3 & normal2, Vertex_handle vertex2, OutputIterator oi) { - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::list x_objects; @@ -247,7 +247,7 @@ public: auto it = x_objects.begin(); if (x_objects.size() == 1) { - const auto* xc = boost::get(&(*it)); + const auto* xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "3. insert_from_vertex(" << *xc << ")" << std::endl; #endif @@ -258,8 +258,8 @@ public: return oi; } - const X_monotone_curve_2* xc1 = boost::get(&(*it++)); - const X_monotone_curve_2* xc2 = boost::get(&(*it)); + const X_monotone_curve_2* xc1 = std::get_if(&(*it++)); + const X_monotone_curve_2* xc2 = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "3.a. insert_from_vertex(" << *xc2 << ")" << std::endl; @@ -294,13 +294,13 @@ public: const Vector_3 & normal2, Vertex_handle vertex2, OutputIterator oi) { - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::list x_objects; make_x_monotone(normal1, normal2, std::back_inserter(x_objects)); auto it = x_objects.begin(); if (x_objects.size() == 1) { - const auto* xc = boost::get(&(*it)); + const auto* xc = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "4. insert_at_vertices(" << *xc << ")" << std::endl; #endif @@ -308,8 +308,8 @@ public: return oi; } - const X_monotone_curve_2 * xc1 = boost::get(&(*it++)); - const X_monotone_curve_2 * xc2 = boost::get(&(*it)); + const X_monotone_curve_2 * xc1 = std::get_if(&(*it++)); + const X_monotone_curve_2 * xc2 = std::get_if(&(*it)); #if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1 std::cout << "4.a. insert_from_vertex(" << *xc1 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h index 5116ef4ca45..78eb6bc2f47 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h @@ -46,7 +46,7 @@ void Arr_transform_on_sphere(Arrangement & arr, typedef typename Arrangement::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; const Geometry_traits_2 * geom_traits = arr.geometry_traits(); Topology_traits * topol_traits = arr.topology_traits(); @@ -156,10 +156,10 @@ void Arr_transform_on_sphere(Arrangement & arr, auto it = objects.begin(); // The curve that its left vertex lies on the identification curve - const auto* sub_cv1 = boost::get(&(*it)); + const auto* sub_cv1 = std::get(&(*it)); ++it; //The curve that its right vertex lies on the identification curve - const auto* sub_cv2 = boost::get(&(*it)); + const auto* sub_cv2 = std::get(&(*it)); bool eq1 = (*sub_cv1).source() == hei1->source()->point(); bool eq2 = (*sub_cv2).target() == hei1->target()->point(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 67202ce862f..e854cb9b385 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -506,7 +506,7 @@ public: * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. */ - boost::optional > + std::optional > place_boundary_vertex(Face* f, const X_monotone_curve_2& xc, Arr_curve_end ind, @@ -538,7 +538,7 @@ public: * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - boost::variant + std::variant locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ce, Arr_parameter_space ps_x, Arr_parameter_space ps_y); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h index 2170c332d80..ba76651f9d7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h @@ -47,9 +47,9 @@ public: typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Topology_traits Topology_traits; - typedef boost::variant Cell_type; - typedef boost::optional Vert_type; + typedef std::optional Vert_type; protected: // Data members: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index 9175587a317..34149d15af3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -571,8 +571,8 @@ let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, * represent the curve end along the face boundary. */ template -boost::optional - ::Vertex*, typename Arr_spherical_topology_traits_2::Halfedge*> > Arr_spherical_topology_traits_2:: @@ -585,17 +585,17 @@ place_boundary_vertex(Face* /* f */, , Arr_parameter_space ps_y) { - typedef boost::variant Non_optional_result; - typedef boost::optional Result; + typedef std::variant Non_optional_result; + typedef std::optional Result; // std::cout << "place_boundary_vertex()" << std::endl; if (ps_y == ARR_BOTTOM_BOUNDARY) { - if (m_south_pole == nullptr) return boost::none; + if (m_south_pole == nullptr) return std::nullopt; return Result(Non_optional_result(m_south_pole)); } if (ps_y == ARR_TOP_BOUNDARY) { - if (m_north_pole == nullptr) return boost::none; + if (m_north_pole == nullptr) return std::nullopt; return Result(Non_optional_result(m_north_pole)); } @@ -611,7 +611,7 @@ place_boundary_vertex(Face* /* f */, } // The vertex hasn't been created yet, return a null object: - return boost::none; + return std::nullopt; } /*! \brief locate the predecessor halfedge for the given curve around a given @@ -647,7 +647,7 @@ locate_around_boundary_vertex(Vertex* v, /*! \brief locates a DCEL feature that contains a given curve end. */ template -boost::variant +std::variant ::Vertex*, typename Arr_spherical_topology_traits_2::Halfedge*, typename Arr_spherical_topology_traits_2::Face*> @@ -660,7 +660,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, , Arr_parameter_space ps_y) { - typedef boost::variant Result; + typedef std::variant Result; // Act according to the boundary conditions. if (ps_y == ARR_TOP_BOUNDARY) { // In case the curve end coincides with the north pole, return the vertex diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h index af8e70a3f13..931359c3f11 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h @@ -48,9 +48,9 @@ public: typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; - typedef boost::variant Cell_type; - typedef boost::optional Vert_type; + typedef std::optional Vert_type; protected: typedef typename Arrangement_2::Topology_traits Topology_traits; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h index 4be3568c3a6..2736919a601 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h @@ -296,8 +296,8 @@ are_equal(const Vertex *v, // represent the curve end along the face boundary. // template -boost::optional - ::Vertex*, typename Arr_unb_planar_topology_traits_2::Halfedge*> > Arr_unb_planar_topology_traits_2:: @@ -305,8 +305,8 @@ place_boundary_vertex(Face* f, const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) { - typedef boost::variant Non_optional_result; - typedef boost::optional Result; + typedef std::variant Non_optional_result; + typedef std::optional Result; // Get a halfedge on the outer CCB of f and start traversing the CCB. Halfedge* first = *(f->outer_ccbs_begin()); @@ -331,14 +331,14 @@ place_boundary_vertex(Face* f, // If we reached here, we did not find a suitable halfedge, which should // never happen. CGAL_error(); - return boost::none; + return std::nullopt; } //----------------------------------------------------------------------------- // Locate a DCEL feature that contains the given unbounded curve end. // template -boost::variant +std::variant ::Vertex*, typename Arr_unb_planar_topology_traits_2::Halfedge*, typename Arr_unb_planar_topology_traits_2::Face*> @@ -346,7 +346,7 @@ Arr_unb_planar_topology_traits_2:: locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) { - typedef boost::variant Result; + typedef std::variant Result; // Start traversing the inner CCB of the fictitious face and try to locate // a feature that contains the curve end. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h index 23fa949e3cd..2b0abaceb4b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h @@ -46,9 +46,9 @@ public: typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; - typedef boost::variant Cell_type; - typedef boost::optional Vert_type; + typedef std::optional Vert_type; protected: typedef typename Arrangement_2::Topology_traits Topology_traits; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h index f631bef376a..66dd1834a8c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -531,7 +531,7 @@ public: std::cout << "make_x_monotone" << std::endl << " cv: " << cv << std::endl; - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::list container; @@ -540,12 +540,12 @@ public: size_t i = 0; for (auto it = container.begin(); it != container.end(); ++it) { - if (const auto* xcv = boost::get(&*it)) { + if (const auto* xcv = std::get_if(&*it)) { std::cout << " result[" << i++ << "]: xcv: " << *xcv << std::endl; continue; } - if (const auto* p = boost::get(&*it)) { + if (const auto* p = std::get_if(&*it)) { std::cout << " result[" << i++ << "]: p: " << *p << std::endl; continue; } @@ -618,7 +618,7 @@ public: OutputIterator oi) const { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; if (! m_enabled) return m_object(xcv1, xcv2, oi); @@ -632,22 +632,22 @@ public: unsigned int i = 0; for (const auto& item : container) { - const X_monotone_curve_2* xcv = boost::get(&item); + const X_monotone_curve_2* xcv = std::get_if(&item); if (xcv != nullptr) { std::cout << " result[" << i++ << "]: xcv: " << *xcv << std::endl; + *oi++ = *xcv; continue; } - const Intersection_point* ip = boost::get(&item); + const Intersection_point* ip = std::get_if(&item); if (ip != nullptr) { std::cout << " result[" << i++ << "]: p: " << ip->first << ", multiplicity: " << ip->second << std::endl; + *oi++ = *ip; continue; } } - for (auto it = container.begin(); it != container.end(); ++it) *oi++ = *it; - container.clear(); return oi; } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index 09cc7c94710..58558968882 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -291,7 +291,7 @@ public: * \return An object that contains the curve end. * In our case this object always wraps a fictitious edge. */ - boost::optional > + std::optional > place_boundary_vertex(Face* f, const X_monotone_curve_2& cv, Arr_curve_end ind, @@ -330,7 +330,7 @@ public: * In our case this object may either wrap an unbounded face, * or an edge with an end-vertex at infinity (in case of an overlap). */ - boost::variant + std::variant locate_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h index 3739d35a83a..75c8f25e0c9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h @@ -109,7 +109,7 @@ decompose(const Arrangement_on_surface_2& arr, } } - // Obtain a extended traits-class object. + // Obtain an extended traits-class object. const Gt2* geom_traits = arr.geometry_traits(); /* We would like to avoid copy construction of the geometry traits class. diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h index 27f1a980deb..2abcd426bf4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h @@ -20,7 +20,7 @@ * Definition of the Arr_compute_zone_visitor class. */ -#include +#include namespace CGAL { @@ -55,7 +55,7 @@ private: const Vertex_handle invalid_v; // Invalid vertex. OutputIterator& out_iter; // for outputting the zone objects. - // Its value type is boost::variant. + // Its value type is std::variant. bool output_left; // Determines whether we should // output the left end point of a // subcurve (to avoid outputting @@ -97,7 +97,7 @@ public: Vertex_handle left_v, Halfedge_handle left_he, Vertex_handle right_v, Halfedge_handle right_he) { - typedef boost::variant + typedef std::variant Zone_result; if (output_left) { @@ -138,7 +138,7 @@ public: Halfedge_handle he, Vertex_handle left_v, Vertex_handle right_v) { - typedef boost::variant + typedef std::variant Zone_result; if (output_left) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index d98f1c1307c..8f88642aed8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -643,7 +643,7 @@ public: Tag_false) const { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; std::list intersections; m_self->intersect_2_object()(xcv1, xcv2, back_inserter(intersections)); @@ -3370,7 +3370,7 @@ public: */ class Compare_xy_2 { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; public: @@ -3580,7 +3580,7 @@ public: // Verify the first intersection is an overlap, remove it, and // recursively call. const X_monotone_curve_2* xcv = - boost::get(&(intersections.front())); + std::get_if(&(intersections.front())); if (! xcv) { CGAL_error_msg("The first intersection is not an overlap!"); return SMALLER; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index d54f4c2cb0e..0f2957d4714 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -83,7 +83,7 @@ void insert(Arrangement_on_surface_2& arr, typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; // Obtain an arrangement accessor. Arr_accessor arr_access(arr); @@ -100,7 +100,7 @@ void insert(Arrangement_on_surface_2& arr, // Insert each x-monotone curve into the arrangement. for (const auto& x_obj : x_objects) { // Act according to the type of the current object. - const auto* x_curve = boost::get(&x_obj); + const auto* x_curve = std::get_if(&x_obj); if (x_curve != nullptr) { // Inserting an x-monotone curve: // Initialize the zone-computation object with the given curve. @@ -118,7 +118,7 @@ void insert(Arrangement_on_surface_2& arr, arr_access.notify_after_global_change(); continue; } - const auto* iso_p = boost::get(&x_obj); + const auto* iso_p = std::get_if(&x_obj); CGAL_assertion(iso_p != nullptr); // Inserting a point into the arrangement: @@ -683,7 +683,7 @@ insert_non_intersecting_curve // The endpoint must not lie on an existing edge, but may coincide with // and existing vertex vh1. - CGAL_precondition_msg(boost::get(&obj1) == nullptr, + CGAL_precondition_msg(std::get_if(&obj1) == nullptr, "The curve must not intersect an existing edge."); } @@ -691,7 +691,7 @@ insert_non_intersecting_curve // We have a left end with boundary conditions. Use the accessor to locate // the feature that contains it. obj1 = arr_access.locate_curve_end(c, ARR_MIN_END, bx1, by1); - CGAL_precondition_msg(boost::get(&obj1) == nullptr, + CGAL_precondition_msg(std::get_if(&obj1) == nullptr, "The curve must not overlap an existing edge."); } vh1 = Pl_result::template assign(&obj1); @@ -710,7 +710,7 @@ insert_non_intersecting_curve // The endpoint must not lie on an existing edge, but may coincide with // and existing vertex vh2. - CGAL_precondition_msg(boost::get(&obj2) == nullptr, + CGAL_precondition_msg(std::get_if(&obj2) == nullptr, "The curve must not intersect an existing edge."); } else { @@ -721,7 +721,7 @@ insert_non_intersecting_curve // << ", by2: " << by2 // << std::endl; obj2 = arr_access.locate_curve_end(c, ARR_MAX_END, bx2, by2); - CGAL_precondition_msg(boost::get(&obj2) == nullptr, + CGAL_precondition_msg(std::get_if(&obj2) == nullptr, "The curve must not overlap an existing edge."); } vh2 = Pl_result::template assign(&obj2); @@ -737,7 +737,7 @@ insert_non_intersecting_curve if (vh1 != nullptr) { if (vh2 != nullptr) { - // Both endpoints are associated with a existing vertices. + // Both endpoints are associated with existing vertices. // In this case insert_at_vertices() already returns a halfedge // directed from left to right. new_he = arr.insert_at_vertices(c, @@ -766,8 +766,8 @@ insert_non_intersecting_curve // we must insert the curve in the interior of a face. // In this case insert_in_face_interior() already returns a halfedge // directed from left to right. - const Face_const_handle* fh1 = boost::get(&obj1); - const Face_const_handle* fh2 = boost::get(&obj2); + const Face_const_handle* fh1 = std::get_if(&obj1); + const Face_const_handle* fh2 = std::get_if(&obj2); // std::cout << arr << std::endl; // std::cout << "(*fh1)->number_of_outer_ccbs(): " @@ -1144,14 +1144,14 @@ insert_point(Arrangement_on_surface_2& arr, arr_access.notify_before_global_change(); - const Face_const_handle* fh = boost::get(&obj); + const Face_const_handle* fh = std::get_if(&obj); if (fh != nullptr) { // p lies inside a face: Insert it as an isolated vertex it the interior of // this face. vh_for_p = arr.insert_in_face_interior(p, arr.non_const_handle(*fh)); } else { - const Halfedge_const_handle* hh = boost::get(&obj); + const Halfedge_const_handle* hh = std::get_if(&obj); if (hh != nullptr) { // p lies in the interior of an edge: Split this edge to create a new // vertex associated with p. @@ -1167,7 +1167,7 @@ insert_point(Arrangement_on_surface_2& arr, } else { // p lies on an existing vertex, so we just update this vertex. - const Vertex_const_handle* vh = boost::get(&obj); + const Vertex_const_handle* vh = std::get_if(&obj); CGAL_assertion(vh != nullptr); vh_for_p = arr.modify_vertex (arr.non_const_handle (*vh), p); } @@ -1381,14 +1381,14 @@ is_valid(const Arrangement_on_surface_2& arr) auto obj = def_pl.ray_shoot_down(curr_v->point()); // if (CGAL::assign(he_below, obj)) { - if (auto* he_below_p = boost::get(&obj)) { + if (auto* he_below_p = std::get_if(&obj)) { // Hit an edge; take the incident face of the halfedge directed to the // right. auto he_below = *he_below_p; in_face = (he_below->direction() == ARR_RIGHT_TO_LEFT) ? he_below->twin()->face() : he_below->face(); } - else if (auto* v_below_p = boost::get(&obj)) { + else if (auto* v_below_p = std::get_if(&obj)) { auto v_below = *v_below_p; // Hit a vertex. if (v_below->is_isolated()) in_face = v_below->face(); @@ -1446,7 +1446,7 @@ is_valid(const Arrangement_on_surface_2& arr) } } else { - auto* in_face_p = boost::get(&obj); + auto* in_face_p = std::get_if(&obj); CGAL_assertion(in_face_p); in_face = *in_face_p; // Hit nothing (an unbounded face is returned). @@ -1584,7 +1584,7 @@ do_intersect(Arrangement_on_surface_2& arr, typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; typedef typename Arr::Face_const_handle Face_const_handle; const Traits_adaptor_2* traits = @@ -1596,20 +1596,20 @@ do_intersect(Arrangement_on_surface_2& arr, // Insert each x-monotone curve into the arrangement. for (const auto& x_obj : x_objects) { // Act according to the type of the current object. - const X_monotone_curve_2* x_curve = boost::get(&x_obj); + const X_monotone_curve_2* x_curve = std::get_if(&x_obj); if (x_curve != nullptr) { // Check if the x-monotone subcurve intersects the arrangement. if (do_intersect(arr, *x_curve, pl) == true) return true; continue; } - const Point_2* iso_p = boost::get(&x_obj); + const Point_2* iso_p = std::get_if(&x_obj); CGAL_assertion(iso_p != nullptr); // Check whether the isolated point lies inside a face (otherwise, // it coincides with a vertex or an edge). auto obj = pl.locate(*iso_p); - if (boost::get(&x_obj) != nullptr) return true; + if (std::get_if(&x_obj) != nullptr) return true; } // If we reached here, the curve does not intersect the arrangement. diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h index 78e0850352d..7ac1332586d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h @@ -31,7 +31,7 @@ * class-template. */ -#include +#include #include #include @@ -2253,7 +2253,7 @@ _place_and_set_curve_end(DFace* f, return v; } - DHalfedge** fict_he_p = boost::get(&*obj); + DHalfedge** fict_he_p = std::get_if(&*obj); if (fict_he_p != nullptr) { DHalfedge* fict_he = *fict_he_p; CGAL_assertion(fict_he != nullptr); @@ -2273,7 +2273,7 @@ _place_and_set_curve_end(DFace* f, Halfedge_handle((*p_pred)->next())); return v; } - DVertex** v_p = boost::get(&*obj); + DVertex** v_p = std::get_if(&*obj); CGAL_assertion(v_p != nullptr); DVertex* v = *v_p; CGAL_assertion(v != nullptr); diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h index 7a824ab974a..5aa184d4d0c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h @@ -101,7 +101,7 @@ void Arrangement_zone_2::compute_zone() { const Vertex_const_handle* vh; const Halfedge_const_handle* hh; - if ((vh = boost::get(&m_obj)) != nullptr) { + if ((vh = std::get_if(&m_obj)) != nullptr) { CGAL_assertion(m_has_left_pt); // The left endpoint coincides with an existing vertex: @@ -123,7 +123,7 @@ void Arrangement_zone_2::compute_zone() { #endif } - else if ((hh = boost::get(&m_obj)) != nullptr) { + else if ((hh = std::get_if(&m_obj)) != nullptr) { if (m_has_left_pt) { // Obtain the right halfedge from the halfedge-pair containing m_left_pt // in their interior. @@ -137,7 +137,7 @@ void Arrangement_zone_2::compute_zone() { // Compute the overlapping subcurve. Arr_parameter_space dummy; auto obj = _compute_next_intersection(m_intersect_he, false, dummy); - m_overlap_cv = boost::get(*obj); + m_overlap_cv = std::get(*obj); // Remove the overlap from the map. _remove_next_intersection(m_intersect_he); @@ -153,7 +153,7 @@ void Arrangement_zone_2::compute_zone() { Arr_parameter_space dummy; auto obj = _compute_next_intersection(m_intersect_he, false, dummy); - m_overlap_cv = boost::get(*obj); + m_overlap_cv = std::get(*obj); // Remove the overlap from the map. _remove_next_intersection(m_intersect_he); @@ -164,7 +164,7 @@ void Arrangement_zone_2::compute_zone() { } else { // The left endpoint lies inside a face. - const Face_const_handle* fh = boost::get(&m_obj); + const Face_const_handle* fh = std::get_if(&m_obj); CGAL_assertion_msg(fh != nullptr, "Invalid object returned by the point-location query."); @@ -211,7 +211,7 @@ void Arrangement_zone_2::compute_zone() { // Compute the overlapping subcurve to the right of curr_v. Arr_parameter_space dummy; auto obj = _compute_next_intersection(m_intersect_he, false, dummy); - m_overlap_cv = boost::get(*obj); + m_overlap_cv = std::get(*obj); // Remove the overlap from the map. _remove_next_intersection(m_intersect_he); @@ -589,7 +589,7 @@ _compute_next_intersection(Halfedge_handle he, const X_monotone_curve_2* p_curve = &(he->curve()); // Try to locate the intersections with this curve in the intersections map. - Intersect_map_iterator iter = m_inter_map.find(p_curve); + auto iter = m_inter_map.find(p_curve); const Intersection_point* ip; const X_monotone_curve_2* icv; bool valid_intersection; @@ -606,7 +606,7 @@ _compute_next_intersection(Halfedge_handle he, // (if the left point exists). while (! inter_list.empty()) { // Compare that current object with m_left_pt (if exists). - ip = boost::get(&(inter_list.front())); + ip = std::get_if(&(inter_list.front())); if (ip != nullptr) { // We have an intersection point - valid_intersection = @@ -614,7 +614,7 @@ _compute_next_intersection(Halfedge_handle he, } else { // We have an overlapping subcurve. - icv = boost::get(&(inter_list.front())); + icv = std::get_if(&(inter_list.front())); CGAL_assertion(icv != nullptr); if (is_closed(*icv, ARR_MIN_END)) { @@ -653,7 +653,8 @@ _compute_next_intersection(Halfedge_handle he, // Discard all intersection lying to the left of m_left_pt (if exists). while (! inter_list.empty()) { // Compare that current object with m_left_pt (if exists). - ip = boost::get(&(inter_list.front())); + ip = std::get_if(&(inter_list.front())); + if (ip != nullptr) { // We have an intersection point - // Check whether we need to skip the first intersection @@ -667,7 +668,7 @@ _compute_next_intersection(Halfedge_handle he, } else { // We have an overlapping subcurve. - icv = boost::get(&(inter_list.front())); + icv = std::get_if(&(inter_list.front())); CGAL_assertion(icv != nullptr); if (is_closed(*icv, ARR_MIN_END)) { @@ -705,7 +706,7 @@ _remove_next_intersection(Halfedge_handle he) { const X_monotone_curve_2* p_curve = &(he->curve()); // Locate the intersections with this curve in the intersections map. - Intersect_map_iterator iter = m_inter_map.find(p_curve); + auto iter = m_inter_map.find(p_curve); CGAL_assertion(iter != m_inter_map.end()); CGAL_assertion(! iter->second.empty()); @@ -859,7 +860,7 @@ _leftmost_intersection(Ccb_halfedge_circulator he_curr, bool on_boundary, if (iobj) { // We have found an intersection (either a simple point or an // overlapping x-monotone curve). - const Intersection_point* int_p = boost::get(&*iobj); + const Intersection_point* int_p = std::get_if(&*iobj); if (int_p != nullptr) { Point_2 ip = int_p->first; @@ -881,7 +882,7 @@ _leftmost_intersection(Ccb_halfedge_circulator he_curr, bool on_boundary, else { // We have located an overlapping curve. Assign ip as its left // endpoint. - const X_monotone_curve_2* icv = boost::get(&*iobj); + const X_monotone_curve_2* icv = std::get_if(&*iobj); CGAL_assertion(icv != nullptr); Point_2 ip = min_vertex(*icv); @@ -1116,7 +1117,7 @@ _zone_in_face(Face_handle face, bool on_boundary) { // Associate the intersection list of the original curve with the // right subcurve, while we can associate an empty list with the // left subcurve, as we are now done with it. - Intersect_map_iterator iter = m_inter_map.find(p_orig_curve); + auto iter = m_inter_map.find(p_orig_curve); Intersect_list empty_inter_list; m_inter_map[p_right_subcurve] = iter->second; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h index 2a5db1727c3..cb0e7117833 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -107,12 +107,10 @@ protected: // Types used for caching intersection points: using Intersection_point = std::pair; using Intersection_result = - boost::variant; - using Optional_intersection = boost::optional; + std::variant; + using Optional_intersection = std::optional; using Intersect_list = std::list; - using Intersect_map = - std::map; - using Intersect_map_iterator = typename Intersect_map::iterator; + using Intersect_map = std::map; using Curves_set = std::set; using Curves_set_iterator = typename Curves_set::iterator; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index 2182023925e..8766eac294d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -155,13 +155,13 @@ public: mutable bool _m_left_to_right; //! stores the index of an interval this arc belongs to - mutable boost::optional _m_interval_id; + mutable std::optional _m_interval_id; //! stores boundary value in x-range of non-vertical interval - mutable boost::optional< Bound > _m_boundary_in_interval; + mutable std::optional< Bound > _m_boundary_in_interval; //! stores a bbox for an arc - mutable boost::optional< CGAL::Bbox_2 > _m_bbox; + mutable std::optional< CGAL::Bbox_2 > _m_bbox; //!@} }; @@ -2240,8 +2240,8 @@ protected: rep._m_is_vertical = this->ptr()->_m_is_vertical; rep._m_left_to_right = this->ptr()->_m_left_to_right; - rep._m_interval_id = boost::none; - rep._m_boundary_in_interval = boost::none; + rep._m_interval_id = std::nullopt; + rep._m_boundary_in_interval = std::nullopt; return std::make_pair(Kernel_arc_2(rep), cmp); } @@ -2372,8 +2372,8 @@ protected: this->ptr()->_m_arcno_max = arcno(); // invalidate curve-specific data - this->ptr()->_m_interval_id = boost::none; - this->ptr()->_m_boundary_in_interval = boost::none; + this->ptr()->_m_interval_id = std::nullopt; + this->ptr()->_m_boundary_in_interval = std::nullopt; } //!@} diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h index 5e95ec2d731..3bb749b395c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h @@ -252,8 +252,8 @@ public: class Allocator > inline void draw(const Arc_2& arc, Container< std::vector< Coord_2 >, Allocator >& pts, - boost::optional< Coord_2 > *end_pt1 = nullptr, - boost::optional< Coord_2 > *end_pt2 = nullptr) { + std::optional< Coord_2 > *end_pt1 = nullptr, + std::optional< Coord_2 > *end_pt2 = nullptr) { #ifndef CGAL_CKVA_DUMMY_RENDERER Bbox_2 bbox; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h index 89c4b6595f8..8fe1efa48c7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h @@ -1426,7 +1426,7 @@ public: typedef unsigned int Multiplicity; typedef std::pair Intersection_point; - typedef boost::variant Intersection_result; + typedef std::variant Intersection_result; //! the result type typedef CGAL::cpp98::iterator @@ -1469,13 +1469,13 @@ public: // point-wise intersections std::vector arcs; if (cv1._trim_if_overlapped(cv2, std::back_inserter(arcs))) { - for (const auto& item : arcs) *oi++ = Intersection_result(item); + for (const auto& item : arcs) *oi++ = item; return oi; } // process non-ov erlapping case std::vector vec; Arc_2::_intersection_points(cv1, cv2, std::back_inserter(vec)); - for (const auto& item : vec) *oi++ = Intersection_result(item); + for (const auto& item : vec) *oi++ = item; return oi; } @@ -1905,7 +1905,7 @@ public: { typedef typename Curved_kernel_via_analysis_2::Point_2 Point_2; typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; *oi++ = Make_x_monotone_result(cv); return oi; } @@ -1945,7 +1945,7 @@ public: typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2; typedef typename Curved_kernel_via_analysis_2::Non_x_monotone_arc_2 Non_x_monotone_arc_2; - typedef boost::variant + typedef std::variant Make_x_monotone_result; Curve_analysis_2 curve; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h index 55d269ca01b..a7b9453af47 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h @@ -43,7 +43,7 @@ operator << typedef std::pair< int, int > Coord_2; typedef std::vector< Coord_2 > Coord_vec_2; - boost::optional < Coord_2 > p1, p2; + std::optional < Coord_2 > p1, p2; std::list points; Bbox_2 bbox (CGAL::to_double(ws.bounding_rect().xmin()), diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h index c95ee1b85f9..06ec76eb58f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h @@ -83,9 +83,9 @@ public: // end-points (in degenerate case both point to the same object) mutable Generic_point_2 _m_min; - mutable boost::optional _m_max; + mutable std::optional _m_max; // stores native arc object (only for non-degenerate case) - mutable boost::optional _m_arc; + mutable std::optional _m_arc; // whether an arc is degenerate //bool _m_is_degenerate; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h index f993dd009af..c465cae0300 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h @@ -67,12 +67,12 @@ public: _m_point(p) { } - mutable boost::optional _m_arc; // supporting arc for points at inf + mutable std::optional _m_arc; // supporting arc for points at inf // stores respective curve end if this is a point at infinity CGAL::Arr_curve_end _m_end; - mutable boost::optional _m_point; // stores a finite point + mutable std::optional _m_point; // stores a finite point // befriending the handle friend class Generic_point_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h index 69f9db2015e..aae3aea01e9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h @@ -54,11 +54,11 @@ struct Make_x_monotone_2 : public CGAL::cpp98::binary_function< typename CurvedKernelViaAnalysis_2::Curve_2, CGAL::cpp98::iterator >, CGAL::cpp98::iterator > > { @@ -132,7 +132,7 @@ struct Make_x_monotone_2 : template OutputIterator operator()(Curve_analysis_2 curve, OutputIterator oi) { - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; Construct_arc_2 construct_arc_2 = _m_curved_kernel->construct_arc_2_object(); @@ -290,7 +290,7 @@ private: Coordinate_1 x, std::vector pts, OutputIterator oi) const { - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; Construct_arc_2 construct_arc_2 = _m_curved_kernel->construct_arc_2_object(); diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h index fbdb113ac65..789f24b841e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -106,22 +106,22 @@ public: //! curve point finite coordinates. They are valid only if boundary in y //! is not set (CGAL::NO_BOUNDARY), otherwise only x-coordinate is //! accessible, i.e., point is in interior - boost::optional< Coordinate_2 > _m_xy; + std::optional< Coordinate_2 > _m_xy; //! x-coordinate of a curve point - boost::optional< Coordinate_1 > _m_x; + std::optional< Coordinate_1 > _m_x; //! curve of point at boundary - boost::optional< Curve_analysis_2 > _m_curve; + std::optional< Curve_analysis_2 > _m_curve; //! arc of point at boundary - boost::optional< int > _m_arcno; + std::optional< int > _m_arcno; //! location of a point in parameter space mutable CGAL::Arr_parameter_space _m_location; //! store a double approximation of point - mutable boost::optional< std::pair< double, double > > _m_doubles; + mutable std::optional< std::pair< double, double > > _m_doubles; }; /*!\brief @@ -700,14 +700,13 @@ public: default: // ASCII os << "Point_2("; - - os << this->ptr()->_m_xy; + os << ::CGAL::IO::oformat(this->ptr()->_m_xy); os << ","; - os << this->ptr()->_m_x; + os << ::CGAL::IO::oformat(this->ptr()->_m_x); os << ","; - os << this->ptr()->_m_curve; + os << ::CGAL::IO::oformat(this->ptr()->_m_curve); os << ","; - os << this->ptr()->_m_arcno; + os << ::CGAL::IO::oformat(this->ptr()->_m_arcno); os << ","; os << this->ptr()->_m_location; @@ -737,13 +736,13 @@ public: swallow(is, '('); // read values - is >> rep._m_xy; + is >> iformat(rep._m_xy); swallow(is, ','); - is >> rep._m_x; + is >> iformat(rep._m_x); swallow(is, ','); - is >> rep._m_curve; + is >> iformat(rep._m_curve); swallow(is, ','); - is >> rep._m_arcno; + is >> iformat(rep._m_arcno); swallow(is, ','); is >> rep._m_location; diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h index 3d1bdff6e91..018992c467b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h @@ -22,7 +22,7 @@ #include -#include +#include #include #include #include @@ -726,7 +726,7 @@ public: typedef typename SweepCurvesAdapter_2::Native_arc_2 Native_arc_2; typedef typename SweepCurvesAdapter_2::Native_point_2 Native_point_2; typedef typename SweepCurvesAdapter_2::Generic_point_2 Generic_point_2; - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::vector objs; @@ -734,11 +734,11 @@ public: make_x_monotone(cv, std::back_inserter(objs)); // sort out normal and degenerate arcs for (auto& obj : objs) { - if (auto* arc = boost::get(&obj)) { + if (auto* arc = std::get(&obj)) { *oi++ = Generic_arc_2(*arc); continue; } - auto* pt = boost::get(&obj); + auto* pt = std::get(&obj); CGAL_assertion(pt); *oi++ = Generic_arc_2(Generic_point_2(*pt)); } diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h index f9551ac46fa..32d3d4cc849 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h @@ -423,8 +423,8 @@ template < class Coord_2, template < class, class > class Container, class Allocator > void draw(const Arc_2& arc, Container< std::vector< Coord_2 >, Allocator >& points, - boost::optional< Coord_2 > *end_pt1 = nullptr, - boost::optional< Coord_2 > *end_pt2 = nullptr) { + std::optional< Coord_2 > *end_pt1 = nullptr, + std::optional< Coord_2 > *end_pt2 = nullptr) { #ifdef CGAL_CKVA_CR_TIMING refine_timer.start(); diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h index 34cb310fd07..332f1518179 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h @@ -524,7 +524,7 @@ public: /*! \class * A class defining a textual (\ascii) input/output format for arrangements * that store auxiliary dat with all their DCEL records, as they are templated - * by a extended DCEL class. + * by an extended DCEL class. */ template class Arr_extended_dcel_text_formatter : diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h index 953652180e5..1418044d5f4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h @@ -440,7 +440,7 @@ public: { return (m_base_eq(p1.base(), p2.base())); } }; - /*! Obtain a Equal_2 function object */ + /*! Obtain an `Equal_2` function object */ Equal_2 equal_2_object() const { return (Equal_2(m_base_traits->equal_2_object())); } diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h index f3de33d7fe7..0abc509bcd5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h @@ -98,9 +98,9 @@ public: OutputIterator oi) { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; - typedef boost::variant + typedef std::variant Intersection_base_result; Halfedge_handle invalid_he; @@ -120,13 +120,13 @@ public: // X_monotone_curve_2 for (const auto& xection : xections) { const Intersection_point* - p_p = boost::get(&xection); + p_p = std::get_if(&xection); if (p_p != nullptr) { - *oi++ = Intersection_result(xection); + *oi++ = Intersection_result(*p_p); continue; } const Base_x_monotone_curve_2* base_cv_p = - boost::get(&xection); + std::get_if(&xection); CGAL_assertion(base_cv_p); // Add halfedge handles to the resulting curve. diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h index e6d4d543144..e82e28b3164 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h @@ -23,7 +23,7 @@ * This class can be further split into two, where one derives from the other, * such that the derived class handles the case of inserting non-intersecting * curves into a non-empty arrangement, and the base class handles the case of - * inserting non-intersecting curves into a empty arrangement. + * inserting non-intersecting curves into an empty arrangement. */ #include diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h index ab7b56ce987..30c8b38b4a0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h @@ -22,9 +22,8 @@ * Definition of the Arr_overlay_ss_visitor class-template. */ -#include -#include -#include +#include +#include #include @@ -344,7 +343,7 @@ protected: //@} /*! A visitor class to facilitate the call to create_vertex(). */ - class Create_vertex_visitor : public boost::static_visitor<> { + class Create_vertex_visitor { private: Overlay_traits* m_overlay_traits; Vertex_handle m_vertex_handle; @@ -524,11 +523,11 @@ void Arr_overlay_ss_visitor::update_event(Event* e, CGAL_assertion(sc->color() == Gt2::RED); Halfedge_handle_red red_he = sc->red_halfedge_handle(); - pt.set_red_cell(boost::make_optional(Cell_handle_red(red_he))); + pt.set_red_cell(std::make_optional(Cell_handle_red(red_he))); } else if (pt.is_blue_cell_empty()) { Halfedge_handle_blue blue_he = sc->blue_halfedge_handle(); - pt.set_blue_cell(boost::make_optional(Cell_handle_blue(blue_he))); + pt.set_blue_cell(std::make_optional(Cell_handle_blue(blue_he))); } } @@ -563,7 +562,7 @@ void Arr_overlay_ss_visitor::after_sweep() const Cell_handle_blue& blue_handle = info.second; Vertex_handle v = (*it).first; Create_vertex_visitor visitor(m_overlay_traits, v); - boost::apply_visitor(visitor, red_handle, blue_handle); + std::visit(visitor, red_handle, blue_handle); } // When the sweep-line process is over, the remaining arrangement face @@ -938,8 +937,8 @@ _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) const Cell_handle_red* red_handle_p = pt.red_cell_handle(); if (red_handle_p) info.first = *red_handle_p; - if (!boost::get(&(info.first)) && - !boost::get(&(info.second))) + if (!std::get_if(&(info.first)) && + !std::get_if(&(info.second))) { // If both, the red and blue, variants do not represent face handles, // they must represt either vertex or edge handles. In this case it is @@ -949,7 +948,7 @@ _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) const Cell_handle_blue& blue_handle = info.second; Vertex_handle v = (*it).first; Create_vertex_visitor visitor(m_overlay_traits, v); - boost::apply_visitor(visitor, red_handle, blue_handle); + std::visit(visitor, red_handle, blue_handle); m_vertices_map.erase(it); } } @@ -1035,7 +1034,7 @@ _create_vertex(Event* event, CGAL_assertion(blue_handle != nullptr); const Vertex_handle_blue& blue_v = - boost::get(*blue_handle); + std::get(*blue_handle); m_overlay_traits->create_vertex(red_f, blue_v, new_v); return; } @@ -1049,13 +1048,13 @@ _create_vertex(Event* event, CGAL_assertion(red_handle != nullptr); const Vertex_handle_red& red_v = - boost::get(*red_handle); + std::get(*red_handle); m_overlay_traits->create_vertex(red_v, blue_f, new_v); return; } Create_vertex_visitor visitor(m_overlay_traits, new_v); - boost::apply_visitor(visitor, *red_handle, *blue_handle); + std::visit(visitor, *red_handle, *blue_handle); } //----------------------------------------------------------------------------- diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h index b38fc25d344..0adb3c3e831 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h @@ -22,8 +22,8 @@ * Definition of the Arr_overlay_traits_2 class-template. */ -#include -#include +#include +#include #include @@ -105,21 +105,21 @@ public: RB_OVERLAP // Red-blue overlap. }; - typedef boost::variant Cell_handle_red; - typedef boost::optional Optional_cell_red; + typedef std::optional Optional_cell_red; - typedef boost::variant Cell_handle_blue; - typedef boost::optional Optional_cell_blue; + typedef std::optional Optional_cell_blue; template Optional_cell_red make_optional_cell_red(Handle_red handle_red) - { return boost::make_optional(Cell_handle_red(handle_red)); } + { return std::make_optional(Cell_handle_red(handle_red)); } template Optional_cell_red make_optional_cell_blue(Handle_blue handle_blue) - { return boost::make_optional(Cell_handle_blue(handle_blue)); } + { return std::make_optional(Cell_handle_blue(handle_blue)); } private: const Gt2* m_base_traits; // The base traits object. @@ -323,14 +323,14 @@ public: /*! Obtain the red vertex handle or nullptr if it doesn't exist. */ const Vertex_handle_red* red_vertex_handle() const { - return m_red_cell ? boost::get(&(*m_red_cell)) : nullptr; + return m_red_cell ? std::get_if(&(*m_red_cell)) : nullptr; } /*! Obtain the blue vertex handle or nullptr if it doesn't exist. */ const Vertex_handle_blue* blue_vertex_handle() const { return - m_blue_cell ? boost::get(&(*m_blue_cell)) : nullptr; + m_blue_cell ? std::get_if(&(*m_blue_cell)) : nullptr; } }; @@ -371,10 +371,10 @@ public: OutputIterator oi) { typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; typedef std::pair Intersection_base_point; - typedef boost::variant + typedef std::variant Intersection_base_result; // In case the curves originate from the same arrangement, they are @@ -440,7 +440,7 @@ public: // the extended X_monotone_curve_2. for (const auto& xection : xections) { const Intersection_base_point* base_ipt = - boost::get(&xection); + std::get_if(&xection); if (base_ipt != nullptr) { // We have a red-blue intersection point, so we attach the // intersecting red and blue halfedges to it. @@ -450,16 +450,16 @@ public: if (xcv1.color() == RED) { CGAL_assertion(xcv2.color() == BLUE); red_cell = - boost::make_optional(Cell_handle_red(xcv1.red_halfedge_handle())); + std::make_optional(Cell_handle_red(xcv1.red_halfedge_handle())); blue_cell = - boost::make_optional(Cell_handle_blue(xcv2.blue_halfedge_handle())); + std::make_optional(Cell_handle_blue(xcv2.blue_halfedge_handle())); } else { CGAL_assertion((xcv2.color() == RED) && (xcv1.color() == BLUE)); red_cell = - boost::make_optional(Cell_handle_red(xcv2.red_halfedge_handle())); + std::make_optional(Cell_handle_red(xcv2.red_halfedge_handle())); blue_cell = - boost::make_optional(Cell_handle_blue(xcv1.blue_halfedge_handle())); + std::make_optional(Cell_handle_blue(xcv1.blue_halfedge_handle())); } // Create the extended point and add the multiplicity. @@ -470,7 +470,7 @@ public: } const Base_x_monotone_curve_2* overlap_xcv = - boost::get(&xection); + std::get_if(&xection); CGAL_assertion(overlap_xcv != nullptr); // We have a red-blue overlap, so we mark the curve accordingly. @@ -574,15 +574,15 @@ public: red_cell = (! xcv.red_halfedge_handle()->target()->is_at_open_boundary() && m_base_equal(base_p, xcv.red_halfedge_handle()->target()->point())) ? - boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle()->target())) : - boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle())); + std::make_optional(Cell_handle_red(xcv.red_halfedge_handle()->target())) : + std::make_optional(Cell_handle_red(xcv.red_halfedge_handle())); if ((xcv.color() == BLUE) || (xcv.color() == RB_OVERLAP)) blue_cell = (! xcv.blue_halfedge_handle()->target()->is_at_open_boundary() && m_base_equal(base_p, xcv.blue_halfedge_handle()->target()->point())) ? - boost::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle()->target())) : - boost::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle())); + std::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle()->target())) : + std::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle())); return Point_2(base_p, red_cell, blue_cell); } @@ -631,15 +631,15 @@ public: red_cell = (! xcv.red_halfedge_handle()->source()->is_at_open_boundary() && m_base_equal(base_p, xcv.red_halfedge_handle()->source()->point())) ? - boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle()->source())) : - boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle())); + std::make_optional(Cell_handle_red(xcv.red_halfedge_handle()->source())) : + std::make_optional(Cell_handle_red(xcv.red_halfedge_handle())); if ((xcv.color() == BLUE) || (xcv.color() == RB_OVERLAP)) blue_cell = (! xcv.blue_halfedge_handle()->source()->is_at_open_boundary() && m_base_equal(base_p, xcv.blue_halfedge_handle()->source()->point())) ? - boost::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle()->source())) : - boost::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle())); + std::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle()->source())) : + std::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle())); return (Point_2(base_p, red_cell, blue_cell)); } @@ -705,7 +705,7 @@ public: { return m_base_equal(xcv1.base(), xcv2.base()); } }; - /*! Obtain a Equal_2 functor object. */ + /*! Obtain an `Equal_2` functor object. */ Equal_2 equal_2_object() const { return Equal_2(m_base_traits->equal_2_object()); } diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_ss_visitor.h index b6b7be876f6..cf26fa9a773 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_ss_visitor.h @@ -20,7 +20,7 @@ * Definition of the Arr_vert_decomp_ss_visitor class-template. */ -#include +#include namespace CGAL { @@ -66,10 +66,10 @@ public: typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; - typedef boost::variant Cell_type; - typedef boost::optional Vert_type; + typedef std::optional Vert_type; typedef std::pair Vert_pair; typedef std::pair Vert_entry; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h index 256d101a386..f84aee4da6d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h @@ -45,7 +45,7 @@ public: typedef typename Points_vector::iterator Point_iterator; - typedef typename boost::variant Cell_handle; @@ -226,10 +226,10 @@ compare(const Cell_handle& expected, const Cell_handle& actual) { // Assign object to a face const Face_const_handle* fh_expected = - boost::get(&(expected)); + std::get_if(&(expected)); if (fh_expected) { const Face_const_handle* fh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (fh_actual) { if ((*fh_actual) == (*fh_expected)) return true; @@ -241,13 +241,13 @@ compare(const Cell_handle& expected, const Cell_handle& actual) std::cout << "Error: batched point location!" << std::endl; std::cout << "Expected a face." << std::endl; const Halfedge_const_handle* hh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (hh_actual) { std::cout << "Actual: a halfedge." << std::endl; return false; } const Vertex_const_handle* vh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (vh_actual) { std::cout << "Actual: a vertex." << std::endl; return false; @@ -258,10 +258,10 @@ compare(const Cell_handle& expected, const Cell_handle& actual) // Assign object to a halfedge const Halfedge_const_handle* hh_expected = - boost::get(&(expected)); + std::get_if(&(expected)); if (hh_expected) { const Halfedge_const_handle* hh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (hh_actual) { if (((*hh_actual) == (*hh_expected)) || ((*hh_actual)->twin() == (*hh_expected))) @@ -279,13 +279,13 @@ compare(const Cell_handle& expected, const Cell_handle& actual) std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() << std::endl; const Face_const_handle* fh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (fh_actual) { std::cout << "Actual: a face." << std::endl; return false; } const Vertex_const_handle* vh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (vh_actual) { std::cout << "Actual: a vertex." << std::endl; return false; @@ -296,10 +296,10 @@ compare(const Cell_handle& expected, const Cell_handle& actual) // Assign object to a vertex const Vertex_const_handle* vh_expected = - boost::get(&(expected)); + std::get_if(&(expected)); if (vh_expected) { const Vertex_const_handle* vh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (vh_actual) { if ((*vh_actual) == (*vh_expected)) return true; @@ -313,13 +313,13 @@ compare(const Cell_handle& expected, const Cell_handle& actual) std::cout << "Error: batched point location!"; std::cout << "Expected: a vertex, "<< (*vh_expected)->point() << std::endl; const Face_const_handle* fh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (fh_actual) { std::cout << "Actual: a face" << std::endl; return false; } const Halfedge_const_handle* hh_actual = - boost::get(&(actual)); + std::get_if(&(actual)); if (hh_actual) { std::cout << "Actual: a halfedge." << std::endl; return false; @@ -436,15 +436,15 @@ print(const std::pair& res) // Print the results. std::cout << "The point (" << res.first << ") is located "; if (const Face_const_handle* f = - boost::get(&(res.second))) // inside a face + std::get_if(&(res.second))) // inside a face std::cout << "inside " << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") << " face." << std::endl; else if (const Halfedge_const_handle* e = - boost::get(&(res.second))) // on an edge + std::get_if(&(res.second))) // on an edge std::cout << "on an edge: " << (*e)->curve() << std::endl; else if (const Vertex_const_handle* v = - boost::get(&(res.second))) // on a vertex + std::get_if(&(res.second))) // on a vertex std::cout << "on " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h index d08285f483c..35b3c221eb6 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h @@ -697,11 +697,11 @@ bool IO_base_test::read_xsegment(InputStream_& is, Subcurve_2 seg(point_vector.begin(), point_vector.end()); //convert it into x-monotone bezier segment. - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; std::vector objs; bezier_traits.make_x_monotone_2_object()(seg, std::back_inserter(objs)); assert(! objs.empty()); - const auto* x_seg_p = boost::get(&(objs[0])); + const auto* x_seg_p = std::get_if(&(objs[0])); assert(x_seg_p); xseg = *x_seg_p; @@ -724,7 +724,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, unsigned int number_of_segments; is >> number_of_segments; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; auto make_x_monotone = bezier_traits.make_x_monotone_2_object(); if ((type == 'x') || (type == 'X')) { for (unsigned int i=0; i::read_xcurve(InputStream_& is, std::vector objs; make_x_monotone(seg, std::back_inserter(objs)); assert(! objs.empty()); - const auto* x_seg_p = boost::get(&(objs[0])); + const auto* x_seg_p = std::get_if(&(objs[0])); assert(x_seg_p); x_segments.push_back(*x_seg_p); @@ -1491,7 +1491,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, X_monotone_curve_2& xcv) { std::cout << std::endl; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; std::list x_objs; Curve_2 tmp_cv; is >> tmp_cv; @@ -1509,7 +1509,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, size_t id(0); if (! is.eof()) is >> id; std::advance(xoit, id); - const auto* xcv_p = boost::get(&*xoit); + const auto* xcv_p = std::get_if(&*xoit); assert(xcv_p); xcv = *xcv_p; return false; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h index f4b717db180..72f8306f698 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h @@ -70,7 +70,7 @@ public: typedef std::vector Objects_vector; typedef Objects_vector::iterator Object_iterator; - typedef typename boost::variant Cell_handle; typedef std::vector Variants_vector; @@ -148,7 +148,7 @@ protected: NUM_PL_STRATEGIES }; - typedef boost::variant void deallocate_pl() { - Strategy* strategy = boost::get(m_locators[id].m_variant); + Strategy* strategy = std::get(m_locators[id].m_variant); if (strategy) { delete strategy; m_locators[id].m_variant = static_cast(nullptr); @@ -302,7 +302,7 @@ private: void attach_pl() { if (! m_locators[id].m_active) return; - Strategy* strategy = boost::get(m_locators[id].m_variant); + Strategy* strategy = std::get(m_locators[id].m_variant); strategy->attach(*m_arr); } @@ -311,7 +311,7 @@ private: void attach_pl(Generator* generator) { if (! m_locators[id].m_active) return; - Strategy* strategy = boost::get(m_locators[id].m_variant); + Strategy* strategy = std::get(m_locators[id].m_variant); strategy->attach(*m_arr, generator); } @@ -321,7 +321,7 @@ private: { if (! m_locators[id].m_active) return; const std::string& name = m_locators[id].m_name; - Strategy* strategy = boost::get(m_locators[id].m_variant); + Strategy* strategy = std::get(m_locators[id].m_variant); query(*strategy, name.c_str(), m_query_points.begin(), m_query_points.end(), std::back_inserter(objs)); } @@ -625,7 +625,7 @@ private: #define ATTACH_PL_TRAPEZOID_RIC_NO_GUARANTEE() \ Pl_variant& var = m_locators[TRAPEZOID_RIC_NO_GUARANTEE_PL].m_variant; \ - Trapezoid_ric_pl* strategy = boost::get(var); \ + Trapezoid_ric_pl* strategy = std::get(var); \ strategy->with_guarantees(false); \ attach_pl() @@ -901,12 +901,7 @@ bool Point_location_test::attach_pl_strategies() template bool Point_location_test::perform() { -#if ((CGAL_ARR_POINT_LOCATION_VERSION < 2) || \ - defined(CGAL_ARR_POINT_LOCATION_CONVERSION)) - Objects_vector objs[NUM_PL_STRATEGIES]; -#else Variants_vector objs[NUM_PL_STRATEGIES]; -#endif // Locate the points in the list using all point location strategies. @@ -1088,11 +1083,11 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) // Assign and check results for (size_t qi = 0; qi < size; ++qi) { // Assign object to a face - Face_const_handle* fh_ref = boost::get(&(objs[0][qi])); + Face_const_handle* fh_ref = std::get_if(&(objs[0][qi])); if (fh_ref) { for (size_t pl = 1; pl < pls_num; ++pl) { Face_const_handle* fh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (fh_cur) { if ((*fh_cur) != (*fh_ref)) { std::cout << "Error: point location number " << pl << std::endl; @@ -1107,13 +1102,13 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) std::cout << "Expected: a face." << std::endl; result += -1; Halfedge_const_handle* hh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (hh_cur) { std::cout << "Actual: a halfedge." << std::endl; continue; } Vertex_const_handle* vh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (vh_cur) { std::cout << "Actual: a vertex." << std::endl; continue; @@ -1129,11 +1124,11 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) // Assign object to a halfedge Halfedge_const_handle* hh_ref = - boost::get(&(objs[0][qi])); + std::get_if(&(objs[0][qi])); if (hh_ref) { for (size_t pl = 1; pl < pls_num; ++pl) { Halfedge_const_handle* hh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (hh_cur) { if (((*hh_cur) != (*hh_ref)) && ((*hh_cur)->twin() != (*hh_ref))) { std::cout << "Error: point location number " << pl << std::endl; @@ -1150,13 +1145,13 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) << std::endl; result += -1; Face_const_handle* fh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (fh_cur) { std::cout << "Actual: a face." << std::endl; continue; } Vertex_const_handle* vh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (vh_cur) { std::cout << "Actual: a vertex." << std::endl; continue; @@ -1168,11 +1163,11 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) // Assign object to a vertex Vertex_const_handle* vh_ref = - boost::get(&(objs[0][qi])); + std::get_if(&(objs[0][qi])); if (vh_ref) { for (size_t pl = 1; pl < pls_num; ++pl) { Vertex_const_handle* vh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (vh_cur) { if ((*vh_cur) != (*vh_ref)) { std::cout << "Error: point location number " << pl << std::endl; @@ -1188,13 +1183,13 @@ verify(Variants_vector objs[NUM_PL_STRATEGIES], size_t size, size_t pls_num) std::cout << "Expected: a vertex: "<< (*vh_ref)->point() << std::endl; result += -1; Face_const_handle* fh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (fh_cur) { std::cout << "Actual: a face." << std::endl; continue; } Halfedge_const_handle* hh_cur = - boost::get(&(objs[pl][qi])); + std::get_if(&(objs[pl][qi])); if (hh_cur) { std::cout << "Actual: a halfedge." << std::endl; continue; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h index 9bfe463e3bf..f03b66bb81d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h @@ -136,8 +136,8 @@ protected: typename Traits::Equal_2 equal = this->m_geom_traits.equal_2_object(); if (equal(exp_answer, real_answer)) return true; - std::string exp_answer_str = boost::lexical_cast(exp_answer); - std::string real_answer_str = boost::lexical_cast(real_answer); + std::string exp_answer_str = boost::lexical_cast( CGAL::IO::oformat(exp_answer) ); + std::string real_answer_str = boost::lexical_cast( CGAL::IO::oformat(real_answer) ); this->print_answer(exp_answer_str, real_answer_str, "x-monotone curve"); return false; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h index 680ae201d40..3331200a607 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h @@ -733,7 +733,7 @@ min_vertex_wrapper(std::istringstream& str_stream) unsigned int id1, id2; str_stream >> id1 >> id2; Point_2& exp_answer = this->m_points[id2]; - std::cout << "Test: min_vertex( " << this->m_xcurves[id1] << " ) ? " + std::cout << "Test: min_vertex( " << CGAL::IO::oformat(this->m_xcurves[id1]) << " ) ? " << exp_answer << " "; Point_2 real_answer = @@ -751,7 +751,7 @@ max_vertex_wrapper(std::istringstream& str_stream) unsigned int id1, id2; str_stream >> id1 >> id2; Point_2& exp_answer = this->m_points[id2]; - std::cout << "Test: max_vertex( " << this->m_xcurves[id1] << " ) ? " + std::cout << "Test: max_vertex( " << CGAL::IO::oformat(this->m_xcurves[id1]) << " ) ? " << exp_answer << " "; Point_2 real_answer = @@ -767,7 +767,7 @@ is_vertical_wrapper(std::istringstream& str_stream) unsigned int id; str_stream >> id; bool exp_answer = this->get_expected_boolean(str_stream); - std::cout << "Test: is_vertical( " << this->m_xcurves[id] << " ) ? " + std::cout << "Test: is_vertical( " << CGAL::IO::oformat(this->m_xcurves[id]) << " ) ? " << exp_answer << " "; bool real_answer = @@ -789,7 +789,7 @@ compare_y_at_x_wrapper(std::istringstream& str_stream) str_stream >> id1 >> id2; unsigned int exp_answer = this->get_expected_enum(str_stream); std::cout << "Test: compare_y_at_x( " << this->m_points[id1] << "," - << this->m_xcurves[id2] << " ) ? " << exp_answer << " "; + << CGAL::IO::oformat(this->m_xcurves[id2]) << " ) ? " << exp_answer << " "; unsigned int real_answer = this->m_geom_traits.compare_y_at_x_2_object()(this->m_points[id1], @@ -853,8 +853,8 @@ compare_y_at_x_right_wrapper(std::istringstream& str_stream) unsigned int id1, id2, id3; str_stream >> id1 >> id2 >> id3; unsigned int exp_answer = this->get_expected_enum(str_stream); - std::cout << "Test: compare_y_at_x_right( " << this->m_xcurves[id1] << "," - << this->m_xcurves[id2] << ", " << this->m_points[id3] << " ) ? " + std::cout << "Test: compare_y_at_x_right( " << CGAL::IO::oformat(this->m_xcurves[id1]) << "," + << CGAL::IO::oformat(this->m_xcurves[id2]) << ", " << this->m_points[id3] << " ) ? " << exp_answer << " "; unsigned int real_answer = @@ -891,8 +891,8 @@ equal_curves_wrapper(std::istringstream& str_stream) unsigned int id1, id2; str_stream >> id1 >> id2; bool exp_answer = this->get_expected_boolean(str_stream); - std::cout << "Test: equal( " << this->m_xcurves[id1] << ", " - << this->m_xcurves[id2] << " ) ? " << exp_answer << " "; + std::cout << "Test: equal( " << CGAL::IO::oformat(this->m_xcurves[id1]) << ", " + << CGAL::IO::oformat(this->m_xcurves[id2]) << " ) ? " << exp_answer << " "; bool real_answer = this->m_geom_traits.equal_2_object()(this->m_xcurves[id1], this->m_xcurves[id2]); @@ -913,12 +913,12 @@ make_x_monotone_wrapper(std::istringstream& str_stream) typedef Geom_traits_T Traits; typedef typename Traits::Point_2 Point_2; typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; CGAL_USE_TYPE(typename Traits::Curve_2); unsigned int id; str_stream >> id; - std::cout << "Test: make_x_monotone( " << this->m_curves[id] << " ) ? "; + std::cout << "Test: make_x_monotone( " << CGAL::IO::oformat(this->m_curves[id]) << " ) ? "; std::vector objs; this->m_geom_traits.make_x_monotone_2_object()(this->m_curves[id], std::back_inserter(objs)); @@ -934,14 +934,14 @@ make_x_monotone_wrapper(std::istringstream& str_stream) unsigned int id; // The id of the point or x-monotone str_stream >> id; // ... curve respectively - const auto* xcv_ptr = boost::get(&(objs[i])); + const auto* xcv_ptr = std::get_if(&(objs[i])); if (xcv_ptr != nullptr) { if (!this->compare(type, 1u, "type")) return false; if (!this->compare_curves(this->m_xcurves[id], *xcv_ptr)) return false; continue; } - const auto* pt_ptr = boost::get(&(objs[i])); + const auto* pt_ptr = std::get_if(&(objs[i])); assert(pt_ptr != nullptr); if (!this->compare(type, 0u, "type")) return false; if (!this->compare_points(this->m_points[id], *pt_ptr)) return false; @@ -969,7 +969,7 @@ intersect_wrapper(std::istringstream& str_stream) typedef typename Traits::Multiplicity Multiplicity; typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; unsigned int id1, id2; @@ -979,8 +979,8 @@ intersect_wrapper(std::istringstream& str_stream) this->m_xcurves[id2], std::back_inserter(xections)); - std::cout << "Test: intersect( " << this->m_xcurves[id1] << "," - << this->m_xcurves[id2] << " ) ? "; + std::cout << "Test: intersect( " << CGAL::IO::oformat(this->m_xcurves[id1]) << "," + << CGAL::IO::oformat(this->m_xcurves[id2]) << " ) ? "; size_t num; str_stream >> num; if (! this->compare(num, xections.size(), "size")) return false; @@ -995,7 +995,7 @@ intersect_wrapper(std::istringstream& str_stream) unsigned int exp_type = 1; const X_monotone_curve_2* cv_p = - boost::get(&(xections[i])); + std::get_if(&(xections[i])); if (cv_p != nullptr) { if (! this->compare(type, exp_type, "type")) return false; @@ -1005,7 +1005,7 @@ intersect_wrapper(std::istringstream& str_stream) exp_type = 0; const Intersection_point* p_p = - boost::get(&(xections[i])); + std::get_if(&(xections[i])); assert(p_p != nullptr); if (! this->compare(type, exp_type, "type")) return false; if (! this->compare_points(this->m_points[id], p_p->first)) return false; @@ -1031,7 +1031,7 @@ bool Traits_test::split_wrapper(std::istringstream& str_stream) unsigned int id1, id2, id3, id4; str_stream >> id1 >> id2 >> id3 >> id4; X_monotone_curve_2 cv1, cv2; - std::cout << "Test: split( " << this->m_xcurves[id1] << "," + std::cout << "Test: split( " << CGAL::IO::oformat(this->m_xcurves[id1]) << "," << this->m_points[id2] << " ) ? "; this->m_geom_traits.split_2_object()(this->m_xcurves[id1], @@ -1069,8 +1069,8 @@ are_mergeable_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true) unsigned int id1, id2; str_stream >> id1 >> id2; bool exp_answer = this->get_expected_boolean(str_stream); - std::cout << "Test: are_mergeable( " << this->m_xcurves[id1] << ", " - << this->m_xcurves[id2] << " ) ? " << exp_answer << " "; + std::cout << "Test: are_mergeable( " << CGAL::IO::oformat(this->m_xcurves[id1]) << ", " + << CGAL::IO::oformat(this->m_xcurves[id2]) << " ) ? " << exp_answer << " "; bool real_answer = this->m_geom_traits.are_mergeable_2_object()(this->m_xcurves[id1], @@ -1107,8 +1107,8 @@ Traits_test::merge_wrapper_imp(std::istringstream& str_stream, unsigned int id1, id2, id; str_stream >> id1 >> id2 >> id; X_monotone_curve_2 cv; - std::cout << "Test: merge( " << this->m_xcurves[id1] << ", " - << this->m_xcurves[id2] << " ) ? " << this->m_xcurves[id] << " "; + std::cout << "Test: merge( " << CGAL::IO::oformat(this->m_xcurves[id1]) << ", " + << CGAL::IO::oformat(this->m_xcurves[id2]) << " ) ? " << CGAL::IO::oformat(this->m_xcurves[id]) << " "; this->m_geom_traits.merge_2_object()(this->m_xcurves[id1], this->m_xcurves[id2], cv); @@ -1181,7 +1181,7 @@ parameter_space_in_x_wrapper_imp(std::istringstream& str_stream, CGAL::Arr_curve_end cv_end = CGAL::ARR_MIN_END; if (curves_op) { cv_end = static_cast(next_input.second); - std::cout << "Test: parameter_space_x( " << this->m_xcurves[id] << " , " + std::cout << "Test: parameter_space_x( " << CGAL::IO::oformat(this->m_xcurves[id]) << " , " << (cv_end == CGAL::ARR_MIN_END ? "MIN_END" : "MAX_END") << " ) ? "; next_input = this->get_next_input(str_stream); @@ -1248,8 +1248,8 @@ compare_y_near_boundary_wrapper_imp(std::istringstream& str_stream, assert(next_input.first == Base::CURVE_END); CGAL::Arr_curve_end cv_end = static_cast(next_input.second); - std::cout << "Test: compare_y_near_boundary( " << this->m_xcurves[id1] - << " , " << this->m_xcurves[id2] << " , " + std::cout << "Test: compare_y_near_boundary( " << CGAL::IO::oformat(this->m_xcurves[id1]) + << " , " << CGAL::IO::oformat(this->m_xcurves[id2]) << " , " << (cv_end == CGAL::ARR_MIN_END ? "MIN_END" : "MAX_END") << " ) ? "; next_input = this->get_next_input(str_stream); @@ -1309,7 +1309,7 @@ parameter_space_in_y_wrapper_imp(std::istringstream& str_stream, CGAL::Arr_curve_end cv_end = CGAL::ARR_MIN_END; if (curves_op) { cv_end = static_cast(next_input.second); - std::cout << "Test: parameter_space_y( " << this->m_xcurves[id] << " , " + std::cout << "Test: parameter_space_y( " << CGAL::IO::oformat(this->m_xcurves[id]) << " , " << (cv_end == CGAL::ARR_MIN_END ? "MIN_END" : "MAX_END") << " ) ? "; next_input = this->get_next_input(str_stream); @@ -1381,8 +1381,8 @@ compare_x_near_boundary_wrapper_imp(std::istringstream& str_stream, CGAL::Arr_curve_end cv_end = static_cast(next_input.second); - std::cout << this->m_xcurves[id1] << ", " - << this->m_xcurves[id2] << " , " + std::cout << CGAL::IO::oformat(this->m_xcurves[id1]) << ", " + << CGAL::IO::oformat(this->m_xcurves[id2]) << " , " << this->curve_end_str(cv_end) << " ) ? "; next_input = this->get_next_input(str_stream); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h index 6ffb18e01f3..1fd487652e8 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h @@ -44,9 +44,9 @@ public: typedef typename Arrangement::Edge_const_iterator Edge_const_iterator; typedef typename Arrangement::Vertex_const_iterator Vertex_const_iterator; - typedef boost::variant Cell_type; - typedef boost::optional Vert_type; + typedef std::optional Vert_type; typedef typename std::pair Vert_pair; typedef typename std::pair Vert_decomp_entry; @@ -196,14 +196,14 @@ compare(const Result_type& expected, Vert_type actual) auto obj = *actual; // Assign object to a face. - if (const auto* fh_expected = boost::get(&(expected))) { - if (boost::get(&obj)) { + if (const auto* fh_expected = std::get_if(&(expected))) { + if (std::get_if(&obj)) { std::cout << "Error: vertical decomposition!" << std::endl; std::cout << "Expected: a face." << std::endl; std::cout << "Actual: a vertex." << std::endl; return false; } - if (boost::get(&obj)) { + if (std::get_if(&obj)) { std::cout << "Error: vertical decomposition!" << std::endl; std::cout << "Expected: a face." << std::endl; std::cout << "Actual: a halfedge." << std::endl; @@ -213,9 +213,9 @@ compare(const Result_type& expected, Vert_type actual) } // Assign object to a halfedge. - const auto* hh_expected = boost::get(&(expected)); + const auto* hh_expected = std::get_if(&(expected)); if (hh_expected) { - if (const auto* hh_actual = boost::get(&obj)) { + if (const auto* hh_actual = std::get_if(&obj)) { if (*hh_expected == *hh_actual) return true; std::cout << "Error: vertical decomposition!" << std::endl; @@ -230,13 +230,13 @@ compare(const Result_type& expected, Vert_type actual) std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() << std::endl; - if (const auto* vh_actual = boost::get(&obj)) { + if (const auto* vh_actual = std::get_if(&obj)) { std::cout << "Actual: a vertex, " << (*vh_actual)->point() << std::endl; return false; } Face_const_handle fh_actual; - if (boost::get(&obj)) { + if (std::get_if(&obj)) { std::cout << "Actual: a face." << std::endl; return false; } @@ -245,9 +245,9 @@ compare(const Result_type& expected, Vert_type actual) } // Assign object to a vertex. - const auto* vh_expected = boost::get(&(expected)); + const auto* vh_expected = std::get_if(&(expected)); if (vh_expected) { - if (const auto* vh_actual = boost::get(&obj)) { + if (const auto* vh_actual = std::get_if(&obj)) { if (*vh_expected == *vh_actual) return true; std::cout << "Error: vertical decomposition!" << std::endl; @@ -261,12 +261,12 @@ compare(const Result_type& expected, Vert_type actual) std::cout << "Error: vertical decomposition!" << std::endl; std::cout << "Expected: a vertex, " << (*vh_expected)->point() << std::endl; - if (const auto* hh_actual = boost::get(&obj)) { + if (const auto* hh_actual = std::get_if(&obj)) { std::cout << "Actual: a halfedge, " << (*hh_actual)->curve() << std::endl; return false; } - if (boost::get(&obj)) { + if (std::get_if(&obj)) { std::cout << "Actual: a face." << std::endl; return false; } @@ -291,22 +291,22 @@ print(const Vert_decomp_entry& result) assert(obj_below); auto obj = *obj_below; std::cout << " feature below: "; - if (const auto* hh = boost::get(&obj)) + if (const auto* hh = std::get_if(&obj)) std::cout << '[' << (*hh)->curve() << ']'; - else if (const auto* vh = boost::get(&obj)) + else if (const auto* vh = std::get_if(&obj)) std::cout << '(' << (*vh)->point() << ')'; - else if (const auto* fh = boost::get(&obj)) + else if (const auto* fh = std::get_if(&obj)) std::cout << "NONE"; else std::cout << "EMPTY"; assert(obj_above); obj = *obj_above; std::cout << " feature above: "; - if (const auto* hh = boost::get(&obj)) + if (const auto* hh = std::get_if(&obj)) std::cout << '[' << (*hh)->curve() << ']'; - else if (const auto* vh = boost::get(&obj)) + else if (const auto* vh = std::get_if(&obj)) std::cout << '(' << (*vh)->point() << ')'; - else if (const auto* vh = boost::get(&obj)) + else if (const auto* vh = std::get_if(&obj)) std::cout << "NONE"; else std::cout << "EMPTY"; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 898b96445fe..783ba994ab8 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -706,15 +706,6 @@ function(test_point_location_segments) compile_and_run_with_flags(test_point_location segments "${flags}" segments) endfunction() -# For backward compatibility -function(test_point_location_segments_version) - set(nt ${CGAL_GMPQ_NT}) - set(kernel ${CARTESIAN_KERNEL}) - set(geom_traits ${SEGMENT_GEOM_TRAITS}) - set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DCGAL_ARR_POINT_LOCATION_VERSION=1") - compile_and_run_with_flags(test_point_location segments "${flags}" segments_version) -endfunction() - # For backward compatibility function(test_point_location_segments_conversion) set(nt ${CGAL_GMPQ_NT}) @@ -1366,7 +1357,6 @@ test_overlay_segments() test_overlay_spherical_arcs() test_point_location_segments() -test_point_location_segments_version() test_point_location_segments_conversion() test_point_location_circle_segments() test_point_location_linear() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake index ee92d955c82..4d62ce61777 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake @@ -911,16 +911,6 @@ test_point_location_segments() compile_and_run_with_flags test_point_location segments "$flags" } -# For backward compatibility -test_point_location_segments_version() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DCGAL_ARR_POINT_LOCATION_VERSION=1"; - compile_and_run_with_flags test_point_location segments "$flags" -} - # For backward compatibility test_point_location_segments_conversion() { @@ -1706,7 +1696,6 @@ test_overlay_segments test_overlay_spherical_arcs test_point_location_segments -test_point_location_segments_version test_point_location_segments_conversion test_point_location_circle_segments test_point_location_linear diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp index 2856f82b076..ff71cbf9ac9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp @@ -19,7 +19,7 @@ typedef Sub_traits_2::CoordNT CoordNT; typedef Sub_traits_2::Point_2 Point_2; typedef Sub_traits_2::Curve_2 Subcurve_2; typedef Sub_traits_2::X_monotone_curve_2 Subcurve_x_monotone_2; -typedef boost::variant +typedef std::variant Make_sub_x_monotone_result; void check_equal() @@ -81,8 +81,8 @@ void check_intersect(Traits_2::Make_x_monotone_2 make_x_monotone_2(curve1, std::back_inserter(x_monotone_curves)); make_x_monotone_2(curve2, std::back_inserter(x_monotone_curves)); - const auto* x_curve1 = boost::get(curves[0]); - const auto* x_curve2 = boost::get(curves[1]); + const auto* x_curve1 = std::get(curves[0]); + const auto* x_curve2 = std::get(curves[1]); std::vector Points_of_intersection; @@ -100,7 +100,7 @@ void check_intersect(Traits_2::Make_x_monotone_2 curve3 = Subcurve_2(c6, 1, CGAL::CLOCKWISE, s6, t6); make_x_monotone_2(curve3, std::back_inserter(x_curves)); - const auto* x_curve2 = boost::get<>(&x_curves[2]); + const auto* x_curve2 = std::get<>(&x_curves[2]); Points_of_intersection.clear(); //intersect_2(X_monotone_curve1, X_monotone_curve2, @@ -131,8 +131,8 @@ check_compare_end_points_xy_2(Traits_2::Compare_endpoints_xy_2 std::vector x_curves; make_x_monotone_2(curve1, std::back_inserter(x_curves)); - const auto* x_curve1 = boost::get(&x_curves[0]); - const auto* x_curve2 = boost::get(&x_curves[1]); + const auto* x_curve1 = std::get_if(&x_curves[0]); + const auto* x_curve2 = std::get_if(&x_curves[1]); auto res = compare_endpoints_xy_2(x_curve1); std::cout<< "The first result is: " << res << std::endl; @@ -143,7 +143,7 @@ check_compare_end_points_xy_2(Traits_2::Compare_endpoints_xy_2 Point_2 s2 = Point_2(one_plus_sqrt_3, CoordNT(1)); curve2 = Subcurve_2(circ2, s1, t1); make_x_monotone_2(curve2, std::back_inserter(x_curves)); - const auto* x_curve2 = boost::get(&x_curves[1]); + const auto* x_curve2 = std::get_if(&x_curves[1]); res = compare_endpoints_xy_2(x_curve2); @@ -170,7 +170,7 @@ void check_split(Traits_2::Split_2 split_2, //make x_monotone std::vector x_curves; make_x_monotone_2(curve, std::back_inserter(x_curves)); - const auto* x_curve1 = boost::get(&x_curves[0]); + const auto* x_curve1 = std::get_if(&x_curves[0]); // Subcurve_x_monotone_2 split_x_monotone_curve1, split_x_monotone_curve2 ; //split_2(X_monotone_curve, Kernel::Point_2::Kernel::Point_2(1, 4), @@ -200,8 +200,8 @@ void check_is_vertical(Traits_2::Make_x_monotone_2 //std::vector x_monotone_polycurves; - const auto* x_polycurve1 = boost::get(&x_curves[0]); - const auto* x_polycurve2 = boost::get(&x_curves[1]); + const auto* x_polycurve1 = std::get_if(&x_curves[0]); + const auto* x_polycurve2 = std::get_if(&x_curves[1]); bool res = is_vertical(x_polycurve1); std::cout << "Is_verticle:: The xmonotone curve (quarter circle) is : " @@ -232,8 +232,8 @@ void check_compare_y_at_x_2(Traits_2::Make_x_monotone_2 make_x_monotone_2, for (const auto& cv : curves) make_x_monotone_2(cv, std::back_inserter(x_curves)); - const auto* x_polycurve1 = boost::get(&x_curves[0]); - const auto* x_polycurve2 = boost::get(&x_curves[1]); + const auto* x_polycurve1 = std::get_if(&x_curves[0]); + const auto* x_polycurve2 = std::get_if(&x_curves[1]); Kernel::Point_2 p_test = Kernel::Point_2(3, 1); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_bezier_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_bezier_polycurve.cpp index 9936d4648ec..f36f4cc5b2a 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_bezier_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_bezier_polycurve.cpp @@ -34,7 +34,7 @@ typedef CGAL::Arr_polyline_traits_2 Bezier_polycurve_traits; typedef Bezier_polycurve_traits::Curve_2 Polycurve_bezier; typedef Bezier_polycurve_traits::X_monotone_curve_2 X_polycurve_bezier; -typedef boost::variant +typedef std::variant Make_x_monotone_result; int main (int argc, char *argv[]) @@ -60,7 +60,7 @@ int main (int argc, char *argv[]) //creating x-mono bezier bezier_traits.make_x_monotone_2_object()(curve_1, std::back_inserter(objs)); //std::cout << "number of x_curves: " << obj_vector.size() << std::endl; - const auto* x_curve_1 = boost::get(&(obj_vector[0])); + const auto* x_curve_1 = std::get_if(&(obj_vector[0])); assert(x_curve_1); //std::cout << x_curve << std::endl; @@ -74,7 +74,7 @@ int main (int argc, char *argv[]) //creating x-monotne obj_vector.clear(); bezier_traits.make_x_monotone_2_object()( curve_2, std::back_inserter(objs)); - const auto* x_curve_2 = boost::get(&(obj_vector[0])); + const auto* x_curve_2 = std::get_if(&(obj_vector[0])); //push curves into polyline vectors curves_vector.push_back(curve_1); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp index 32395799ae5..9c65e0f3ca9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp @@ -92,7 +92,7 @@ void check_make_x_monotone(typename GeometryTraits::Curve_2 cv, typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_traits_2 X_monotone_traits_2; - typedef boost::variant + typedef std::variant Make_x_monotone_result; std::vector objs; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp index dda30274d8d..98bedd90038 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp @@ -107,7 +107,7 @@ void check_equal() { typedef typename Traits::Point_2 Point_2; typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; std::vector intersection_points; @@ -623,7 +623,7 @@ template void check_make_x_monotne_curve(const typename GeometryTraits::Curve_2& c1) { typename GeometryTraits::Point_2 Point_2; typename GeometryTraits::X_monotone_curve_2 X_monotone_curve_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; Polycurve_conic_traits_2 traits; std::vector objs; traits.make_x_monotone_2_object()(c1, std::back_inserter(objs)); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_polycurve_intersection.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_polycurve_intersection.cpp index 2c0a68510c7..dda2f0c27c9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_polycurve_intersection.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_polycurve_intersection.cpp @@ -26,18 +26,19 @@ struct Test_functor Test_functor (const X_monotone_polyline& reference) : reference (&reference) { } - void operator() (const CGAL::Object& obj) const + void operator()(std::pair) { - const X_monotone_polyline* poly - = CGAL::object_cast(&obj); - assert(poly != nullptr); // Intersection is not a polyline + assert(!"This overload should not be called"); + } + void operator() (const X_monotone_polyline& poly) const + { typename X_monotone_polyline::Point_const_iterator itref = reference->points_begin(), - itpoly = poly->points_begin(); + itpoly = poly.points_begin(); for (; itref != reference->points_end() - && itpoly != poly->points_end(); + && itpoly != poly.points_end(); ++ itref, ++ itpoly) assert(*itref == *itpoly); } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vert_ray_shoot_vert_segments.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vert_ray_shoot_vert_segments.cpp index 07cfc97e199..3dd0399d9dd 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vert_ray_shoot_vert_segments.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vert_ray_shoot_vert_segments.cpp @@ -22,17 +22,17 @@ void vertical_ray_shooting_query if (shoot_up) std::cout << " Shooting up from (" << q << ") : "; else std::cout << " Shooting down from (" << q << ") : "; - if (auto* e_p = boost::get(&obj)) { + if (auto* e_p = std::get_if(&obj)) { // We hit an edge: std::cout << "hit an edge: " << (*e_p)->curve() << std::endl; } - else if (auto* v_p = boost::get(&obj)) { + else if (auto* v_p = std::get_if(&obj)) { // We hit a vertex: if ((*v_p)->is_isolated()) std::cout << "hit an isolated vertex: " << (*v_p)->point() << std::endl; else std::cout << "hit a vertex: " << (*v_p)->point() << std::endl; } - else if (auto* f_p = boost::get(&obj)) { + else if (auto* f_p = std::get_if(&obj)) { // We did not hit anything: assert((*f_p)->is_unbounded()); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_zone.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_zone.cpp index 54291b4bf5a..78b9cbadd4d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_zone.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_zone.cpp @@ -17,7 +17,7 @@ typedef CGAL::Arrangement_2 Arrangement_2; typedef Arrangement_2::Vertex_handle Vertex_handle; typedef Arrangement_2::Halfedge_handle Halfedge_handle; typedef Arrangement_2::Face_handle Face_handle; -typedef boost::variant +typedef std::variant Zone_result; #define N_SEGMENTS 3 diff --git a/BGL/examples/BGL_triangulation_2/dijkstra.cpp b/BGL/examples/BGL_triangulation_2/dijkstra.cpp index 3a1b061eb9e..1e63fc8810f 100644 --- a/BGL/examples/BGL_triangulation_2/dijkstra.cpp +++ b/BGL/examples/BGL_triangulation_2/dijkstra.cpp @@ -60,9 +60,9 @@ int main(int argc,char* argv[]) for(vertex_descriptor vd : vertices(tr)) { std::cout << vd->point() << " [" << vertex_id_map[vd] << "] "; - std::cout << " has distance = " << boost::get(distance_pmap,vd) + std::cout << " has distance = " << get(distance_pmap,vd) << " and predecessor "; - vd = boost::get(predecessor_pmap,vd); + vd = get(predecessor_pmap,vd); std::cout << vd->point() << " [" << vertex_id_map[vd] << "]\n "; } diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 34597b22192..76135fd82a7 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -60,7 +60,7 @@ bool is_border(typename boost::graph_traits::edge_descriptor ed, cons returns a halfedge which is on a border and whose target vertex is `vd`, if such a halfedge exists. */ template -boost::optional::halfedge_descriptor> +std::optional::halfedge_descriptor> is_border(typename boost::graph_traits::vertex_descriptor vd, const FaceGraph& g) { @@ -72,7 +72,7 @@ is_border(typename boost::graph_traits::vertex_descriptor vd, } } // empty - return boost::optional::halfedge_descriptor>(); + return std::optional::halfedge_descriptor>(); } namespace BGL { diff --git a/BGL/test/BGL/test_Gwdwg.cpp b/BGL/test/BGL/test_Gwdwg.cpp index e250c5a63a2..08a742f0be1 100644 --- a/BGL/test/BGL/test_Gwdwg.cpp +++ b/BGL/test/BGL/test_Gwdwg.cpp @@ -22,7 +22,7 @@ int main() Mesh mesh2(sm2); try { if( target( *(halfedges(mesh).first), mesh2) == *(vertices(mesh).first)){ - CGAL_error_msg("The previous lie should have throw a exception"); + CGAL_error_msg("The previous line should have throw an exception"); } } catch(...){ std::cerr << "we caught it" << std::endl; diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Concepts/BarycentricCoordinates_2.h b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Concepts/BarycentricCoordinates_2.h index 7f9ea3dfcbb..da4b706b9bb 100644 --- a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Concepts/BarycentricCoordinates_2.h +++ b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Concepts/BarycentricCoordinates_2.h @@ -44,7 +44,7 @@ public: Weights are computed with respect to a query point of the type `Traits::Point_2` and stored in the output iterator `output`. The function returns a pointer to the last stored element. */ - boost::optional + std::optional weights( const Traits::Point_2& query_point, OutputIterator& output) { @@ -57,7 +57,7 @@ public: are computed with respect to a query point of the type `Traits::Point_2` and stored in the output iterator `output`. The function returns a pointer to the last stored element. */ - boost::optional + std::optional coordinates_on_bounded_side( const Traits::Point_2& query_point, OutputIterator& output, @@ -72,7 +72,7 @@ public: are computed with respect to a query point of the type `Traits::Point_2` and stored in the output iterator `output`. The function returns a pointer to the last stored element. */ - boost::optional + std::optional coordinates_on_unbounded_side( const Traits::Point_2& query_point, OutputIterator& output, diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h index 91d96c2f1c4..8ef72b0bce5 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h @@ -24,7 +24,7 @@ #include // Boost headers. -#include +#include // CGAL namespace. namespace CGAL { @@ -98,7 +98,7 @@ public: // This function computes discrete harmonic weights (unnormalized coordinates) for a chosen query point. template - inline boost::optional weights(const Point_2 &query_point, OutputIterator &output) + inline std::optional weights(const Point_2 &query_point, OutputIterator &output) { return weights_2(query_point, output); } @@ -108,7 +108,7 @@ public: // This function computes discrete harmonic barycentric coordinates for a chosen query point on the bounded side of a strictly convex polygon. // \pre The provided polygon is strictly convex. template - inline boost::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { switch(type_of_algorithm) { @@ -124,14 +124,14 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // This function computes discrete harmonic barycentric coordinates for a chosen query point on the unbounded side of a strictly convex polygon. // \pre The provided polygon is strictly convex. template - inline boost::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm, const bool warning_tag = true) + inline std::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm, const bool warning_tag = true) { switch(type_of_algorithm) { @@ -147,8 +147,8 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // Information Functions @@ -184,7 +184,7 @@ private: // Compute discrete harmonic weights without normalization. template - boost::optional weights_2(const Point_2 &query_point, OutputIterator &output) + std::optional weights_2(const Point_2 &query_point, OutputIterator &output) { // Get the number of vertices in the polygon. const int n = int(number_of_vertices); @@ -220,7 +220,7 @@ private: ++output; // Return weights. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON BOUNDED SIDE. @@ -228,7 +228,7 @@ private: // Compute discrete harmonic coordinates on the bounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) { CGAL_precondition( type_of_polygon() == STRICTLY_CONVEX ); @@ -281,13 +281,13 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // Compute discrete harmonic coordinates on the bounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) { CGAL_precondition( type_of_polygon() == STRICTLY_CONVEX ); @@ -338,7 +338,7 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON UNBOUNDED SIDE. @@ -346,7 +346,7 @@ private: // Compute discrete harmonic coordinates on the unbounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) + std::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) { if(warning_tag) std::cout << std::endl << "ATTENTION: Discrete harmonic coordinates might be not well-defined outside the polygon!" << std::endl; @@ -358,7 +358,7 @@ private: // Compute discrete harmonic coordinates on the unbounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) + std::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) { if(warning_tag) std::cout << std::endl << "ATTENTION: Discrete harmonic coordinates might be not well-defined outside the polygon!" << std::endl; diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h index 381291b3a33..94db271c736 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h @@ -24,7 +24,7 @@ #include // Boost headers. -#include +#include // CGAL namespace. namespace CGAL { @@ -118,7 +118,7 @@ public: /// `CGAL::Barycentric_coordinates::PRECISE` - default slow algorithm, which is as precise as possible and /// `CGAL::Barycentric_coordinates::FAST` - fast algorithm, which is less precise but much faster. template - inline boost::optional operator()(const Point_2 &query_point, OutputIterator output, Query_point_location query_point_location = UNSPECIFIED_LOCATION, Type_of_algorithm type_of_algorithm = PRECISE) + inline std::optional operator()(const Point_2 &query_point, OutputIterator output, Query_point_location query_point_location = UNSPECIFIED_LOCATION, Type_of_algorithm type_of_algorithm = PRECISE) { return coordinates_2(query_point, output, query_point_location, type_of_algorithm); } @@ -129,7 +129,7 @@ public: /// \pre The provided query point belongs to the polygon's boundary. /// \pre (0 <= index) && (index < number of the polygon's vertices). template - inline boost::optional compute_on_edge(const Point_2 &query_point, const int index, OutputIterator output) const + inline std::optional compute_on_edge(const Point_2 &query_point, const int index, OutputIterator output) const { return coordinates_on_boundary_2(query_point, index, output); } @@ -139,7 +139,7 @@ public: /// /// \pre (0 <= index) && (index < number of the polygon's vertices). template - inline boost::optional compute_on_vertex(const int index, OutputIterator output) const + inline std::optional compute_on_vertex(const int index, OutputIterator output) const { return coordinates_on_vertex_2(index, output); } @@ -149,7 +149,7 @@ public: /// /// \pre The provided query point belongs to the polygon's interior, excluding the boundary. template - inline boost::optional compute_weights(const Point_2 &query_point, OutputIterator output) + inline std::optional compute_weights(const Point_2 &query_point, OutputIterator output) { return weights_2(query_point, output); } @@ -183,7 +183,7 @@ public: // This function accepts a container of the type `std::vector` // and returns an iterator of the type `std::back_insert_iterator` // that is placed past-the-end of the resulting sequence of coordinate values. - inline boost::optional > > operator()(const Point_2 &query_point, std::vector &output_vector, Query_point_location query_point_location = UNSPECIFIED_LOCATION, Type_of_algorithm type_of_algorithm = PRECISE) + inline std::optional > > operator()(const Point_2 &query_point, std::vector &output_vector, Query_point_location query_point_location = UNSPECIFIED_LOCATION, Type_of_algorithm type_of_algorithm = PRECISE) { output_vector.reserve(output_vector.size() + number_of_vertices); typedef typename std::back_insert_iterator > OutputIterator; @@ -198,7 +198,7 @@ public: // // \pre The provided query point belongs to the polygon's boundary. // \pre (0 <= index) && (index < number of the polygon's vertices). - inline boost::optional > > compute_on_edge(const Point_2 &query_point, const int index, std::vector &output_vector) const + inline std::optional > > compute_on_edge(const Point_2 &query_point, const int index, std::vector &output_vector) const { output_vector.reserve(output_vector.size() + number_of_vertices); typedef typename std::back_insert_iterator > OutputIterator; @@ -212,7 +212,7 @@ public: // that is placed past-the-end of the resulting sequence of coordinate values. // // \pre (0 <= index) && (index < number of the polygon's vertices). - inline boost::optional > > compute_on_vertex(const int index, std::vector &output_vector) const + inline std::optional > > compute_on_vertex(const int index, std::vector &output_vector) const { output_vector.reserve(output_vector.size() + number_of_vertices); typedef typename std::back_insert_iterator > OutputIterator; @@ -226,7 +226,7 @@ public: // that is placed past-the-end of the resulting sequence of weight values. // // \pre The provided query point belongs to the polygon's interior, excluding the boundary. - inline boost::optional > > compute_weights(const Point_2 &query_point, std::vector &output_vector) + inline std::optional > > compute_weights(const Point_2 &query_point, std::vector &output_vector) { output_vector.reserve(output_vector.size() + number_of_vertices); typedef typename std::back_insert_iterator > OutputIterator; @@ -283,7 +283,7 @@ private: // Compute weights on the bounded side of the polygon - see precondition. template - inline boost::optional weights_2(const Point_2 &query_point, OutputIterator &output) + inline std::optional weights_2(const Point_2 &query_point, OutputIterator &output) { // This is the only global precondition on the computation of weights. CGAL_precondition( CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits) == CGAL::ON_BOUNDED_SIDE ); @@ -295,7 +295,7 @@ private: // Compute coordinates at any point in the plane. template - boost::optional coordinates_2(const Point_2 &query_point, OutputIterator &output, const Query_point_location query_point_location, const Type_of_algorithm type_of_algorithm) + std::optional coordinates_2(const Point_2 &query_point, OutputIterator &output, const Query_point_location query_point_location, const Type_of_algorithm type_of_algorithm) { // Determine a location of the current query point provided by the user. switch(query_point_location) @@ -324,13 +324,13 @@ private: // Pointer cannot be here. Something went wrong. const bool query_point_location_failure = true; CGAL_postcondition( !query_point_location_failure ); - if(!query_point_location_failure) return boost::optional(output); - else return boost::optional(); + if(!query_point_location_failure) return std::optional(output); + else return std::optional(); } // Compute coordinates at any point in the plane with unspecified location. template - boost::optional coordinates_unspecified_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + std::optional coordinates_unspecified_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { // Determine a global location of the current query point. switch(CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits)) @@ -355,15 +355,15 @@ private: // Pointer cannot be here. Something went wrong. const bool query_point_location_failure = true; CGAL_postcondition( !query_point_location_failure ); - if(!query_point_location_failure) return boost::optional(output); - else return boost::optional(); + if(!query_point_location_failure) return std::optional(output); + else return std::optional(); } // COORDINATES ON BOUNDED SIDE. // Compute coordinates on the bounded side of the polygon - precise or fast. template - inline boost::optional coordinates_on_bounded_side_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_bounded_side_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { CGAL_precondition( CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits) == CGAL::ON_BOUNDED_SIDE ); @@ -374,7 +374,7 @@ private: // Compute coordinates along the boundary of the polygon with beforehand known index of the edge to which the query point belongs. template - boost::optional coordinates_on_boundary_2(const Point_2 &query_point, const int index, OutputIterator &output) const + std::optional coordinates_on_boundary_2(const Point_2 &query_point, const int index, OutputIterator &output) const { CGAL_precondition( CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits) == CGAL::ON_BOUNDARY ); CGAL_precondition( (0 <= index) && (index < int(number_of_vertices)) ); @@ -393,7 +393,7 @@ private: // Compute segment coordinates along the chosen edge with the index = `index`. Segment_coordinates_2 segment_coordinates(vertex[index], vertex[index+1]); - boost::optional success = segment_coordinates(query_point, output); + std::optional success = segment_coordinates(query_point, output); ++output; for(int i = index + 1; i < last; ++i) { @@ -402,20 +402,20 @@ private: } // Return coordinates. - if(success) return boost::optional(output); - else return boost::optional(); + if(success) return std::optional(output); + else return std::optional(); } // Pointer cannot be here. Something went wrong. const bool coordinates_on_boundary_failure = true; CGAL_postcondition( !coordinates_on_boundary_failure ); - if(!coordinates_on_boundary_failure) return boost::optional(output); - else return boost::optional(); + if(!coordinates_on_boundary_failure) return std::optional(output); + else return std::optional(); } // Compute coordinates along the boundary of the polygon without beforehand known index of the edge to which the query point belongs. template - boost::optional coordinates_on_boundary_2(const Point_2 &query_point, OutputIterator &output) const + std::optional coordinates_on_boundary_2(const Point_2 &query_point, OutputIterator &output) const { CGAL_precondition( CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits) == CGAL::ON_BOUNDARY ); @@ -435,7 +435,7 @@ private: // Compute segment coordinates along the edge with the query point. Segment_coordinates_2 segment_coordinates(vertex[index], vertex[index+1]); - boost::optional success = segment_coordinates(query_point, output); + std::optional success = segment_coordinates(query_point, output); if(success) status = true; ++output; break; @@ -452,20 +452,20 @@ private: } // Return coordinates. - if(status == true) return boost::optional(output); - else return boost::optional(); + if(status == true) return std::optional(output); + else return std::optional(); } // Pointer cannot be here. Something went wrong. const bool coordinates_on_boundary_failure = true; CGAL_postcondition( !coordinates_on_boundary_failure ); - if(!coordinates_on_boundary_failure) return boost::optional(output); - else return boost::optional(); + if(!coordinates_on_boundary_failure) return std::optional(output); + else return std::optional(); } // Compute coordinates for a query point lying on the last edge of the polygon. template - boost::optional coordinates_on_last_edge_2(const Point_2 &query_point, const int last, OutputIterator &output) const + std::optional coordinates_on_last_edge_2(const Point_2 &query_point, const int last, OutputIterator &output) const { // Some convenient typedefs. typedef std::vector Coordinate_vector; @@ -478,7 +478,7 @@ private: // Compute segment coordinates along the last edge of the polygon. Segment_coordinates_2 segment_coordinates(vertex[last], vertex[0]); - boost::optional success = segment_coordinates(query_point, std::back_inserter(coordinate)); + std::optional success = segment_coordinates(query_point, std::back_inserter(coordinate)); // Store all the coordinate values. // All the values are zeros apart from those corresponding to the first and the last vertices of the polygon. @@ -492,15 +492,15 @@ private: ++output; // Return computed coordinates. - if(success) return boost::optional(output); - else return boost::optional(); + if(success) return std::optional(output); + else return std::optional(); } // COORDINATES AT VERTEX. // Compute coordinates for a query point lying at one of the polygon's vertices with beforehand known vertex's index. template - boost::optional coordinates_on_vertex_2(const int index, OutputIterator &output) const + std::optional coordinates_on_vertex_2(const int index, OutputIterator &output) const { CGAL_precondition( (0 <= index) && (index < int(number_of_vertices)) ); @@ -519,12 +519,12 @@ private: } // Return coordinates. - return boost::optional(output); + return std::optional(output); } // Compute coordinates for a query point lying at one of the polygon's vertices without beforehand known vertex's index. template - boost::optional coordinates_on_vertex_2(const Point_2 &query_point, OutputIterator &output) const + std::optional coordinates_on_vertex_2(const Point_2 &query_point, OutputIterator &output) const { int index = -1; CGAL_precondition( is_query_point_at_vertex(query_point, index) ); @@ -554,15 +554,15 @@ private: // Return coordinates. CGAL_postcondition( !coordinates_on_vertex_failure ); - if(!coordinates_on_vertex_failure) return boost::optional(output); - else return boost::optional(); + if(!coordinates_on_vertex_failure) return std::optional(output); + else return std::optional(); } // COORDINATES ON UNBOUNDED SIDE. // Compute coordinates on the unbounded side of the polygon - precise or fast. template - inline boost::optional coordinates_on_unbounded_side_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_unbounded_side_2(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { CGAL_precondition( CGAL::bounded_side_2(vertex.begin(), vertex.end(), query_point, barycentric_traits) == CGAL::ON_UNBOUNDED_SIDE ); diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h index ef895698b0a..2dca8b2b8fb 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h @@ -26,7 +26,7 @@ // Boost headers. #include -#include +#include // Barycentric coordinates headers. #include @@ -154,7 +154,7 @@ public: // This function computes mean value weights (unnormalized coordinates) for a chosen query point. template - inline boost::optional weights(const Point_2 &query_point, OutputIterator &output) + inline std::optional weights(const Point_2 &query_point, OutputIterator &output) { return weights_2(query_point, output); } @@ -163,7 +163,7 @@ public: // This function computes mean value barycentric coordinates for a chosen query point on the bounded side of a simple polygon. template - inline boost::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { switch(type_of_algorithm) { @@ -179,13 +179,13 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // This function computes mean value barycentric coordinates for a chosen query point on the unbounded side of a simple polygon. template - inline boost::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { switch(type_of_algorithm) { @@ -201,8 +201,8 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // Information Functions @@ -243,7 +243,7 @@ private: // Compute mean value weights without normalization. template - boost::optional weights_2(const Point_2 &query_point, OutputIterator &output) + std::optional weights_2(const Point_2 &query_point, OutputIterator &output) { // Get the number of vertices in the polygon. const int n = int(number_of_vertices); @@ -293,7 +293,7 @@ private: ++output; // Return weights. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON BOUNDED SIDE. @@ -301,7 +301,7 @@ private: // Compute mean value coordinates on the bounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) { // Get the number of vertices in the polygon. const int n = int(number_of_vertices); @@ -368,13 +368,13 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // Compute mean value coordinates on the bounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) { // Get the number of vertices in the polygon. const int n = int(number_of_vertices); @@ -437,7 +437,7 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON UNBOUNDED SIDE. @@ -445,7 +445,7 @@ private: // Compute mean value coordinates on the unbounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) { // Use the same formulas as for the bounded side since they are also valid on the unbounded side. return coordinates_on_bounded_side_precise_2(query_point, output); @@ -454,7 +454,7 @@ private: // Compute mean value coordinates on the unbounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) { // Use the same formulas as for the bounded side since they are also valid on the unbounded side. return coordinates_on_bounded_side_fast_2(query_point, output); diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h index 469b84a09a3..d43f879bdf5 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h @@ -24,7 +24,7 @@ #include // Boost headers. -#include +#include // CGAL namespace. namespace CGAL { @@ -96,7 +96,7 @@ public: // This function computes Wachspress weights (unnormalized coordinates) for a chosen query point. template - inline boost::optional weights(const Point_2 &query_point, OutputIterator &output) + inline std::optional weights(const Point_2 &query_point, OutputIterator &output) { return weights_2(query_point, output); } @@ -106,7 +106,7 @@ public: // This function computes Wachspress barycentric coordinates for a chosen query point on the bounded side of a strictly convex polygon. // \pre The provided polygon is strictly convex. template - inline boost::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) + inline std::optional coordinates_on_bounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm) { switch(type_of_algorithm) { @@ -122,14 +122,14 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // This function computes Wachspress barycentric coordinates for a chosen query point on the unbounded side of a strictly convex polygon. // \pre The provided polygon is strictly convex. template - inline boost::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm, const bool warning_tag = true) + inline std::optional coordinates_on_unbounded_side(const Point_2 &query_point, OutputIterator &output, const Type_of_algorithm type_of_algorithm, const bool warning_tag = true) { switch(type_of_algorithm) { @@ -145,8 +145,8 @@ public: // Pointer cannot be here. Something went wrong. const bool type_of_algorithm_failure = true; CGAL_postcondition( !type_of_algorithm_failure ); - if(!type_of_algorithm_failure) return boost::optional(output); - else return boost::optional(); + if(!type_of_algorithm_failure) return std::optional(output); + else return std::optional(); } // Information Functions @@ -181,7 +181,7 @@ private: // Compute Wachspress weights without normalization. template - boost::optional weights_2(const Point_2 &query_point, OutputIterator &output) + std::optional weights_2(const Point_2 &query_point, OutputIterator &output) { // Get the number of vertices in the polygon. const int n = int(number_of_vertices); @@ -214,7 +214,7 @@ private: ++output; // Return weights. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON BOUNDED SIDE. @@ -222,7 +222,7 @@ private: // Compute Wachspress coordinates on the bounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_precise_2(const Point_2 &query_point, OutputIterator &output) { CGAL_precondition( type_of_polygon() == STRICTLY_CONVEX ); @@ -265,13 +265,13 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // Compute Wachspress coordinates on the bounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) + std::optional coordinates_on_bounded_side_fast_2(const Point_2 &query_point, OutputIterator &output) { CGAL_precondition( type_of_polygon() == STRICTLY_CONVEX ); @@ -319,7 +319,7 @@ private: ++output; // Return coordinates. - return boost::optional(output); + return std::optional(output); } // COORDINATES ON UNBOUNDED SIDE. @@ -327,7 +327,7 @@ private: // Compute Wachspress coordinates on the unbounded side of the polygon with the slow O(n^2) but precise algorithm. // Here, n - is the number of the polygon's vertices. template - boost::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) + std::optional coordinates_on_unbounded_side_precise_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) { if(warning_tag) std::cout << std::endl << "ATTENTION: Wachspress coordinates might be not well-defined outside the polygon!" << std::endl; @@ -339,7 +339,7 @@ private: // Compute Wachspress coordinates on the unbounded side of the polygon with the fast O(n) but less precise algorithm. // Here, n - is the number of the polygon's vertices. Precision is lost near the boundary (~ 1.0e-10 and closer). template - boost::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) + std::optional coordinates_on_unbounded_side_fast_2(const Point_2 &query_point, OutputIterator &output, bool warning_tag) { if(warning_tag) std::cout << std::endl << "ATTENTION: Wachspress coordinates might be not well-defined outside the polygon!" << std::endl; diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/internal/utils_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/internal/utils_2.h index 7faa4f49eb2..0cc79e16bc0 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/internal/utils_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/internal/utils_2.h @@ -31,7 +31,7 @@ // Boost headers. #include -#include +#include // Internal includes. #include @@ -222,7 +222,7 @@ namespace internal { typename VertexRange, typename GeomTraits, typename PointMap> - boost::optional< std::pair > + std::optional< std::pair > get_edge_index_approximate( const VertexRange& polygon, const typename GeomTraits::Point_2& query, @@ -264,7 +264,7 @@ namespace internal { return std::make_pair(Query_point_location::ON_EDGE, i); } } - return boost::none; + return std::nullopt; } // Why this one does not work for harmonic coordinates? - Due to the imprecisions in the Mesh_2 class. @@ -273,7 +273,7 @@ namespace internal { typename VertexRange, typename GeomTraits, typename PointMap> - boost::optional< std::pair > + std::optional< std::pair > get_edge_index_exact( const VertexRange& polygon, const typename GeomTraits::Point_2& query, @@ -303,7 +303,7 @@ namespace internal { return std::make_pair(Query_point_location::ON_EDGE, i); } } - return boost::none; + return std::nullopt; } // Check whether a query point belongs to the last polygon edge. @@ -409,7 +409,7 @@ namespace internal { typename VertexRange, typename GeomTraits, typename PointMap> - boost::optional< std::pair > + std::optional< std::pair > locate_wrt_polygon_2( const VertexRange& polygon, const typename GeomTraits::Point_2& query, @@ -430,7 +430,7 @@ namespace internal { default: return std::make_pair(Query_point_location::UNSPECIFIED, std::size_t(-1)); } - return boost::none; + return std::nullopt; } } // namespace internal diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/segment_coordinates_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/segment_coordinates_2.h index b2b3120e0ba..99f9c6fb76f 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/segment_coordinates_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/segment_coordinates_2.h @@ -245,7 +245,7 @@ namespace Barycentric_coordinates { /// Computes segment barycentric coordinates for a chosen query point with respect to both vertices of the segment. /// Computed coordinates are stored in the output iterator `output`. template - inline boost::optional operator()( + inline std::optional operator()( const Point_2 &query_point, OutputIterator output) { return segment_coordinates_2(query_point, output); @@ -280,7 +280,7 @@ namespace Barycentric_coordinates { // This function accepts a container of the type `std::vector` // and returns an iterator of the type `std::back_insert_iterator` // that is placed past-the-end of the resulting sequence of coordinate values. - inline boost::optional > > operator()( + inline std::optional > > operator()( const Point_2 &query_point, std::vector &output_vector) { output_vector.reserve(output_vector.size() + 2); @@ -327,7 +327,7 @@ namespace Barycentric_coordinates { // Compute segment coordinates. template - boost::optional segment_coordinates_2( + std::optional segment_coordinates_2( const Point_2 &query_point, OutputIterator &output) { // Project point on the segment and compute the first coordinate. @@ -341,7 +341,7 @@ namespace Barycentric_coordinates { ++output; // Output both coordinates. - return boost::optional(output); + return std::optional(output); } }; diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h index 33dd658db9a..bc681d3bf38 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h @@ -257,7 +257,7 @@ namespace Barycentric_coordinates { /// Computes triangle barycentric coordinates for a chosen query point with respect to all three vertices of the triangle. /// Computed coordinates are stored in the output iterator `output`. template - inline boost::optional operator()( + inline std::optional operator()( const Point_2 &query_point, OutputIterator output) { return triangle_coordinates_2(query_point, output); @@ -298,7 +298,7 @@ namespace Barycentric_coordinates { // This function accepts a container of the type `std::vector` // and returns an iterator of the type `std::back_insert_iterator` // that is placed past-the-end of the resulting sequence of coordinate values. - inline boost::optional > > operator()( + inline std::optional > > operator()( const Point_2 &query_point, std::vector &output_vector) { output_vector.reserve(output_vector.size() + 3); @@ -347,7 +347,7 @@ namespace Barycentric_coordinates { // Compute triangle coordinates. template - boost::optional triangle_coordinates_2( + std::optional triangle_coordinates_2( const Point_2 &query_point, OutputIterator &output) { // Compute some related sub-areas. @@ -372,7 +372,7 @@ namespace Barycentric_coordinates { ++output; // Output all coordinates. - return boost::optional(output); + return std::optional(output); } }; diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_dh_deprecated_api.cpp b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_dh_deprecated_api.cpp index c19f597f43f..5a0da9d0165 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_dh_deprecated_api.cpp +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_dh_deprecated_api.cpp @@ -19,7 +19,7 @@ typedef CGAL::Barycentric_coordinates::Triangle_coordinates_2 Triangle_c typedef CGAL::Barycentric_coordinates::Discrete_harmonic_2 Discrete_harmonic; typedef CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2 Discrete_harmonic_coordinates; -typedef boost::optional Output_type; +typedef std::optional Output_type; using std::cout; using std::endl; using std::string; @@ -50,8 +50,8 @@ int main() for (Scalar y = step; y < limit; y += step) { const Point point(x, y); - const Output_type tri_result = triangle_coordinates(point, tri_coordinates); - const Output_type dh_result = discrete_harmonic_coordinates(point, old_coordinates); + /* const Output_type tri_result = */triangle_coordinates(point, tri_coordinates); + /* const Output_type dh_result = */discrete_harmonic_coordinates(point, old_coordinates); CGAL::Barycentric_coordinates::discrete_harmonic_coordinates_2( vertices, point, std::back_inserter(new_coordinates)); diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_mv_deprecated_api.cpp b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_mv_deprecated_api.cpp index 25436a0bd6e..50cbb51b97b 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_mv_deprecated_api.cpp +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_mv_deprecated_api.cpp @@ -19,7 +19,7 @@ typedef CGAL::Barycentric_coordinates::Triangle_coordinates_2 Triangle_c typedef CGAL::Barycentric_coordinates::Mean_value_2 Mean_value; typedef CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2 Mean_value_coordinates; -typedef boost::optional Output_type; +typedef std::optional Output_type; using std::cout; using std::endl; using std::string; @@ -53,8 +53,8 @@ int main() for (Scalar y = step; y < limit; y += step) { const Point point(x, y); - const Output_type tri_result = triangle_coordinates(point, tri_coordinates); - const Output_type mv_result = mean_value_coordinates(point, old_coordinates); + /* const Output_type tri_result = */triangle_coordinates(point, tri_coordinates); + /* const Output_type mv_result = */mean_value_coordinates(point, old_coordinates); CGAL::Barycentric_coordinates::mean_value_coordinates_2( vertices, point, std::back_inserter(new_coordinates)); diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_sc_deprecated_api.cpp b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_sc_deprecated_api.cpp index d0b363c7a7e..90ec3474739 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_sc_deprecated_api.cpp +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_sc_deprecated_api.cpp @@ -12,7 +12,7 @@ typedef std::back_insert_iterator Vector_insert_iterator; typedef CGAL::Barycentric_coordinates::Segment_coordinates_2 Segment_coordinates; -typedef boost::optional Output_type; +typedef std::optional Output_type; using std::cout; using std::endl; using std::string; @@ -44,7 +44,7 @@ int main() int count = 0; for (int i = 0; i < 6; ++i) { - const Output_type result = segment_coordinates(query_points[i], std::back_inserter(old_coordinates)); + segment_coordinates(query_points[i], std::back_inserter(old_coordinates)); CGAL::Barycentric_coordinates::segment_coordinates_2( first_vertex, second_vertex, query_points[i], std::back_inserter(new_coordinates)); diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_tc_deprecated_api.cpp b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_tc_deprecated_api.cpp index e37784a8adb..58506a5cec0 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_tc_deprecated_api.cpp +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_tc_deprecated_api.cpp @@ -12,7 +12,7 @@ typedef std::back_insert_iterator Vector_insert_iterator; typedef CGAL::Barycentric_coordinates::Triangle_coordinates_2 Triangle_coordinates; -typedef boost::optional Output_type; +typedef std::optional Output_type; using std::cout; using std::endl; using std::string; @@ -43,7 +43,7 @@ int main() int count = 0; for (int i = 0; i < 5; ++i) { - const Output_type result = triangle_coordinates(query_points[i], std::back_inserter(old_coordinates)); + triangle_coordinates(query_points[i], std::back_inserter(old_coordinates)); CGAL::Barycentric_coordinates::triangle_coordinates_2( first_vertex, second_vertex, third_vertex, query_points[i], std::back_inserter(new_coordinates)); diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_wp_deprecated_api.cpp b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_wp_deprecated_api.cpp index a44bdb5391d..eb4c47ec2b5 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_wp_deprecated_api.cpp +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/test_wp_deprecated_api.cpp @@ -19,7 +19,7 @@ typedef CGAL::Barycentric_coordinates::Triangle_coordinates_2 Triangle_c typedef CGAL::Barycentric_coordinates::Wachspress_2 Wachspress; typedef CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2 Wachspress_coordinates; -typedef boost::optional Output_type; +typedef std::optional Output_type; using std::cout; using std::endl; using std::string; @@ -51,8 +51,8 @@ int main() for (Scalar y = step; y < limit; y += step) { const Point point(x, y); - const Output_type tri_result = triangle_coordinates(point, tri_coordinates); - const Output_type wp_result = wachspress_coordinates(point, old_coordinates); + /* const Output_type tri_result = */triangle_coordinates(point, tri_coordinates); + /* const Output_type wp_result = */wachspress_coordinates(point, old_coordinates); CGAL::Barycentric_coordinates::wachspress_coordinates_2( vertices, point, std::back_inserter(new_coordinates)); diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h index 0d90fbacb2f..0ceae84b195 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h @@ -18,7 +18,7 @@ public: /*! computes the intersections of `xc1` and `xc2` and inserts them in an * ascending lexicographic \f$ xy\f$-order into a range beginning at - * `oi`. The type `OutputIterator` dereferences a `boost::variant` of either the + * `oi`. The type `OutputIterator` dereferences a `std::variant` of either the * type `pair` or the type * `ArrDirectionalTraits::X_monotone_curve_2`. An object of the former type diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp index 853340f86d2..d99e287d40b 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp @@ -3,6 +3,7 @@ */ #include +#include #ifndef CGAL_USE_CORE #include @@ -108,22 +109,13 @@ bool read_bezier(char const* aFileName, Bezier_polygon_set& rSet) for (unsigned int k = 0; k < n_curves; ++k) { // Read the current curve and subdivide it into x-monotone subcurves. - std::list x_objs; - std::list::const_iterator xoit; - Bezier_X_monotone_curve xcv; Bezier_traits traits; Bezier_traits::Make_x_monotone_2 make_x_monotone = traits.make_x_monotone_2_object(); Bezier_curve B = read_bezier_curve(in_file, lDoubleFormat); if (B.number_of_control_points() >= 2) { - - make_x_monotone(B, std::back_inserter(x_objs)); - - for (xoit = x_objs.begin(); xoit != x_objs.end(); ++xoit) { - if (CGAL::assign(xcv, *xoit)) - xcvs.push_back(xcv); - } + make_x_monotone(B, CGAL::dispatch_or_drop_output(std::back_inserter(xcvs))); } } diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp index 7cf3ec3dc7b..02bf08f58ca 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -24,22 +25,15 @@ typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; // Construct a polygon from a circle. Polygon_2 construct_polygon (const Circle_2& circle) { - // Subdivide the circle into two x-monotone arcs. + // Subdivide the circle into two x-monotone arcs and construct the polygon. Traits_2 traits; Curve_2 curve (circle); - std::list objects; - traits.make_x_monotone_2_object() (curve, std::back_inserter(objects)); - assert(objects.size() == 2); - - // Construct the polygon. Polygon_2 pgn; - X_monotone_curve_2 arc; - std::list::iterator iter; - for (iter = objects.begin(); iter != objects.end(); ++iter) { - CGAL::assign (arc, *iter); - pgn.push_back (arc); - } + traits.make_x_monotone_2_object() (curve, + CGAL::dispatch_or_drop_output(std::back_inserter(pgn))); + std::cout << "size: " << pgn.size() << "\n"; + assert(pgn.size() == 2); return pgn; } diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp index a35c90e29c6..f215b1a5267 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp @@ -3,6 +3,7 @@ */ #include +#include #ifndef CGAL_USE_CORE #include @@ -42,14 +43,8 @@ typedef Traits_2::Point_2 Point_2; // sub-arcs and append these sub-arcs as polygon edges. void append_conic_arc(Polygon_2& polygon, const Curve_2& arc) { Conic_traits_2 traits; - std::list objects; - X_monotone_curve_2 xarc; - - traits.make_x_monotone_2_object() (arc, std::back_inserter(objects)); - for (auto it = objects.begin(); it != objects.end(); ++it) { - if (CGAL::assign (xarc, *it)) - polygon.push_back (xarc); - } + traits.make_x_monotone_2_object() (arc, + CGAL::dispatch_or_drop_output(std::back_inserter(polygon))); } int main() { diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp index cecacc9a107..8ff0ced217f 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp @@ -25,22 +25,14 @@ typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; // Construct a polygon from a circle. Polygon_2 construct_polygon (const Circle_2& circle) { - // Subdivide the circle into two x-monotone arcs. + // Subdivide the circle into two x-monotone arcs and construct the polygon Traits_2 traits; Curve_2 curve (circle); - std::list objects; - traits.make_x_monotone_2_object() (curve, std::back_inserter(objects)); - assert(objects.size() == 2); - - // Construct the polygon. Polygon_2 pgn; - X_monotone_curve_2 arc; - std::list::iterator iter; - for (iter = objects.begin(); iter != objects.end(); ++iter) { - CGAL::assign (arc, *iter); - pgn.push_back (arc); - } + traits.make_x_monotone_2_object() (curve, + CGAL::dispatch_or_drop_output(std::back_inserter(pgn))); + assert(pgn.size() == 2); return pgn; } diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h index 8a0744933e3..e4d6936e78f 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h @@ -160,11 +160,8 @@ public: typedef const std::pair Intersection_base_point; - typedef boost::variant + typedef std::variant Intersection_base_result; - typedef const std::pair Intersection_point; - typedef boost::variant - Intersection_result; const auto* base_traits = m_traits.m_base_traits; auto base_cmp_xy = base_traits->compare_xy_2_object(); @@ -183,16 +180,16 @@ public: // the extenede X_monotone_curve_2 for (const auto& xection : xections) { const Intersection_base_point* base_pt = - boost::get(&xection); + std::get_if(&xection); if (base_pt != nullptr) { Point_2 point_plus(base_pt->first); // the extended point *oi++ = - Intersection_result(std::make_pair(point_plus, base_pt->second)); + std::make_pair(point_plus, base_pt->second); continue; } const Base_x_monotone_curve_2* overlap_cv = - boost::get(&xection); + std::get_if(&xection); CGAL_assertion(overlap_cv != nullptr); unsigned int ov_bc; unsigned int ov_twin_bc; @@ -214,7 +211,7 @@ public: Curve_data cv_data(cv1.data().arr(), Halfedge_handle(), ov_bc, ov_twin_bc); - *oi++ = Intersection_result(X_monotone_curve_2(*overlap_cv, cv_data)); + *oi++ = X_monotone_curve_2(*overlap_cv, cv_data); } return oi; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h index fdc111751de..24b69369a43 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h @@ -133,11 +133,8 @@ public: { typedef const std::pair Intersection_base_point; - typedef boost::variant + typedef std::variant Intersection_base_result; - typedef const std::pair Intersection_point; - typedef boost::variant - Intersection_result; const auto* base_traits = m_traits.m_base_traits; auto base_cmp_xy = base_traits->compare_xy_2_object(); @@ -170,17 +167,17 @@ public: // the extenede X_monotone_curve_2 for (const auto& xection : xections) { const Intersection_base_point* base_pt = - boost::get(&xection); + std::get_if(&xection); if (base_pt != nullptr) { Point_data pt_data(m_traits.invalid_index()); Point_2 point_plus(base_pt->first, pt_data); // the extended point *oi++ = - Intersection_result(std::make_pair(point_plus, base_pt->second)); + std::make_pair(point_plus, base_pt->second); continue; } const Base_x_monotone_curve_2* overlap_cv = - boost::get(&xection); + std::get_if(&xection); CGAL_assertion(overlap_cv != nullptr); unsigned int ov_bc; @@ -202,7 +199,7 @@ public: } Curve_data cv_data(ov_bc, ov_twin_bc, m_traits.invalid_index()); - *oi++ = Intersection_result(X_monotone_curve_2(*overlap_cv, cv_data)); + *oi++ = X_monotone_curve_2(*overlap_cv, cv_data); } return oi; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h index d9d6f19c1c9..cf1574c6ace 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h @@ -387,7 +387,7 @@ public: } }; - /*! Get a Equal_2 functor object. */ + /*! Get an `Equal_2` functor object. */ Equal_2 equal_2_object() const { return Equal_2(m_base_traits->equal_2_object()); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Polygon_conversions.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Polygon_conversions.h index f974c628e31..0f880d66ad2 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Polygon_conversions.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Polygon_conversions.h @@ -92,7 +92,7 @@ convert_polygon(const Polygon_2& polygon, if (polygon.is_empty()) return General_polygon_2(); using Point = typename ArrTraits::Point_2; using X_monotone_curve = typename ArrTraits::X_monotone_curve_2; - using Make_x_monotone_result = boost::variant; + using Make_x_monotone_result = std::variant; auto cv = ctr(boost::range::join(CGAL::make_range(polygon.vertices_begin(), polygon.vertices_end()), CGAL::make_single(*polygon.vertices_begin()))); @@ -101,7 +101,7 @@ convert_polygon(const Polygon_2& polygon, make_x_mtn(cv, boost::make_function_output_iterator ([&](const Make_x_monotone_result& obj) - { gpgn.push_back(*(boost::get(&obj))); })); + { gpgn.push_back(*(std::get_if(&obj))); })); return gpgn; } diff --git a/Boolean_set_operations_2/include/CGAL/General_polygon_2.h b/Boolean_set_operations_2/include/CGAL/General_polygon_2.h index 93469d5e93b..f43a41e2709 100644 --- a/Boolean_set_operations_2/include/CGAL/General_polygon_2.h +++ b/Boolean_set_operations_2/include/CGAL/General_polygon_2.h @@ -38,6 +38,7 @@ public: typedef std::list Containter; typedef typename Containter::iterator Curve_iterator; typedef typename Containter::const_iterator Curve_const_iterator; + typedef X_monotone_curve_2 value_type; protected: std::list m_xcurves; diff --git a/Boolean_set_operations_2/include/CGAL/IO/Dxf_bsop_reader.h b/Boolean_set_operations_2/include/CGAL/IO/Dxf_bsop_reader.h index 1645afc1354..986ba9e86e1 100644 --- a/Boolean_set_operations_2/include/CGAL/IO/Dxf_bsop_reader.h +++ b/Boolean_set_operations_2/include/CGAL/IO/Dxf_bsop_reader.h @@ -25,6 +25,7 @@ #include #include #include +#include namespace CGAL { @@ -97,29 +98,19 @@ public: typename Traits_2::Make_x_monotone_2 make_x_monotone = traits.make_x_monotone_2_object(); typename Dxf_circles_list::iterator circ_it; - CGAL::Object obj_vec[3]; - CGAL::Object *obj_begin = (obj_vec + 0); - CGAL::Object *obj_end; - X_monotone_curve_2 cv1, cv2; for (circ_it = circles.begin(); circ_it != circles.end(); ++circ_it) { // Break the circle into two x-monotone circular arcs. const Dxf_circle_2& dxf_circ = *circ_it; Curve_2 circ (dxf_circ.first, dxf_circ.second); - - obj_end = make_x_monotone (circ, obj_begin); - CGAL_assertion(obj_end - obj_begin == 2); - - CGAL::assign(cv1, obj_vec[0]); - CGAL::assign(cv2, obj_vec[1]); - - // Generate the corresponding polygon. Circ_polygon_2 pgn; - pgn.push_back (cv1); - pgn.push_back (cv2); - *pgns = pgn; - ++pgns; + + make_x_monotone (circ, + CGAL::dispatch_or_drop_output(std::back_inserter(pgn))); + CGAL_assertion(pgn.size() == 2); + + *pgns++ = pgn; } circles.clear(); @@ -131,8 +122,6 @@ public: typename Dxf_polygon_2::iterator curr, next; Point_2 ps, pt; Circle_2 supp_circ; - std::size_t n_subarcs; - std::size_t i; for (pgn_it = polygons.begin(); pgn_it != polygons.end(); ++pgn_it) { @@ -184,15 +173,8 @@ public: // Break the arc into x-monotone subarcs (there can be at most // three subarcs) and add them to the polygon. - obj_end = make_x_monotone (circ_arc, obj_begin); - n_subarcs = (obj_end - obj_begin); - CGAL_assertion (n_subarcs <= 3); - - for (i = 0; i < n_subarcs; i++) - { - if (CGAL::assign (cv1, obj_vec[i])) - pgn.push_back (cv1); - } + make_x_monotone (circ_arc, + CGAL::dispatch_or_drop_output(std::back_inserter(pgn))); } else { diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp index be2fb2d3e5b..81add300c23 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp @@ -66,11 +66,11 @@ int main() { ctr(boost::range::join(CGAL::make_range(points.begin(), points.end()), CGAL::make_single(*points.begin()))); General_pgn gpgn2; - using Make_x_monotone_result = boost::variant; + using Make_x_monotone_result = std::variant; make_x_mtn(curve2, boost::make_function_output_iterator ([&](const Make_x_monotone_result& obj) - { gpgn2.push_back(*(boost::get(&obj))); })); + { gpgn2.push_back(*(std::get_if(&obj))); })); std::cout << "gpgn2: " << gpgn2 << std::endl; // Case 3: Polyline-based GPS from polyline of segments @@ -81,7 +81,7 @@ int main() { make_x_mtn(curve3, boost::make_function_output_iterator ([&](const Make_x_monotone_result& obj) - { gpgn3.push_back(*(boost::get(&obj))); })); + { gpgn3.push_back(*(std::get_if(&obj))); })); std::cout << "gpgn3: " << gpgn3 << std::endl; if (! eql(gpgn2, gpgn3)) { diff --git a/CGAL_ImageIO/include/CGAL/SEP_header.h b/CGAL_ImageIO/include/CGAL/SEP_header.h index 9bf345d4c6e..6a6bf2ff44d 100644 --- a/CGAL_ImageIO/include/CGAL/SEP_header.h +++ b/CGAL_ImageIO/include/CGAL/SEP_header.h @@ -56,12 +56,12 @@ public: { using boost::get; visitor vis(this, get<0>(tuple)); - boost::apply_visitor(vis, get<1>(tuple)); + std::visit(vis, get<1>(tuple)); return *this; } private: - struct visitor : public boost::static_visitor<> { + struct visitor { SEP_header_aux* self; std::string key; visitor(SEP_header_aux* header, std::string key) @@ -261,7 +261,7 @@ private: #endif // CGAL_SEP_READER_DEBUG } // end constructor of sep_header_grammar - typedef boost::variant value; typedef boost::tuple entry_type; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/hyperbolic.cpp b/CGAL_ipelets/demo/CGAL_ipelets/hyperbolic.cpp index e0725a743e9..795375437fa 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/hyperbolic.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/hyperbolic.cpp @@ -209,16 +209,14 @@ void hyperbolicIpelet::protected_run(int fn) } // clip circ by poincare - std::vector< CGAL::Object > result; Kernel::Circular_arc_point_2 L,R; - std::pair the_pair; + typedef std::pair The_pair; + std::vector result; - CGAL::intersection(circ, poincare, std::back_inserter(result)); + CGAL::intersection(circ, poincare, CGAL::dispatch_or_drop_output(std::back_inserter(result))); assert (result.size()==2); - assign(the_pair, result[0]); - L = the_pair.first; - assign(the_pair, result[1]); - R = the_pair.first; + L = result[0].first; + R = result[1].first; Point_2 LL(CGAL::to_double(L.x()),CGAL::to_double(L.y())); Point_2 RR(CGAL::to_double(R.x()),CGAL::to_double(R.y())); assert( LL.x() <= RR.x()); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp index 7d2026c5981..71557e65968 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp @@ -11,7 +11,6 @@ // Author(s) : Sebastien Loriot, Sylvain Pion #include -#include #include #include #include @@ -38,10 +37,10 @@ const std::string Hmsg[] = { class SkeletonIpelet : public CGAL::Ipelet_base{ - typedef boost::shared_ptr PolygonPtr ; + typedef std::shared_ptr PolygonPtr ; typedef std::vector PolygonPtrVector ; typedef CGAL::Straight_skeleton_2 Skeleton ; - typedef boost::shared_ptr SkeletonPtr ; + typedef std::shared_ptr SkeletonPtr ; void draw_straight_skeleton(const Skeleton& skeleton,double); diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h index 276e5d5c651..5373b0a3445 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h @@ -822,41 +822,34 @@ public: CGAL::Cartesian_converter conv; Exact_circle_2 exact_circle=conv(approx_circle); + typedef std::pair Cp2_mult; SK::Intersect_2 inter=SK().intersect_2_object(); - std::vector< std::pair > points; + std::vector< Cp2_mult > points; points.reserve(8); - std::vector ints; + std::vector< Cp2_mult > ints; ints.reserve(2); - std::pair tmp_pt; int indices[8]={-1,-1,-1,-1,-1,-1,-1,-1}; for (unsigned i=0;i!=4;++i){ ints.clear(); SK::Segment_2 S(conv(bbox[i]),conv(bbox[(i+1)%4])); - inter(exact_circle,SK::Line_arc_2(S),std::back_inserter(ints)); + inter(exact_circle,SK::Line_arc_2(S),dispatch_or_drop_output(std::back_inserter(ints))); unsigned index=0; - bool ok=true; switch (ints.size()){ case 1: - ok=CGAL::assign(tmp_pt,ints[0]); - CGAL_assertion(ok); CGAL_USE(ok); - points.push_back(tmp_pt); + points.push_back(ints[0]); index=points.size()-1; indices[i]=index; indices[(i+1)%4+4]=index; break; case 2: int right_ind=i<2?0:1; - ok=CGAL::assign(tmp_pt,ints[right_ind]); - CGAL_assertion(ok); CGAL_USE(ok); - points.push_back(tmp_pt); + points.push_back(ints[right_ind]); index=points.size()-1; indices[i]=index; - ok=CGAL::assign(tmp_pt,ints[(right_ind+1)%2]); - CGAL_assertion(ok); CGAL_USE(ok); - points.push_back(tmp_pt); + points.push_back(ints[(right_ind+1)%2]); index=points.size()-1; indices[(i+1)%4+4]=index; break; diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index cde883c91c0..26071f43ca2 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -56,7 +56,7 @@ struct Default_converter { // Out will be a variant, source kernel and target kernel template -struct Converting_visitor : boost::static_visitor<> { +struct Converting_visitor{ Converting_visitor(const Converter& conv, Output& out) : conv(&conv), out(&out) {} const Converter* conv; Output* out; @@ -145,13 +145,13 @@ public: // from the sequence, transform with the type mapper and throw the // new list into a variant // visit to get the type, and copy construct inside the return type - template + template typename - Type_mapper< boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >, + Type_mapper< std::optional< std::variant< U ... > >, K1, K2 >::type - operator()(const boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const { + operator()(const std::optional< std::variant< U ... > >& o) const { typedef typename - Type_mapper< boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >, + Type_mapper< std::optional< std::variant< U ... > >, K1, K2 >::type result_type; result_type res; if(!o) { @@ -161,22 +161,22 @@ public: internal::Converting_visitor conv_visitor = internal::Converting_visitor(*this, res); - boost::apply_visitor(conv_visitor, *o); + std::visit(conv_visitor, *o); return res; } - template + template typename - Type_mapper< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) >, + Type_mapper< std::variant< U ... >, K1, K2 >::type - operator()(const boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > & o) const { + operator()(const std::variant< U ... > & o) const { typedef typename - Type_mapper< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) >, + Type_mapper< std::variant< U ... >, K1, K2 >::type result_type; result_type res; internal::Converting_visitor conv_visitor = internal::Converting_visitor(*this, res); - boost::apply_visitor(conv_visitor, o); + std::visit(conv_visitor, o); return res; } diff --git a/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmark.h b/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmark.h index 6c37f7e6907..78b235c2937 100644 --- a/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmark.h +++ b/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmark.h @@ -11,7 +11,7 @@ #include #include #include "Input_data.h" -#include +#include diff --git a/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmarks_arrangement.cpp b/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmarks_arrangement.cpp index 674e5a0ea53..a0958077ead 100644 --- a/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmarks_arrangement.cpp +++ b/Circular_kernel_2/benchmark/DxfArrayBenchmarks/benchmarks_arrangement.cpp @@ -72,7 +72,7 @@ for(i=1;i<6;i++){ typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CGAL::Variant_traits CircularK_Variant_Traits; - typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; + typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; bench.kernel("CK VarTraits"); @@ -93,7 +93,7 @@ for(i=1;i<6;i++){ typedef BBCircularKernel::Circular_arc_2 Circular_arc_6; typedef BBCircularKernel::Line_arc_2 Line_arc_6; - typedef boost::variant BBCircVarArc; + typedef std::variant BBCircVarArc; typedef std::vector BBCircVarContainer; typedef CGAL::Variant_traits BBCircVariantTraits; diff --git a/Circular_kernel_2/benchmark/arrangement_traits/benchmark.h b/Circular_kernel_2/benchmark/arrangement_traits/benchmark.h index 179ea2b2f82..216e670bfc7 100644 --- a/Circular_kernel_2/benchmark/arrangement_traits/benchmark.h +++ b/Circular_kernel_2/benchmark/arrangement_traits/benchmark.h @@ -11,7 +11,7 @@ #include #include #include "Input_data.h" -#include +#include class Bench { diff --git a/Circular_kernel_2/benchmark/arrangement_traits/benchmarks_arrangement.cpp b/Circular_kernel_2/benchmark/arrangement_traits/benchmarks_arrangement.cpp index 5ebf26838bc..056ae74e392 100644 --- a/Circular_kernel_2/benchmark/arrangement_traits/benchmarks_arrangement.cpp +++ b/Circular_kernel_2/benchmark/arrangement_traits/benchmarks_arrangement.cpp @@ -166,7 +166,7 @@ Bench bench(Htmlfilename,Texfilename,Dxffilename[i]); typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CGAL::Variant_traits CircularK_Variant_Traits; - typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; + typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; bench.kernel("Circular kernel Variant traits"); diff --git a/Circular_kernel_2/benchmark/benchmark.h b/Circular_kernel_2/benchmark/benchmark.h index 92ba72909ca..e6be22a2a56 100644 --- a/Circular_kernel_2/benchmark/benchmark.h +++ b/Circular_kernel_2/benchmark/benchmark.h @@ -11,7 +11,7 @@ #include #include #include "Input_data.h" -#include +#include #include diff --git a/Circular_kernel_2/benchmark/benchmark_CK2.cpp b/Circular_kernel_2/benchmark/benchmark_CK2.cpp index fca08228340..681cba38d04 100644 --- a/Circular_kernel_2/benchmark/benchmark_CK2.cpp +++ b/Circular_kernel_2/benchmark/benchmark_CK2.cpp @@ -38,7 +38,7 @@ typedef std::vector CircularKArcContainer; typedef CircularKernel::Circular_arc_2 Circular_arc_2; typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CGAL::Arr_circular_line_arc_traits_2 CircularK_Variant_Traits; -typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; +typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; @@ -55,7 +55,7 @@ typedef BBCircularKernel::Circular_arc_2 Circular_arc_6; typedef BBCircularKernel::Line_arc_2 Line_arc_6; -typedef boost::variant +typedef std::variant BBCircVarArc; typedef std::vector BBCircVarContainer; diff --git a/Circular_kernel_2/benchmark/benchmarks_arrangement.cpp b/Circular_kernel_2/benchmark/benchmarks_arrangement.cpp index 3b548a20e2a..59867dbd1e3 100644 --- a/Circular_kernel_2/benchmark/benchmarks_arrangement.cpp +++ b/Circular_kernel_2/benchmark/benchmarks_arrangement.cpp @@ -163,7 +163,7 @@ Bench bench; //If you want create table with all datasets typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CGAL::Arr_circular_line_arc_traits_2 CircularK_Variant_Traits; - typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; + typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; bench.kernel("CKVar"); @@ -197,7 +197,7 @@ bench.Compute_no_dxf BBCircVarArc; + typedef std::variant BBCircVarArc; typedef std::vector BBCircVarContainer; typedef CGAL::Arr_circular_line_arc_traits_2 BBCircVariantTraits; diff --git a/Circular_kernel_2/benchmark/bff_reader/Breader.cpp b/Circular_kernel_2/benchmark/bff_reader/Breader.cpp index 3fac248eb68..ac18cceab92 100644 --- a/Circular_kernel_2/benchmark/bff_reader/Breader.cpp +++ b/Circular_kernel_2/benchmark/bff_reader/Breader.cpp @@ -189,7 +189,7 @@ int main( int argc, char* argv[] ) { typedef CK::Circular_arc_2 Circular_arc_2; typedef CK::Line_arc_2 Line_arc_2; typedef CGAL::Variant_traits CircularK_Variant_Traits; - typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; + typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; CircularKVarArcContainer arc; typedef CGAL::Arrangement_2 Pmwx; diff --git a/Circular_kernel_2/benchmark/dxf_to_bff/dxf_converter.h b/Circular_kernel_2/benchmark/dxf_to_bff/dxf_converter.h index b8ad60ea3c1..3b54da14f93 100644 --- a/Circular_kernel_2/benchmark/dxf_to_bff/dxf_converter.h +++ b/Circular_kernel_2/benchmark/dxf_to_bff/dxf_converter.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Circular_kernel_2/benchmark/incremental_insertion/benchmark.h b/Circular_kernel_2/benchmark/incremental_insertion/benchmark.h index 1a251c11978..bb1e534e73b 100644 --- a/Circular_kernel_2/benchmark/incremental_insertion/benchmark.h +++ b/Circular_kernel_2/benchmark/incremental_insertion/benchmark.h @@ -11,7 +11,7 @@ #include #include #include "Input_data.h" -#include +#include class Bench { diff --git a/Circular_kernel_2/benchmark/incremental_insertion/benchmarks_arrangement.cpp b/Circular_kernel_2/benchmark/incremental_insertion/benchmarks_arrangement.cpp index 8895b11f372..c00db5e079a 100644 --- a/Circular_kernel_2/benchmark/incremental_insertion/benchmarks_arrangement.cpp +++ b/Circular_kernel_2/benchmark/incremental_insertion/benchmarks_arrangement.cpp @@ -157,7 +157,7 @@ Bench bench(Htmlfilename,Texfilename,Dxffilename[i],true); typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CGAL::Variant_traits CircularK_Variant_Traits; - typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; + typedef std::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; typedef std::vector CircularKVarArcContainer; bench.kernel("Circular kernel Variant traits"); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h index 674b4ca27b2..34ba0ccc386 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h @@ -19,7 +19,7 @@ #include -#include +#include namespace CGAL { @@ -40,7 +40,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename CK::Circle_2, + std::variant< typename CK::Circle_2, typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -52,7 +52,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename CK::Circular_arc_2, + std::variant< typename CK::Circular_arc_2, typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -64,7 +64,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename CK::Line_arc_2, + std::variant< typename CK::Line_arc_2, typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -76,7 +76,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename std::pair< typename CK::Circular_arc_point_2, + std::variant< typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL > @@ -92,7 +92,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename std::pair< typename CK::Circular_arc_point_2, + std::variant< typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL > @@ -108,7 +108,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename CK::Line_arc_2, + std::variant< typename CK::Line_arc_2, typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -125,7 +125,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename std::pair< typename CK::Circular_arc_point_2, + std::variant< typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL > @@ -155,7 +155,7 @@ template struct CK2_Intersection_traits { typedef typename - boost::variant< typename std::pair< typename CK::Circular_arc_point_2, + std::variant< typename std::pair< typename CK::Circular_arc_point_2, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL > diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 09696e5069c..b68746e4a3d 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -308,7 +308,7 @@ namespace CircularFunctors { operator()(const Circular_arc_2 &A, OutputIterator res) const { typedef std::pair relat_pos; - typedef std::pair< CGAL::Object, relat_pos> Obj_descr_2; + typedef std::pair< Circular_arc_2, relat_pos> Obj_descr_2; std::vector vec; CircularFunctors::advanced_make_xy_monotone (A, std::back_inserter(vec)); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h index 9ced0754a2c..9e799e497f0 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h @@ -120,8 +120,6 @@ namespace CircularFunctors { const typename CK::Circle_2 & c2, OutputIterator res ) { - typedef typename CK2_Intersection_traits - ::type result_type; typedef typename CK::Algebraic_kernel AK; typedef typename CK::Polynomial_for_circles_2_2 Equation; typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; @@ -129,7 +127,7 @@ namespace CircularFunctors { Equation e2 = CircularFunctors::get_equation(c2); if (e1 == e2) { - *res++ = CGAL::internal::ck2_intersection_return(c1); + *res++ = c1; return res; } @@ -145,9 +143,7 @@ namespace CircularFunctors { for ( typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it ) { - *res++ = CGAL::internal::ck2_intersection_return - (std::make_pair(Circular_arc_point_2(it->first), - it->second )); + *res++ = std::make_pair(Circular_arc_point_2(it->first), it->second ); } return res; diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h index 61fdc75b4b6..1e577eea5b3 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h @@ -536,17 +536,15 @@ namespace CircularFunctors { const typename CK::Circular_arc_2 &a2, OutputIterator res ) { - typedef typename CK2_Intersection_traits::type result_type; - - typedef std::vector solutions_container; typedef typename CK::Circular_arc_2 Circular_arc_2; + typedef typename CK::Circle_2 Circle_2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE + typedef std::vector solutions_container; // same curve if(a1.number() == a2.number()) { - *res++ = result_type(a1); + *res++ = a1; return res; } @@ -571,14 +569,14 @@ namespace CircularFunctors { if((a1s_a2s && a1t_a2t) || (a1s_a2t && a1t_a2s)){ // Case 1 if( (a1.supporting_circle() == a2.supporting_circle()) && ((a1.on_upper_part() && a2.on_upper_part())|| (! a1.on_upper_part() && (! a2.on_upper_part())))){ - *res++ = result_type(a1); + *res++ = a1; } else { if(compare_x(a1.source(), a1.target()) == SMALLER){ - *res++ = result_type(std::make_pair(a1.source(),1u)); - *res++ = result_type(std::make_pair(a1.target(),1u)); + *res++ = std::make_pair(a1.source(),1u); + *res++ = std::make_pair(a1.target(),1u); } else { - *res++ = result_type(std::make_pair(a1.target(),1u)); - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.target(),1u); + *res++ = std::make_pair(a1.source(),1u); } } return res; @@ -625,7 +623,7 @@ namespace CircularFunctors { if(return_q){ - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } @@ -634,16 +632,14 @@ namespace CircularFunctors { const bool sqr1_eq_sqr2 = (a1.squared_radius() == a2.squared_radius()); const bool c1_eq_c2 = (a1.center() == a2.center()); - typedef typename CK2_Intersection_traits::type result_type; if(sqr1_eq_sqr2 && c1_eq_c2) { if(a1.is_full()) { - *res++ =CGAL::internal::ck2_intersection_return(a2); + *res++ = a2; //return res; } else if(a2.is_full()) { - *res++ =CGAL::internal::ck2_intersection_return(a1); + *res++ = a1; //return res; } else { bool t2_in_a1 = has_on(a1,a2.target(),true); @@ -656,66 +652,66 @@ namespace CircularFunctors { CircularFunctors::compare_xy(a1.source(), a2.source()); if(comp < 0) { if(a1.source() == a2.target()) { - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } if(a2.source() == a1.target()) { - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } } else if (comp > 0) { if(a2.source() == a1.target()) { - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } if(a1.source() == a2.target()) { - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } } else { - *res++ =CGAL::internal::ck2_intersection_return(a1); + *res++ = a1; } } else { - *res++ =CGAL::internal::ck2_intersection_return(a2); + *res++ = a2; //return res; } } else if(t2_in_a1) { if(a1.source() == a2.target()) - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } //return res; } else if(s2_in_a1) { if(a2.source() == a1.target()) { - *res++ =CGAL::internal::ck2_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ =CGAL::internal::ck2_intersection_return(arc); + *res++ = arc; } //return res; } else if(has_on(a2,a1.source(),true)) { - *res++ =CGAL::internal::ck2_intersection_return(a1); + *res++ = a1; //return res; } //return res; } } else if(!c1_eq_c2) { - solutions_container solutions; + std::vector< std::variant> > solutions; #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES if(!Circular_arc_2::template @@ -736,24 +732,23 @@ namespace CircularFunctors { if(solutions.size() == 0) return res; else { // The supporting circles are not the same and intersects - for (typename solutions_container::iterator it = solutions.begin(); - it != solutions.end(); ++it) { + for (const auto& v : solutions) { const std::pair - *result = CGAL::object_cast - > (&(*it)); + *result = std::get_if + > (&v); #ifdef CGAL_CK_TEST_BBOX_BEFORE_HAS_ON Bbox_2 rb = result->first.bbox(); if(do_overlap(a1.bbox(), rb) && do_overlap(a2.bbox(),rb)){ if (has_on(a1,result->first,true) && has_on(a2,result->first,true)) { - *res++ =CGAL::internal::ck2_intersection_return(*result); + *res++ = *result; } } #else if (has_on(a1,result->first,true) && has_on(a2,result->first,true)) { - *res++ =CGAL::internal::ck2_intersection_return(*result); + *res++ = *result; } #endif } @@ -1069,7 +1064,7 @@ template < class CK, class OutputIterator > A.circle_number(); #endif - *res++ = make_object(A); + *res++ = A; return res; } @@ -1101,8 +1096,8 @@ template < class CK, class OutputIterator > ca2.set_circle_number(cn); #endif - *res++ = make_object(ca1); - *res++ = make_object(ca2); + *res++ = ca1; + *res++ = ca2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point1,1u))); @@ -1131,7 +1126,7 @@ template < class CK, class OutputIterator > unsigned int cn = ca1.circle_number(); #endif - *res++ = make_object(ca1); + *res++ = ca1; if (cmp_end > 0) { // We must cut in 3 parts. const Circular_arc_2 &ca2 = Circular_arc_2(A.supporting_circle(), @@ -1148,8 +1143,8 @@ template < class CK, class OutputIterator > ca3.set_circle_number(cn); #endif - *res++ = make_object(ca2); - *res++ = make_object(ca3); + *res++ = ca2; + *res++ = ca3; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point1,1u))); intersecs2.push_back(make_object(std::make_pair(x_extremal_point2,1u))); @@ -1171,7 +1166,7 @@ template < class CK, class OutputIterator > ca2.set_circle_number(cn); #endif - *res++ = make_object(ca2); + *res++ = ca2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point1,1u))); @@ -1191,7 +1186,7 @@ template < class CK, class OutputIterator > unsigned int cn = ca1.circle_number(); #endif - *res++ = make_object(ca1); + *res++ = ca1; if (cmp_end < 0) { const Circular_arc_2 &ca2 = Circular_arc_2(A.supporting_circle(), x_extremal_point2, @@ -1207,8 +1202,8 @@ template < class CK, class OutputIterator > ca3.set_circle_number(cn); #endif - *res++ = make_object(ca2); - *res++ = make_object(ca3); + *res++ = ca2; + *res++ = ca3; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point2,1u))); @@ -1232,7 +1227,7 @@ template < class CK, class OutputIterator > ca2.set_circle_number(cn); #endif - *res++ = make_object(ca2); + *res++ = ca2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point2,1u))); @@ -1259,8 +1254,8 @@ template < class CK, class OutputIterator > ca2.set_circle_number(cn); #endif - *res++ = make_object(ca1); - *res++ = make_object(ca2); + *res++ = ca1; + *res++ = ca2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point2,1u))); @@ -1287,8 +1282,8 @@ template < class CK, class OutputIterator > ca2.set_circle_number(cn); #endif - *res++ = make_object(ca1); - *res++ = make_object(ca2); + *res++ = ca1; + *res++ = ca2; #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE intersecs1.push_back(make_object(std::make_pair(x_extremal_point1,1u))); @@ -1317,7 +1312,7 @@ template < class CK, class OutputIterator > OutputIterator res ) { typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef std::pair S_pair; + typedef std::pair S_pair; int cmp_begin_y = CGAL::compare @@ -1332,13 +1327,13 @@ template < class CK, class OutputIterator > ((((cmp_begin_y > 0) || (cmp_end_y > 0)) && (cmp_x > 0)) || (((cmp_begin_y < 0) || (cmp_end_y < 0)) && (cmp_x < 0)))) { - *res++ = S_pair(make_object(A),(cmp_begin_y>0 || cmp_end_y>0) ); + *res++ = S_pair(A,(cmp_begin_y>0 || cmp_end_y>0) ); return res; } // Half circles if (cmp_begin_y == 0 && cmp_end_y == 0 && cmp_x != 0) { - *res++ = std::make_pair(make_object(A), cmp_x>0 ); + *res++ = std::make_pair(A, cmp_x>0 ); return res; } @@ -1347,67 +1342,67 @@ template < class CK, class OutputIterator > if (cmp_begin_y > 0) { *res++ = S_pair - (make_object(Circular_arc_2(A.supporting_circle(), A.source(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true))), + (Circular_arc_2(A.supporting_circle(), A.source(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true)), true); if (cmp_end_y > 0) { // We must cut in 3 parts. *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false))), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false)), false); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false), + A.target()), true); } else { *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true), + A.target()), false); } } else if (cmp_begin_y < 0) { // Very similar to the previous case. *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - A.source(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false))), + (Circular_arc_2 (A.supporting_circle(), + A.source(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false)), false); if (cmp_end_y < CGAL::EQUAL) { // We must cut in 3 parts. *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true))) , + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true)) , true ); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true), + A.target()), false); } else { *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false), + A.target()), true); } } @@ -1415,34 +1410,34 @@ template < class CK, class OutputIterator > if ( compare(A.source().x(),A.supporting_circle().center().x())< 0) { CGAL_assertion(cmp_end_y >= 0); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - A.source(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false))), + (Circular_arc_2 (A.supporting_circle(), + A.source(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false)), false); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),false), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),false), + A.target()), true); } else { CGAL_assertion( compare(A.source().x(),A.supporting_circle().center().x())< 0); CGAL_assertion(cmp_end_y != LARGER); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - A.source(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true))), + (Circular_arc_2 (A.supporting_circle(), + A.source(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true)), true); *res++ = std::make_pair - (make_object(Circular_arc_2 (A.supporting_circle(), - CircularFunctors::x_extremal_point - (A.supporting_circle(),true), - A.target())), + (Circular_arc_2 (A.supporting_circle(), + CircularFunctors::x_extremal_point + (A.supporting_circle(),true), + A.target()), false); } } @@ -1469,8 +1464,8 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, typedef typename CK::Circular_arc_2 Circular_arc_2; typedef std::pair relat_pos; - typedef std::pair< CGAL::Object, bool> Obj_descr_1; - typedef std::pair< CGAL::Object, relat_pos> Obj_descr_2; + typedef std::pair< Circular_arc_2, bool> Obj_descr_1; + typedef std::pair< Circular_arc_2, relat_pos> Obj_descr_2; typedef std::vector Obj_vector_1; typedef std::vector Obj_vector_2; @@ -1481,8 +1476,7 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, advanced_make_x_monotone(a,std::back_inserter(vec)); for(unsigned int i=0;i(&vec.at(i).first); + const Circular_arc_2 *tmp_arc = (&vec.at(i).first); int cmp_begin_x = CGAL::compare (tmp_arc->source().x(), tmp_arc->supporting_circle().center().x()); @@ -1501,22 +1495,21 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, Obj_descr_1 tmp=vec.at(i); Obj_descr_2 tmp1,tmp2; - const Circular_arc_2 *tmp_arc = - CGAL::object_cast(&tmp.first); + const Circular_arc_2 *tmp_arc = &tmp.first; - tmp1.first = make_object - (Circular_arc_2(a.supporting_circle(),tmp_arc->source(), + tmp1.first = + Circular_arc_2(a.supporting_circle(),tmp_arc->source(), CircularFunctors::y_extremal_point - (a.supporting_circle(),!tmp.second))); + (a.supporting_circle(),!tmp.second)); tmp1.second.first=tmp.second; tmp1.second.second= (tmp.second)? false : true ; - tmp2.first = make_object - (Circular_arc_2(a.supporting_circle(), + tmp2.first = + Circular_arc_2(a.supporting_circle(), CircularFunctors::y_extremal_point (a.supporting_circle(),!tmp.second), - tmp_arc->target())); + tmp_arc->target()); tmp2.second.first=tmp.second; tmp2.second.second= (tmp.second)? true : false ; @@ -1528,7 +1521,6 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, } return res; - } template diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h index baecb215725..6b3d632cbfb 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h @@ -377,8 +377,6 @@ namespace CircularFunctors { const typename CK::Circle_2 & c, OutputIterator res ) { - typedef typename CK2_Intersection_traits - ::type result_type; typedef typename CK::Algebraic_kernel AK; typedef typename CK::Polynomial_1_2 Equation_line; typedef typename CK::Polynomial_for_circles_2_2 Equation_circle; @@ -399,8 +397,7 @@ namespace CircularFunctors { for ( typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it ) { - *res++ = CGAL::internal::ck2_intersection_return - (std::make_pair(Circular_arc_point_2(it->first), it->second )); + *res++ = std::make_pair(Circular_arc_point_2(it->first), it->second ); } return res; @@ -412,8 +409,6 @@ namespace CircularFunctors { const typename CK::Line_arc_2 &a2, OutputIterator res ) { - typedef typename CK2_Intersection_traits - ::type result_type; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Point_2 Point_2; @@ -427,13 +422,13 @@ namespace CircularFunctors { if((a1s_a2s && a1t_a2t) || (a1s_a2t && a1t_a2s)){ - *res++ = result_type(a1); + *res++ = a1; return res; } if(a1s_a2s || a1s_a2t || a1t_a2s || a1t_a2t) { if(! LinearFunctors::non_oriented_equal(a1.supporting_line(),a2.supporting_line())){ - if(a1s_a2s || a1s_a2t) *res++ = CGAL::internal::ck2_intersection_return(std::make_pair(a1.source(), 1u)); - if(a1t_a2s || a1t_a2t) *res++ = CGAL::internal::ck2_intersection_return(std::make_pair(a1.target(), 1u)); + if(a1s_a2s || a1s_a2t) *res++ = std::make_pair(a1.source(), 1u); + if(a1t_a2s || a1t_a2t) *res++ = std::make_pair(a1.target(), 1u); return res; } } @@ -445,16 +440,13 @@ namespace CircularFunctors { int comparison = compare_xy(a2.left(),a1.right()); if(comparison < 0){ if(compare_xy(a1.right(),a2.right()) <= 0){ - *res++ = CGAL::internal::ck2_intersection_return - (Line_arc_2(a1.supporting_line(), a2.left(), a1.right() )); + *res++ = Line_arc_2(a1.supporting_line(), a2.left(), a1.right() ); } else{ - *res++ = CGAL::internal::ck2_intersection_return - (Line_arc_2(a1.supporting_line(), a2.left(), a2.right() )); + *res++ = Line_arc_2(a1.supporting_line(), a2.left(), a2.right() ); } } else if (comparison == 0){ - *res++ =CGAL::internal::ck2_intersection_return - ( std::make_pair(a2.left(),1u)); + *res++ = std::make_pair(a2.left(),1u); } return res; } @@ -462,17 +454,14 @@ namespace CircularFunctors { int comparison = compare_xy(a1.left(),a2.right()); if(comparison < 0){ if(compare_xy(a1.right(),a2.right()) <= 0){ - *res++ = CGAL::internal::ck2_intersection_return - (Line_arc_2(a1.supporting_line(), a1.left(), a1.right() )); + *res++ = Line_arc_2(a1.supporting_line(), a1.left(), a1.right() ); } else{ - *res++ = CGAL::internal::ck2_intersection_return - (Line_arc_2(a1.supporting_line(), a1.left(), a2.right() )); + *res++ = Line_arc_2(a1.supporting_line(), a1.left(), a2.right() ); } } else if (comparison == 0){ - *res++ = CGAL::internal::ck2_intersection_return - ( std::make_pair(a1.left(),1u)); + *res++ = std::make_pair(a1.left(),1u); } return res; } @@ -491,13 +480,13 @@ namespace CircularFunctors { CircularFunctors::compare_xy(intersect_point, a1.target())) && (CircularFunctors::compare_xy(intersect_point, a2.source()) != CircularFunctors::compare_xy(intersect_point, a2.target()))) - *res++ = CGAL::internal::ck2_intersection_return(std::make_pair(intersect_point, 1u)); + *res++ = std::make_pair(intersect_point, 1u); return res; } template - struct Has_on_visitor : public boost::static_visitor { + struct Has_on_visitor { Has_on_visitor(const T* l) : l(l){} const T* l; bool operator()(const std::pair& pair) const { @@ -527,8 +516,8 @@ namespace CircularFunctors { for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it) { - if(boost::apply_visitor(Has_on_visitor(&l), *it)) - *res++ = *it; + if(std::visit(Has_on_visitor(&l), *it)) + *res++ = std::get>(*it); } return res; @@ -565,11 +554,11 @@ namespace CircularFunctors { if((ls_cs && lt_ct) || (ls_ct && lt_cs)){ // Case 0 if (compare_xy(l.source(), l.target()) == SMALLER){ - *res++ = result_type(std::make_pair(l.source(), 1u)); - *res++ = result_type(std::make_pair(l.target(), 1u)); + *res++ = std::make_pair(l.source(), 1u); + *res++ = std::make_pair(l.target(), 1u); } else { - *res++ = result_type(std::make_pair(l.target(), 1u)); - *res++ = result_type(std::make_pair(l.source(), 1u)); + *res++ = std::make_pair(l.target(), 1u); + *res++ = std::make_pair(l.source(), 1u); } return res; } else if (ls_cs || lt_ct || ls_ct || lt_cs) { @@ -594,20 +583,20 @@ namespace CircularFunctors { } if( (CircularFunctors::compare_x(p,q) == EQUAL) || CircularFunctors::point_in_x_range(p,r,q)){ // Case 1 - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } else if(c.on_upper_part()){ // Case 2 if(CircularFunctors::compare_x(r,q) == LARGER){ if(CircularFunctors::orientation(q,r,p) == RIGHT_TURN // Case 2 || CircularFunctors::compare_y_to_right(l,c,q) == LARGER){ // Case 3a - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } } else { if(CircularFunctors::orientation(r,q,p) == RIGHT_TURN // Case 2 || CircularFunctors::compare_y_to_left(l,c,q) == LARGER){ // Case 3c - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } } @@ -615,13 +604,13 @@ namespace CircularFunctors { if(CircularFunctors::compare_x(r,q) == LARGER){ if (CircularFunctors::orientation(q,r,p) == LEFT_TURN // Case 2 || CircularFunctors::compare_y_to_right(l,c,q) == SMALLER){ // Case 3b - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } } else { if(CircularFunctors::orientation(r,q,p) == LEFT_TURN || CircularFunctors::compare_y_to_left(l,c,q) == SMALLER){ // Case 3d - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } } @@ -629,7 +618,7 @@ namespace CircularFunctors { typename CK::Linear_kernel::Bounded_side bs = CircularFunctors::bounded_side(c.supporting_circle(),p); if(bs == ON_BOUNDED_SIDE){ - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } else { //Case 4b typedef std::vector::type> @@ -639,12 +628,12 @@ namespace CircularFunctors { std::back_inserter(solutions) ); if(CircularFunctors::compare_x(r,q) == LARGER){ - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); *res++ = solutions.back(); return res; } else { *res++ = solutions.front(); - *res++ = result_type(std::make_pair(q,1u)); + *res++ = std::make_pair(q,1u); return res; } @@ -681,10 +670,10 @@ namespace CircularFunctors { for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it) { - if(boost::apply_visitor(Has_on_visitor(&l), *it) && - boost::apply_visitor(Has_on_visitor(&c), *it) ) + if(std::visit(Has_on_visitor(&l), *it) && + std::visit(Has_on_visitor(&c), *it) ) { - *res++ = *it; + *res++ = std::get>(*it); } } return res; @@ -746,25 +735,23 @@ namespace CircularFunctors { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Point_2 Point_2; typedef typename CK::Line_2 Line_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK2_Intersection_traits::type result_type; if(LinearFunctors::non_oriented_equal(l, la.supporting_line())) { - *res++ = result_type(la); + *res++ = la; } typename Intersection_traits::result_type v = intersection(l, la.supporting_line()); if(!v) return res; - const Point_2 *pt = boost::get(&*v); + const Point_2 *pt = std::get_if(&*v); if(pt == nullptr) return res; Circular_arc_point_2 intersect_point = Circular_arc_point_2(*pt); if (CircularFunctors::compare_xy(intersect_point, la.source()) != CircularFunctors::compare_xy(intersect_point, la.target())) - *res++ = result_type(std::make_pair(intersect_point, 1u)); + *res++ = std::make_pair(intersect_point, 1u); return res; } @@ -790,8 +777,8 @@ namespace CircularFunctors { for (typename solutions_container::const_iterator it = solutions.begin(); it != solutions.end(); ++it) { - if(boost::apply_visitor(Has_on_visitor(&c), *it)) - *res++ = *it; + if(std::visit(Has_on_visitor(&c), *it)) + *res++ = std::get>(*it); } return res; } @@ -810,7 +797,7 @@ namespace CircularFunctors { make_x_monotone( const typename CK::Line_arc_2 &A, OutputIterator res ) { - *res++ = make_object(A); + *res++ = A; return res; } diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h index d0ace79c85c..f6eb3d8fd78 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include @@ -47,7 +47,7 @@ template typedef typename CK::Line_2 Line_2; typedef typename CK::Point_2 Point_2; typedef typename CK::Circle_2 Circle_2; - typedef typename boost::variant< Circular_arc_2, Line_arc_2 > Arc; + typedef typename std::variant< Circular_arc_2, Line_arc_2 > Arc; typedef std::list Polygon; typedef std::list Polygons; typedef std::list Circles; diff --git a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h index 6755d363444..dfc1c688ea8 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h +++ b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h @@ -19,6 +19,17 @@ #include #include +template +bool assign_variant(Expected& e, const V& v) +{ + if (std::get_if(&v) != nullptr) + { + e = std::get(v); + return true; + } + return false; +} + //#define typename template void _test_circle_construct(CK ck) @@ -33,8 +44,9 @@ void _test_circle_construct(CK ck) typedef typename CK::FT FT; typedef typename CK::Construct_circle_2 Construct_circle_2; typedef typename CK::Intersect_2 Intersect_2; + typedef std::variant> Intersection_result; typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; - typedef typename CK::Make_xy_monotone_2 Make_xy_monotone_2; + typedef typename CK::Make_xy_monotone_2 Make_xy_monotone_2; typedef typename CK::Split_2 Split_2; typedef typename CK::Get_equation Get_equation; typedef typename CK::Compare_xy_2 Compare_xy_2; @@ -107,8 +119,7 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_2(center_circ_intersections_2_2, circ_intersection_2_1_r); - std::vector< CGAL::Object > - vector_for_intersection_1, vector_for_intersection_1l; + std::vector< Intersection_result > vector_for_intersection_1, vector_for_intersection_1l; theConstruct_intersect_2(circ_intersections_2_1, circ_intersections_2_2, @@ -120,12 +131,12 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_1)); assert(do_intersect(circ_intersections_2_1, circ_intersections_2_1)); std::pair the_pair; - assert(assign(the_pair, vector_for_intersection_1[0])); - assert(assign(the_pair, vector_for_intersection_1l[0])); + assert(assign_variant(the_pair, vector_for_intersection_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_1l[0])); Circular_arc_point_2 first = the_pair.first; std::cout << first << std::endl; - assert(assign(the_pair, vector_for_intersection_1[1])); - assert(assign(the_pair, vector_for_intersection_1l[1])); + assert(assign_variant(the_pair, vector_for_intersection_1[1])); + assert(assign_variant(the_pair, vector_for_intersection_1l[1])); Circular_arc_point_2 second = the_pair.first; std::cout << second << std::endl; Compare_xy_2 theCompare_xy_2 = ck.compare_xy_2_object(); @@ -146,14 +157,13 @@ void _test_circle_construct(CK ck) CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_3, false); - std::vector< CGAL::Object > - vector_for_intersection_2; + std::vector< Intersection_result > vector_for_intersection_2; theConstruct_intersect_2(circ_intersections_2_1, circ_intersections_2_3, std::back_inserter(vector_for_intersection_2)); assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_3)); assert(vector_for_intersection_2.size() == 1); - assign(the_pair, vector_for_intersection_2[0]); + assign_variant(the_pair, vector_for_intersection_2[0]); assert(the_pair.first == the_intersection_point_1); assert(the_pair.first == the_intersection_point_2); @@ -163,14 +173,13 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_3_bis(center_circ_intersections_2_3_bis, circ_intersection_2_1_r * circ_intersection_2_1_r * 4); - std::vector< CGAL::Object > - vector_for_intersection_2_bis; + std::vector< Intersection_result > vector_for_intersection_2_bis; theConstruct_intersect_2(circ_intersections_2_1, circ_intersections_2_3_bis, std::back_inserter(vector_for_intersection_2_bis)); assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_3_bis)); assert(vector_for_intersection_2_bis.size() == 1); - assign(the_pair, vector_for_intersection_2_bis[0]); + assign_variant(the_pair, vector_for_intersection_2_bis[0]); assert(the_pair.second == 2u); @@ -202,8 +211,7 @@ void _test_circle_construct(CK ck) ////////////// std::cout << "OH NO!" << std::endl; //////////////} else std::cout << "OK" << std::endl; - std::vector< CGAL::Object > - vector_for_intersection_3; + std::vector< Intersection_result > vector_for_intersection_3; theConstruct_intersect_2(circ_arc_2_1_part_low, circ_arc_2_1_low_part_high, std::back_inserter(vector_for_intersection_3)); @@ -211,12 +219,12 @@ void _test_circle_construct(CK ck) /////////////std::cout << "The size: " << vector_for_intersection_3.size() << std::endl; assert(vector_for_intersection_3.size() == 2); - assign(the_pair, vector_for_intersection_3[0]); + assign_variant(the_pair, vector_for_intersection_3[0]); assert(the_pair.second == 1u); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_1_low, true)); - assign(the_pair, vector_for_intersection_3[1]); + assign_variant(the_pair, vector_for_intersection_3[1]); assert(the_pair.second == 1u); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_1_low, @@ -270,23 +278,21 @@ void _test_circle_construct(CK ck) ); std::cout << "Intersection : same circular arc" << std::endl; - std::vector< CGAL::Object > - vector_for_intersection_the_same_arc; + std::vector< Intersection_result > vector_for_intersection_the_same_arc; theConstruct_intersect_2(circ_arc_overlap_1, circ_arc_overlap_1, std::back_inserter(vector_for_intersection_the_same_arc)); assert(theDo_intersect_2(circ_arc_overlap_1, circ_arc_overlap_1)); assert(vector_for_intersection_the_same_arc.size() == 1); Circular_arc_2 res_same; - assert(assign(res_same, vector_for_intersection_the_same_arc[0])); + assert(assign_variant(res_same, vector_for_intersection_the_same_arc[0])); assert(res_same.source() == circ_arc_overlap_1.source()); assert(res_same.target() == circ_arc_overlap_1.target()); std::cout << "Intersection : overlap on a circular arc" << std::endl; Circular_arc_2 circ_arc_in_overlap; Circular_arc_2 circ_arc_in_overlap_2; - std::vector< CGAL::Object > - vector_for_intersection_overlap_1_1; + std::vector< Intersection_result > vector_for_intersection_overlap_1_1; theConstruct_intersect_2(circ_arc_overlap_2, circ_arc_overlap_1, std::back_inserter(vector_for_intersection_overlap_1_1)); @@ -295,30 +301,29 @@ void _test_circle_construct(CK ck) line_arc_overlap_low_left, true, line_arc_overlap_low_right, false); assert(vector_for_intersection_overlap_1_1.size() == 1); - assign(circ_arc_in_overlap, vector_for_intersection_overlap_1_1[0]); + assign_variant(circ_arc_in_overlap, vector_for_intersection_overlap_1_1[0]); assert(circ_arc_in_overlap.source() == circ_arc_overlap_result.source()); assert(circ_arc_in_overlap.target() == circ_arc_overlap_result.target()); - std::vector< CGAL::Object > - vector_for_intersection_overlap_1_2; + std::vector< Intersection_result > vector_for_intersection_overlap_1_2; theConstruct_intersect_2(circ_arc_overlap_2, circ_arc_overlap_1, std::back_inserter(vector_for_intersection_overlap_1_2)); assert(theDo_intersect_2(circ_arc_overlap_2, circ_arc_overlap_1)); assert(vector_for_intersection_overlap_1_2.size() == 1); - assign(circ_arc_in_overlap, vector_for_intersection_overlap_1_2[0]); + assign_variant(circ_arc_in_overlap, vector_for_intersection_overlap_1_2[0]); assert(circ_arc_in_overlap.source() == circ_arc_overlap_result.source()); assert(circ_arc_in_overlap.target() == circ_arc_overlap_result.target()); std::cout << "Intersection : overlap in one point" << std::endl; - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_overlap_2_1; theConstruct_intersect_2(circ_arc_overlap_1, circ_arc_overlap_3, std::back_inserter(vector_for_intersection_overlap_2_1)); assert(theDo_intersect_2(circ_arc_overlap_1, circ_arc_overlap_3)); assert(vector_for_intersection_overlap_2_1.size() == 1); - assign(the_pair, vector_for_intersection_overlap_2_1[0]); + assign_variant(the_pair, vector_for_intersection_overlap_2_1[0]); std::cout << "x = " << the_pair.first.x() << " the result must be = " << center_circ_intersection_2_1_x + circ_intersection_2_1_r * sqrt2 << std::endl; @@ -337,14 +342,14 @@ void _test_circle_construct(CK ck) assert(square(the_pair.first.y() - RT(center_circ_intersection_2_1_y)) == (circ_intersection_2_1_r * circ_intersection_2_1_r / typename CK::RT(2))); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_overlap_2_2; theConstruct_intersect_2(circ_arc_overlap_3, circ_arc_overlap_1, std::back_inserter(vector_for_intersection_overlap_2_2)); assert(theDo_intersect_2(circ_arc_overlap_3, circ_arc_overlap_1)); assert(vector_for_intersection_overlap_2_2.size() == 1); - assign(the_pair, vector_for_intersection_overlap_2_2[0]); + assign_variant(the_pair, vector_for_intersection_overlap_2_2[0]); std::cout << "x = " << the_pair.first.x() << " the result must be = " << center_circ_intersection_2_1_x + circ_intersection_2_1_r * sqrt2 << std::endl; @@ -362,7 +367,7 @@ void _test_circle_construct(CK ck) std::cout << "Intersection : overlap in two points: " << "lower_part_arc , upper_part_arc" << std::endl; - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_overlap_3_1; theConstruct_intersect_2(circ_arc_overlap_upper_part, circ_arc_overlap_lower_part, @@ -370,13 +375,13 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_arc_overlap_upper_part, circ_arc_overlap_lower_part)); assert(vector_for_intersection_overlap_3_1.size() == 2); - assign(the_pair, vector_for_intersection_overlap_3_1[0]); + assign_variant(the_pair, vector_for_intersection_overlap_3_1[0]); assert(the_pair.first == circ_arc_overlap_lower_part.source()); //assert(the_pair.first.is_left()); - assign(the_pair, vector_for_intersection_overlap_3_1[1]); + assign_variant(the_pair, vector_for_intersection_overlap_3_1[1]); assert(the_pair.first == circ_arc_overlap_lower_part.target()); //assert(!the_pair.first.is_left()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_overlap_3_2; theConstruct_intersect_2(circ_arc_overlap_lower_part, circ_arc_overlap_upper_part, @@ -384,10 +389,10 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_arc_overlap_lower_part, circ_arc_overlap_upper_part)); assert(vector_for_intersection_overlap_3_2.size() == 2); - assign(the_pair, vector_for_intersection_overlap_3_2[0]); + assign_variant(the_pair, vector_for_intersection_overlap_3_2[0]); assert(the_pair.first == circ_arc_overlap_lower_part.source()); //assert(the_pair.first.is_left()); - assign(the_pair, vector_for_intersection_overlap_3_2[1]); + assign_variant(the_pair, vector_for_intersection_overlap_3_2[1]); assert(the_pair.first == circ_arc_overlap_lower_part.target()); //assert(!the_pair.first.is_left()); @@ -404,20 +409,20 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_4(center_circ_intersections_2_4, circ_intersection_2_1_r * circ_intersection_2_1_r); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_1; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_4, std::back_inserter(vector_for_intersection_no_x_monotone_1_1)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_4)); assert(vector_for_intersection_no_x_monotone_1_1.size() == 2); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_1[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_4, true)); assert(the_pair.second == 1u); //assert(the_pair.first.is_left()); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_1[1])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_1[1])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_4, false)); @@ -432,14 +437,14 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_5(center_circ_intersections_2_5, circ_intersection_2_1_r * circ_intersection_2_1_r); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_2; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_5, std::back_inserter(vector_for_intersection_no_x_monotone_1_2)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_5)); assert(vector_for_intersection_no_x_monotone_1_2.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_2[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_2[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_5, true)); @@ -454,14 +459,14 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_6(center_circ_intersections_2_6, circ_intersection_2_1_r * circ_intersection_2_1_r); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_3; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_6, std::back_inserter(vector_for_intersection_no_x_monotone_1_3)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_6)); assert(vector_for_intersection_no_x_monotone_1_3.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_3[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_3[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_6, true)); @@ -475,14 +480,14 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_7(center_circ_intersections_2_7, circ_intersection_2_1_r * circ_intersection_2_1_r); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_4; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_7, std::back_inserter(vector_for_intersection_no_x_monotone_1_4)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_7)); assert(vector_for_intersection_no_x_monotone_1_4.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_4[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_4[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_7, true)); @@ -495,14 +500,14 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_8(center_circ_intersections_2_8, circ_intersection_2_1_r * circ_intersection_2_1_r * 4); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_5; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_8, std::back_inserter(vector_for_intersection_no_x_monotone_1_5)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_8)); assert(vector_for_intersection_no_x_monotone_1_5.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_5[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_5[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_8, true)); @@ -515,14 +520,14 @@ void _test_circle_construct(CK ck) Circle_2 circ_intersections_2_9(center_circ_intersections_2_9, circ_intersection_2_1_r * circ_intersection_2_1_r * 4); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_1_6; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_9, std::back_inserter(vector_for_intersection_no_x_monotone_1_6)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_9)); assert(vector_for_intersection_no_x_monotone_1_6.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_6[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_1_6[0])); assert(the_pair.first == CGAL::circle_intersect(circ_intersections_2_1, circ_intersections_2_9, true)); @@ -535,14 +540,14 @@ void _test_circle_construct(CK ck) Circular_arc_2 circ_arc_no_x_monotone_2(circ_intersections_2_1, line_arc_overlap_low_left, true, line_arc_overlap_low_left, false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_1; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_2, std::back_inserter(vector_for_intersection_no_x_monotone_2_1)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_2)); assert(vector_for_intersection_no_x_monotone_2_1.size() == 1); - assert(assign(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_1[0])); + assert(assign_variant(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_1[0])); assert(circ_arc_in_overlap.is_x_monotone()); assert(circ_arc_in_overlap.source() == circ_arc_overlap_result.source()); assert(circ_arc_in_overlap.target() == circ_arc_overlap_result.target()); @@ -556,14 +561,14 @@ void _test_circle_construct(CK ck) line_arc_overlap_low_left, true); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_2; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_3, std::back_inserter(vector_for_intersection_no_x_monotone_2_2)); assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_3)); assert(vector_for_intersection_no_x_monotone_2_2.size() == 1); - assert(assign(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_2[0])); + assert(assign_variant(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_2[0])); assert(circ_arc_in_overlap.source() == circ_arc_no_x_monotone_1.source()); assert(circ_arc_in_overlap.target() == circ_arc_no_x_monotone_3.target()); @@ -575,7 +580,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 circ_arc_no_x_monotone_4(circ_intersections_2_1, line_arc_overlap_low_left, true, line_arc_overlap_low_right, true); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_3; theConstruct_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_4, @@ -586,9 +591,9 @@ void _test_circle_construct(CK ck) std::cout << vector_for_intersection_no_x_monotone_2_3.size() << std::endl; assert(vector_for_intersection_no_x_monotone_2_3.size() == 2); - assert(assign(circ_arc_in_overlap, + assert(assign_variant(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_3[0])); - assert(assign(the_pair, + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_2_3[1])); assert(circ_arc_in_overlap.is_x_monotone()); assert(circ_arc_in_overlap.source() @@ -605,7 +610,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 circ_arc_no_x_monotone_5(circ_intersections_2_1, line_arc_overlap_low_right, true, line_arc_overlap_low_left, true); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_4; theConstruct_intersect_2(circ_arc_no_x_monotone_4, circ_arc_no_x_monotone_5, @@ -613,10 +618,10 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_arc_no_x_monotone_4, circ_arc_no_x_monotone_5)); std::cout << vector_for_intersection_no_x_monotone_2_4.size() << std::endl; assert(vector_for_intersection_no_x_monotone_2_4.size() == 2); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_2_4[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_2_4[0])); assert(the_pair.first == circ_arc_no_x_monotone_5.target()); assert(the_pair.second == 1u); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_2_4[1])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_2_4[1])); assert(the_pair.first == circ_arc_no_x_monotone_5.source()); assert(the_pair.second == 1u); @@ -626,7 +631,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 circ_arc_no_x_monotone_6(circ_intersections_2_1, line_arc_overlap_low_right, false, line_arc_overlap_low_right, true); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_5; theConstruct_intersect_2(circ_arc_no_x_monotone_6, circ_arc_no_x_monotone_5, @@ -634,7 +639,7 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_arc_no_x_monotone_6, circ_arc_no_x_monotone_5)); std::cout << vector_for_intersection_no_x_monotone_2_5.size() << std::endl; assert(vector_for_intersection_no_x_monotone_2_5.size() == 1); - assert(assign(the_pair, vector_for_intersection_no_x_monotone_2_5[0])); + assert(assign_variant(the_pair, vector_for_intersection_no_x_monotone_2_5[0])); assert(the_pair.first == circ_arc_no_x_monotone_5.source()); assert(the_pair.second == 1u); @@ -644,7 +649,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 circ_arc_no_x_monotone_7(circ_intersections_2_1, line_arc_overlap_low_left, false, line_arc_overlap_low_right, false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_no_x_monotone_2_6; theConstruct_intersect_2(circ_arc_no_x_monotone_7, circ_arc_no_x_monotone_4, @@ -652,8 +657,8 @@ void _test_circle_construct(CK ck) assert(theDo_intersect_2(circ_arc_no_x_monotone_7, circ_arc_no_x_monotone_4)); std::cout << vector_for_intersection_no_x_monotone_2_6.size() << std::endl; assert(vector_for_intersection_no_x_monotone_2_6.size() == 2); - assign(circ_arc_in_overlap,vector_for_intersection_no_x_monotone_2_6[0]); - assign(circ_arc_in_overlap_2,vector_for_intersection_no_x_monotone_2_6[1]); + assign_variant(circ_arc_in_overlap,vector_for_intersection_no_x_monotone_2_6[0]); + assign_variant(circ_arc_in_overlap_2,vector_for_intersection_no_x_monotone_2_6[1]); assert((circ_arc_in_overlap.source() == circ_arc_no_x_monotone_7.source() && circ_arc_in_overlap.target() == circ_arc_no_x_monotone_4.target()) || (circ_arc_in_overlap_2.source() == circ_arc_no_x_monotone_7.source() && @@ -692,7 +697,7 @@ void _test_circle_construct(CK ck) Point_2 center_circ_monotone(x,y); Circle_2 circ_monotone(center_circ_monotone, r*r); Circular_arc_2 theCircular_arc_2_full(circ_monotone); - std::vector< CGAL::Object > outputIterator1, outputIterator1l; + std::vector< Intersection_result > outputIterator1, outputIterator1l; theMake_x_monotone(theCircular_arc_2_full, std::back_inserter(outputIterator1)); make_x_monotone(theCircular_arc_2_full, std::back_inserter(outputIterator1l)); @@ -701,8 +706,8 @@ void _test_circle_construct(CK ck) << circ_monotone << std::endl; Circular_arc_2 circular_arc_2_full, circular_arc_2_fulll; for(std::size_t i = 0; i < outputIterator1.size(); i++){ - assign(circular_arc_2_full, outputIterator1[i]); - assign(circular_arc_2_fulll, outputIterator1l[i]); + assign_variant(circular_arc_2_full, outputIterator1[i]); + assign_variant(circular_arc_2_fulll, outputIterator1l[i]); std::cout << "Circular_arc_2_" << i << " : " << circular_arc_2_full << std::endl; std::cout << "Circular_arc_2_" << i << "source : " @@ -723,8 +728,8 @@ void _test_circle_construct(CK ck) std::back_inserter(outputIterator1l)); assert(outputIterator1.size() == 4); for(std::size_t i = 0; i < outputIterator1.size(); i++){ - assign(circular_arc_2_full, outputIterator1[i]); - assign(circular_arc_2_fulll, outputIterator1l[i]); + assign_variant(circular_arc_2_full, outputIterator1[i]); + assign_variant(circular_arc_2_fulll, outputIterator1l[i]); assert(circular_arc_2_full.is_x_monotone()); assert(circular_arc_2_full.is_y_monotone()); assert(circular_arc_2_full == circular_arc_2_fulll); @@ -767,7 +772,7 @@ void _test_circle_construct(CK ck) std::cout << "T: " << i << " " << j << std::endl; assert(outputIterator1.size() == isize[i][j]); for(std::size_t k = 0; k < outputIterator1.size(); k++) { - assign(circular_arc_2_full, outputIterator1[k]); + assign_variant(circular_arc_2_full, outputIterator1[k]); assert(circular_arc_2_full.is_x_monotone()); assert(circular_arc_2_full.is_y_monotone()); } @@ -782,7 +787,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 theCircular_arc_2_quarter(circ_monotone, theLine_2_1, true, theLine_2_2, true); - std::vector< CGAL::Object > vector_of_object_1; + std::vector< Intersection_result > vector_of_object_1; theMake_x_monotone(theCircular_arc_2_quarter, std::back_inserter(vector_of_object_1)); std::cout << std::endl; @@ -791,7 +796,7 @@ void _test_circle_construct(CK ck) std::cout << vector_of_object_1.size() << std::endl; Circular_arc_2 circular_arc_2_quarter; for(std::size_t i = 0; i < vector_of_object_1.size(); i++){ - assign(circular_arc_2_quarter, vector_of_object_1[i]); + assign_variant(circular_arc_2_quarter, vector_of_object_1[i]); std::cout << "Circular_arc_2_" << i << " : " << circular_arc_2_quarter << std::endl; assert(circular_arc_2_quarter.is_x_monotone()); @@ -801,13 +806,13 @@ void _test_circle_construct(CK ck) Circular_arc_2 theCircular_arc_2_half(circ_monotone, theLine_2_2, false, theLine_2_2, true); - std::vector< CGAL::Object > vector_of_object_1_half; + std::vector< Intersection_result > vector_of_object_1_half; theMake_x_monotone(theCircular_arc_2_half, std::back_inserter(vector_of_object_1_half)); std::cout << std::endl; std::cout << "x_monotone a half circle" << std::endl; assert(vector_of_object_1_half.size() == 1); - assign(circular_arc_2_quarter, vector_of_object_1_half[0]); + assign_variant(circular_arc_2_quarter, vector_of_object_1_half[0]); assert(circular_arc_2_quarter.is_x_monotone()); assert(circular_arc_2_quarter.source() == theCircular_arc_2_half.source()); assert(circular_arc_2_quarter.target() == theCircular_arc_2_half.target()); @@ -837,7 +842,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 theCircular_arc_2_random(circ_monotone, theLine_2_3, true, theLine_2_4, true); - std::vector< CGAL::Object > vector_of_object_2; + std::vector< Intersection_result > vector_of_object_2; theMake_x_monotone(theCircular_arc_2_random, std::back_inserter(vector_of_object_2)); std::cout << std::endl; @@ -845,7 +850,7 @@ void _test_circle_construct(CK ck) << circ_monotone << std::endl; Circular_arc_2 circular_arc_2_random; for(std::size_t i = 0; i < vector_of_object_2.size(); i++){ - assign(circular_arc_2_random, vector_of_object_2[i]); + assign_variant(circular_arc_2_random, vector_of_object_2[i]); std::cout << "Circular_arc_2_" << i << " : " << circular_arc_2_random << std::endl; assert(circular_arc_2_random.is_x_monotone()); @@ -911,7 +916,7 @@ void _test_circle_construct(CK ck) Circular_arc_2 cao8 = Circular_arc_2(Point_2(11,10), Point_2(1,0), Point_2(11,-10)); // = no intersection std::cout << "Testing intersect with lines" << std::endl; - std::vector< CGAL::Object > v_ll1, v_ll2, v_ll3, v_ll4, v_ll5, v_ll6, v_ll7, v_ll8; + std::vector< Intersection_result > v_ll1, v_ll2, v_ll3, v_ll4, v_ll5, v_ll6, v_ll7, v_ll8; theConstruct_intersect_2(lo1, cao1, std::back_inserter(v_ll1)); theConstruct_intersect_2(lo1, cao2, std::back_inserter(v_ll2)); theConstruct_intersect_2(lo1, cao3, std::back_inserter(v_ll3)); @@ -942,7 +947,7 @@ void _test_circle_construct(CK ck) Line_arc_2 llu3 = Line_arc_2(Point_2(-2,-1), Point_2(-2,1)); Circle_2 ccu = Circle_2(Point_2(0,-1), Point_2(-1,0), Point_2(0,1)); - std::vector< CGAL::Object > v_llc1, v_llc2, v_llc3; + std::vector< Intersection_result > v_llc1, v_llc2, v_llc3; theConstruct_intersect_2(llu1, ccu, std::back_inserter(v_llc1)); theConstruct_intersect_2(llu2, ccu, std::back_inserter(v_llc2)); theConstruct_intersect_2(llu3, ccu, std::back_inserter(v_llc3)); @@ -957,7 +962,7 @@ void _test_circle_construct(CK ck) assert(!theDo_intersect_2(llu3, ccu)); assert(!CGAL::do_intersect(llu3, ccu)); - std::vector< CGAL::Object > v_rllc1, v_rllc2, v_rllc3, v_rllc1l, v_rllc2l, v_rllc3l; + std::vector< Intersection_result > v_rllc1, v_rllc2, v_rllc3, v_rllc1l, v_rllc2l, v_rllc3l; theConstruct_intersect_2(llu1.supporting_line(), ccu, std::back_inserter(v_rllc1)); theConstruct_intersect_2(llu2.supporting_line(), ccu, std::back_inserter(v_rllc2)); theConstruct_intersect_2(llu3.supporting_line(), ccu, std::back_inserter(v_rllc3)); diff --git a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_extention.h b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_extention.h index 2329bca2acb..02471d6f61d 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_extention.h +++ b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_extention.h @@ -24,7 +24,9 @@ void _test_circle_bbox(CK ck) typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Point_2 Point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Intersect_2 Intersect_2; + typedef std::variant> Intersection_result; CGAL::Random generatorOfgenerator; int random_seed = generatorOfgenerator.get_int(0, 123456); @@ -55,7 +57,7 @@ void _test_circle_bbox(CK ck) bool box_overlap = do_overlap(box1, box2); Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(arc1, arc2, @@ -143,6 +145,7 @@ template typedef typename CK::Intersect_2 Intersect_2; typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef std::variant, Circular_arc_2> Intersection_result; Point_2 center_circ(0,0); Circle_2 circ(center_circ, 100); @@ -151,7 +154,7 @@ template Point_2(0, -15)); Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(arc, line_vertical, @@ -159,18 +162,18 @@ template Circular_arc_point_2 point_top; Circular_arc_point_2 point_down; std::pair< Circular_arc_point_2, unsigned int> aux; - assign(aux, vector_for_intersection_1[0]); + assign_variant(aux, vector_for_intersection_1[0]); point_down = aux.first; - assign(aux, vector_for_intersection_1[1]); + assign_variant(aux, vector_for_intersection_1[1]); point_top = aux.first; Make_x_monotone_2 theMake_x_monotone = ck.make_x_monotone_2_object(); - std::vector< CGAL::Object > outputIterator1; + std::vector< Intersection_result > outputIterator1; theMake_x_monotone(arc, std::back_inserter(outputIterator1)); Circular_arc_2 arc_top; Circular_arc_2 arc_down; - assign(arc_top,outputIterator1[1]); - assign(arc_down, outputIterator1[0]); + assign_variant(arc_top,outputIterator1[1]); + assign_variant(arc_down, outputIterator1[0]); assert(!ck.has_on_2_object()(arc_top, line_vertical.source())); assert(ck.has_on_2_object()(arc_top, @@ -195,7 +198,7 @@ template typedef typename CK::Point_2 Point_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Intersect_2 Intersect_2; - + typedef std::variant> Intersection_result; int test_suite_cases[3][2][3] = {{{-7,-8,113},{9,9,162}}, @@ -213,20 +216,20 @@ template Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(arc, arc2, std::back_inserter(vector_for_intersection_1)); std::pair< Circular_arc_point_2, unsigned int> aux; - assign(aux, vector_for_intersection_1[0]); + assign_variant(aux, vector_for_intersection_1[0]); CGAL::Bbox_2 box1 = aux.first.bbox(); assert(typename CK::FT(box1.xmin()) <= aux.first.x()); assert(typename CK::FT(box1.xmax()) >= aux.first.x()); assert(typename CK::FT(box1.ymin()) <= aux.first.y()); assert(typename CK::FT(box1.ymax()) >= aux.first.y()); std::cout << "Ok" << std::endl; - assign(aux, vector_for_intersection_1[1]); + assign_variant(aux, vector_for_intersection_1[1]); CGAL::Bbox_2 box2 = aux.first.bbox(); assert(typename CK::FT(box2.xmin()) <= aux.first.x()); assert(typename CK::FT(box2.xmax()) >= aux.first.x()); diff --git a/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp b/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp index 38a2174b586..b1633d4b08f 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp +++ b/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp @@ -27,6 +27,17 @@ #include +template +bool assign_variant(Expected& e, const V& v) +{ + if (std::get_if(&v) != nullptr) + { + e = std::get(v); + return true; + } + return false; +} + template void _test_Line_arc(CK ck) { @@ -87,41 +98,42 @@ void _test_Line_arc(CK ck) //////////////Intersection Line_arc Line_arc////////////////// Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); + typedef std::variant, Line_arc_2> Intersection_result; - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(line_arc_horizontal, line_arc_vertical, std::back_inserter(vector_for_intersection_1)); std::pair the_pair; - assert(assign(the_pair, vector_for_intersection_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_1[0])); Circular_arc_point_2 first = the_pair.first; assert(first.x() == 0); assert(first.y() == 0); Line_arc_2 line_arc_3(Point_2(-1, -2), Point_2(2,1)); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_2; theConstruct_intersect_2(line_arc_horizontal, line_arc_3, std::back_inserter(vector_for_intersection_2)); - assert(assign(the_pair, vector_for_intersection_2[0])); + assert(assign_variant(the_pair, vector_for_intersection_2[0])); first = the_pair.first; assert(first.x() == 1); assert(first.y() == 0); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_3; theConstruct_intersect_2(line_arc_vertical, line_arc_3, std::back_inserter(vector_for_intersection_3)); - assert(assign(the_pair, vector_for_intersection_3[0])); + assert(assign_variant(the_pair, vector_for_intersection_3[0])); first = the_pair.first; assert(first.x() == 0); assert(first.y() == -1); Line_arc_2 line_arc_4(Point_2(20, -2), Point_2(20,10)); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_4; theConstruct_intersect_2(line_arc_horizontal, line_arc_4, @@ -131,14 +143,14 @@ void _test_Line_arc(CK ck) ////////////intersection in overlap/////////////// - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_5; theConstruct_intersect_2(line_arc_horizontal, line_arc_horizontal, std::back_inserter(vector_for_intersection_5)); Line_arc_2 line_arc_tmp; assert(vector_for_intersection_5.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_5[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_5[0])); assert(line_arc_tmp == line_arc_horizontal); Line_arc_2 line_arc_horizontal2(Line_2(center_circle1, p2_line_horizontal), @@ -146,25 +158,25 @@ void _test_Line_arc(CK ck) true, circle1, false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_6; theConstruct_intersect_2(line_arc_horizontal, line_arc_horizontal2, std::back_inserter(vector_for_intersection_6)); assert(vector_for_intersection_6.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_6[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_6[0])); assert(line_arc_tmp.source() == line_arc_horizontal.source()); assert(line_arc_tmp.target() == line_arc_horizontal2.target()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_6_reverse; theConstruct_intersect_2(line_arc_horizontal2, line_arc_horizontal, std::back_inserter(vector_for_intersection_6_reverse)); assert(vector_for_intersection_6_reverse.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_6_reverse[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_6_reverse[0])); assert(line_arc_tmp.source() == line_arc_horizontal.source()); assert(line_arc_tmp.target() == line_arc_horizontal2.target()); @@ -175,43 +187,43 @@ void _test_Line_arc(CK ck) true, circle1, false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_7; theConstruct_intersect_2(line_arc_horizontal, line_arc_horizontal3, std::back_inserter(vector_for_intersection_7)); assert(vector_for_intersection_7.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_7[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_7[0])); assert(line_arc_tmp.source() == line_arc_horizontal.source()); assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_8; theConstruct_intersect_2(line_arc_horizontal3, line_arc_horizontal, std::back_inserter(vector_for_intersection_8)); assert(vector_for_intersection_8.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_8[0])); assert(line_arc_tmp.source() == line_arc_horizontal.source()); assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_8_bis_1; theConstruct_intersect_2(line_arc_horizontal3, line_arc_horizontal2, std::back_inserter(vector_for_intersection_8_bis_1)); assert(vector_for_intersection_8_bis_1.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8_bis_1[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_8_bis_1[0])); assert(line_arc_tmp.source() == line_arc_horizontal2.source()); assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_8_bis_2; theConstruct_intersect_2(line_arc_horizontal2, line_arc_horizontal3, std::back_inserter(vector_for_intersection_8_bis_2)); assert(vector_for_intersection_8_bis_2.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8_bis_2[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_8_bis_2[0])); assert(line_arc_tmp.source() == line_arc_horizontal2.source()); assert(line_arc_tmp.target() == line_arc_horizontal3.target()); @@ -221,45 +233,45 @@ void _test_Line_arc(CK ck) true, circle1, true); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_9; theConstruct_intersect_2(line_arc_horizontal4, line_arc_horizontal, std::back_inserter(vector_for_intersection_9)); assert(vector_for_intersection_9.size() == 1); - assert(assign(the_pair, vector_for_intersection_9[0])); + assert(assign_variant(the_pair, vector_for_intersection_9[0])); assert(the_pair.second == 1); assert(the_pair.first == line_arc_horizontal.source()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_10; theConstruct_intersect_2(line_arc_horizontal, line_arc_horizontal4, std::back_inserter(vector_for_intersection_10)); assert(vector_for_intersection_10.size() == 1); - assert(assign(the_pair, vector_for_intersection_10[0])); + assert(assign_variant(the_pair, vector_for_intersection_10[0])); assert(the_pair.second == 1); assert(the_pair.first == line_arc_horizontal.source()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_11; theConstruct_intersect_2(Line_arc_2(Point_2(-1, -1),Point_2(2, 2)), Line_arc_2(Point_2(0, 0), Point_2(1, 1)), std::back_inserter(vector_for_intersection_11)); assert(vector_for_intersection_11.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_11[0])); + assert(assign_variant(line_arc_tmp, vector_for_intersection_11[0])); assert(line_arc_tmp == Line_arc_2(Point_2(0, 0), Point_2(1, 1))); //////Split///////////// - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_split_1; theConstruct_intersect_2(line_arc_horizontal, line_arc_3, std::back_inserter(vector_for_intersection_split_1)); - assert(assign(the_pair, vector_for_intersection_split_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_split_1[0])); Circular_arc_point_2 point_of_split = the_pair.first; Split_2 theSplit_2 = ck.split_2_object(); Line_arc_2 first_part_line_arc_horizontal; @@ -291,6 +303,8 @@ void _test_intersection_Line_arc_Circle(CK ck) typedef CGAL::Line_arc_2 Line_arc_2; typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Intersect_2 Intersect_2; + typedef std::variant, Line_arc_2> Intersection_result; + CGAL::Random generatorOfgenerator; int random_seed = generatorOfgenerator.get_int(0, 123456); std::cout << "random_seed = " << random_seed << std::endl; @@ -368,53 +382,53 @@ void _test_intersection_Line_arc_Circle(CK ck) false); ////////test horizontal////// - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(line_arc_horizontal, circle1, std::back_inserter(vector_for_intersection_1)); std::pair the_pair; assert(vector_for_intersection_1.size() == 2); - assert(assign(the_pair, vector_for_intersection_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_1[0])); Circular_arc_point_2 first = the_pair.first; assert(first == line_arc_horizontal.source()); assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_1[1])); + assert(assign_variant(the_pair, vector_for_intersection_1[1])); first = the_pair.first; assert(first == line_arc_horizontal2.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_2; theConstruct_intersect_2(line_arc_horizontal, circle2, std::back_inserter(vector_for_intersection_2)); assert(vector_for_intersection_2.size() == 1); - assert(assign(the_pair, vector_for_intersection_2[0])); + assert(assign_variant(the_pair, vector_for_intersection_2[0])); first = the_pair.first; assert(first == line_arc_horizontal.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_3; theConstruct_intersect_2(line_arc_horizontal2, circle2, std::back_inserter(vector_for_intersection_3)); assert(vector_for_intersection_3.size() == 0); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_4; theConstruct_intersect_2(line_arc_horizontal3, circle2, std::back_inserter(vector_for_intersection_4)); assert(vector_for_intersection_4.size() == 1); - assert(assign(the_pair, vector_for_intersection_4[0])); + assert(assign_variant(the_pair, vector_for_intersection_4[0])); first = the_pair.first; assert(first == line_arc_horizontal3.source()); assert(the_pair.second == 1); Line_arc_2 line_arc_aux(p2_high_circle2,p2_high_right_circle2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_5; theConstruct_intersect_2(Line_arc_2(p2_high_left_circle2,p2_high_right_circle2), circle2, @@ -424,17 +438,17 @@ void _test_intersection_Line_arc_Circle(CK ck) circle2, std::back_inserter(vector_for_intersection_5)); assert(vector_for_intersection_5.size() == 2); - assert(assign(the_pair, vector_for_intersection_5[0])); + assert(assign_variant(the_pair, vector_for_intersection_5[0])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_5[1])); + assert(assign_variant(the_pair, vector_for_intersection_5[1])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); line_arc_aux = Line_arc_2(p2_low_circle2,p2_low_right_circle2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_6; theConstruct_intersect_2(Line_arc_2(p2_low_left_circle2,p2_low_right_circle2), circle2, @@ -444,63 +458,63 @@ void _test_intersection_Line_arc_Circle(CK ck) circle2, std::back_inserter(vector_for_intersection_6)); assert(vector_for_intersection_6.size() == 2); - assert(assign(the_pair, vector_for_intersection_6[0])); + assert(assign_variant(the_pair, vector_for_intersection_6[0])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_6[1])); + assert(assign_variant(the_pair, vector_for_intersection_6[1])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); ////////test vertical////// - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_7; theConstruct_intersect_2(line_arc_vertical, circle1, std::back_inserter(vector_for_intersection_7)); assert(vector_for_intersection_7.size() == 2); - assert(assign(the_pair, vector_for_intersection_7[0])); + assert(assign_variant(the_pair, vector_for_intersection_7[0])); first = the_pair.first; assert(first == line_arc_vertical.source()); assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_7[1])); + assert(assign_variant(the_pair, vector_for_intersection_7[1])); first = the_pair.first; assert(first == line_arc_vertical2.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_8; theConstruct_intersect_2(line_arc_vertical, circle2, std::back_inserter(vector_for_intersection_8)); std::cout << vector_for_intersection_8.size() << std::endl; assert(vector_for_intersection_8.size() == 1); - assert(assign(the_pair, vector_for_intersection_8[0])); + assert(assign_variant(the_pair, vector_for_intersection_8[0])); first = the_pair.first; assert(first == line_arc_vertical.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_9; theConstruct_intersect_2(line_arc_vertical2, circle2, std::back_inserter(vector_for_intersection_9)); assert(vector_for_intersection_9.size() == 0); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_10; theConstruct_intersect_2(line_arc_vertical3, circle2, std::back_inserter(vector_for_intersection_10)); assert(vector_for_intersection_10.size() == 1); - assert(assign(the_pair, vector_for_intersection_10[0])); + assert(assign_variant(the_pair, vector_for_intersection_10[0])); first = the_pair.first; assert(first == line_arc_vertical3.source()); assert(the_pair.second == 1); line_arc_aux = Line_arc_2(p2_right_circle2,p2_high_right_circle2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_11; theConstruct_intersect_2(Line_arc_2(p2_low_right_circle2,p2_high_right_circle2), circle2, @@ -510,17 +524,17 @@ void _test_intersection_Line_arc_Circle(CK ck) circle2, std::back_inserter(vector_for_intersection_11)); assert(vector_for_intersection_11.size() == 2); - assert(assign(the_pair, vector_for_intersection_11[0])); + assert(assign_variant(the_pair, vector_for_intersection_11[0])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_11[1])); + assert(assign_variant(the_pair, vector_for_intersection_11[1])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); line_arc_aux = Line_arc_2(p2_left_circle2,p2_high_left_circle2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_12; theConstruct_intersect_2(Line_arc_2(p2_low_left_circle2,p2_high_left_circle2), circle2, @@ -530,56 +544,56 @@ void _test_intersection_Line_arc_Circle(CK ck) circle2, std::back_inserter(vector_for_intersection_12)); assert(vector_for_intersection_12.size() == 2); - assert(assign(the_pair, vector_for_intersection_12[0])); + assert(assign_variant(the_pair, vector_for_intersection_12[0])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_12[1])); + assert(assign_variant(the_pair, vector_for_intersection_12[1])); first = the_pair.first; assert(first == line_arc_aux.source()); assert(the_pair.second == 2); //test diagonal - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_13; theConstruct_intersect_2(line_arc_diagonal, circle1, std::back_inserter(vector_for_intersection_13)); assert(vector_for_intersection_13.size() == 2); - assert(assign(the_pair, vector_for_intersection_13[0])); + assert(assign_variant(the_pair, vector_for_intersection_13[0])); first = the_pair.first; assert(first == line_arc_diagonal.source()); assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_13[1])); + assert(assign_variant(the_pair, vector_for_intersection_13[1])); first = the_pair.first; assert(first == line_arc_diagonal2.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_14; theConstruct_intersect_2(line_arc_diagonal, circle2, std::back_inserter(vector_for_intersection_14)); assert(vector_for_intersection_14.size() == 1); - assert(assign(the_pair, vector_for_intersection_14[0])); + assert(assign_variant(the_pair, vector_for_intersection_14[0])); first = the_pair.first; assert(first == line_arc_diagonal.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_15; theConstruct_intersect_2(line_arc_diagonal2, circle2, std::back_inserter(vector_for_intersection_15)); assert(vector_for_intersection_15.size() == 0); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_16; theConstruct_intersect_2(line_arc_diagonal3, circle2, std::back_inserter(vector_for_intersection_16)); assert(vector_for_intersection_16.size() == 1); - assert(assign(the_pair, vector_for_intersection_16[0])); + assert(assign_variant(the_pair, vector_for_intersection_16[0])); first = the_pair.first; assert(first == line_arc_diagonal3.source()); assert(the_pair.second == 1); @@ -587,42 +601,42 @@ void _test_intersection_Line_arc_Circle(CK ck) //Diagonal tangent - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_17; theConstruct_intersect_2(Line_arc_2(Point_2(-10, -5), Point_2(5, 15)), circle1, std::back_inserter(vector_for_intersection_17)); assert(vector_for_intersection_17.size() == 1); - assert(assign(the_pair, vector_for_intersection_17[0])); + assert(assign_variant(the_pair, vector_for_intersection_17[0])); assert(the_pair.second == 2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_18; theConstruct_intersect_2(Line_arc_2(Point_2(10, -5), Point_2(-5, 15)), circle1, std::back_inserter(vector_for_intersection_18)); assert(vector_for_intersection_18.size() == 1); - assert(assign(the_pair, vector_for_intersection_18[0])); + assert(assign_variant(the_pair, vector_for_intersection_18[0])); assert(the_pair.second == 2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_19; theConstruct_intersect_2(Line_arc_2(Point_2(10, 5), Point_2(-5, -15)), circle1, std::back_inserter(vector_for_intersection_19)); assert(vector_for_intersection_19.size() == 1); - assert(assign(the_pair, vector_for_intersection_19[0])); + assert(assign_variant(the_pair, vector_for_intersection_19[0])); assert(the_pair.second == 2); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_20; theConstruct_intersect_2(Line_arc_2(Point_2(-10, 5), Point_2(5, -15)), circle1, std::back_inserter(vector_for_intersection_20)); assert(vector_for_intersection_20.size() == 1); - assert(assign(the_pair, vector_for_intersection_20[0])); + assert(assign_variant(the_pair, vector_for_intersection_20[0])); assert(the_pair.second == 2); } @@ -638,6 +652,7 @@ void _test_intersection_Line_arc_Circular_arc(CK ck) typedef CGAL::Line_arc_2 Line_arc_2; typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Intersect_2 Intersect_2; + typedef std::variant, Circular_arc_2> Intersection_result; typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; CGAL::Random generatorOfgenerator; int random_seed = generatorOfgenerator.get_int(0, 123456); @@ -699,58 +714,58 @@ void _test_intersection_Line_arc_Circular_arc(CK ck) Line_2(center_circle1, p2_line_vertical), false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(line_arc_horizontal3, arc_1, std::back_inserter(vector_for_intersection_1)); std::pair the_pair; assert(vector_for_intersection_1.size() == 2); - assert(assign(the_pair, vector_for_intersection_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_1[0])); Circular_arc_point_2 first = the_pair.first; assert(first == line_arc_horizontal3.source()); assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_1[1])); + assert(assign_variant(the_pair, vector_for_intersection_1[1])); first = the_pair.first; assert(first == line_arc_horizontal3.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_2; theConstruct_intersect_2(line_arc_horizontal, arc_1, std::back_inserter(vector_for_intersection_2)); assert(vector_for_intersection_2.size() == 1); - assert(assign(the_pair, vector_for_intersection_2[0])); + assert(assign_variant(the_pair, vector_for_intersection_2[0])); first = the_pair.first; assert(first == line_arc_horizontal.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_3; theConstruct_intersect_2(line_arc_vertical, arc_1, std::back_inserter(vector_for_intersection_3)); assert(vector_for_intersection_3.size() == 1); - assert(assign(the_pair, vector_for_intersection_3[0])); + assert(assign_variant(the_pair, vector_for_intersection_3[0])); first = the_pair.first; assert(first == arc_1.target()); assert(the_pair.second == 1); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_4; theConstruct_intersect_2(Line_arc_2(Point_2(-10, -5), Point_2(5, 15)), arc_2, std::back_inserter(vector_for_intersection_4)); assert(vector_for_intersection_4.size() == 0); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_5; theConstruct_intersect_2(Line_arc_2(Point_2(10, -5), Point_2(-5, 15)), arc_2, std::back_inserter(vector_for_intersection_5)); assert(vector_for_intersection_5.size() == 1); - assert(assign(the_pair, vector_for_intersection_5[0])); + assert(assign_variant(the_pair, vector_for_intersection_5[0])); assert(the_pair.second == 2); //random @@ -778,31 +793,31 @@ void _test_intersection_Line_arc_Circular_arc(CK ck) false); Circular_arc_point_2 first2; - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_random1; theConstruct_intersect_2(Line_arc_2(Point_2(-p_random1.x(),-p_random1.y()), p_random1), arc_random_1, std::back_inserter(vector_for_intersection_random1)); assert(vector_for_intersection_random1.size() > 0); - assert(assign(the_pair, vector_for_intersection_random1[0])); + assert(assign_variant(the_pair, vector_for_intersection_random1[0])); first = the_pair.first; assert(the_pair.second == 1); assert(first == arc_random_1.source()); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_random2; theConstruct_intersect_2(Line_arc_2(Point_2(-p_random2.x(),-p_random2.y()),p_random2), arc_random_1, std::back_inserter(vector_for_intersection_random2)); assert(vector_for_intersection_random2.size() > 0); - assert(assign(the_pair, vector_for_intersection_random2[0])); + assert(assign_variant(the_pair, vector_for_intersection_random2[0])); first = the_pair.first; assert(the_pair.second == 1); if(vector_for_intersection_random2.size() == 2){ - assert(assign(the_pair, vector_for_intersection_random2[1])); + assert(assign_variant(the_pair, vector_for_intersection_random2[1])); first2 = the_pair.first; assert(the_pair.second == 1); assert((first == arc_random_1.target()) || (first2 == arc_random_1.target())); @@ -825,20 +840,20 @@ void _test_intersection_Line_arc_Circular_arc(CK ck) theRandom.get_int(random_min, random_max)); } while (p_random4 == center_circle_random1 || (p_random3 == p_random4)); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_random3; theConstruct_intersect_2(Line_arc_2(p_random3,p_random4), arc_random_1, std::back_inserter(vector_for_intersection_random3)); for( std::size_t i = 0; i < vector_for_intersection_random3.size(); i++){ - assert(assign(the_pair, vector_for_intersection_random3[i])); + assert(assign_variant(the_pair, vector_for_intersection_random3[i])); first = the_pair.first; - std::vector objects_x_monotone; + std::vector objects_x_monotone; theMake_x_monotone( arc_random_1, std::back_inserter(objects_x_monotone)); bool is_on_arc = false; for(std::size_t j = 0; j < objects_x_monotone.size(); j++){ Circular_arc_2 aux; - assign(aux, objects_x_monotone[j]); + assign_variant(aux, objects_x_monotone[j]); if(CGAL::CircularFunctors::has_on(aux, first)){ is_on_arc = true; break; @@ -860,6 +875,7 @@ void _test_compare_y_to_right(CK ck) typedef CGAL::Line_arc_2 Line_arc_2; typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Intersect_2 Intersect_2; + typedef std::variant, Line_arc_2> Intersection_result; CGAL::Random generatorOfgenerator; int random_seed = generatorOfgenerator.get_int(0, 123456); @@ -883,13 +899,13 @@ void _test_compare_y_to_right(CK ck) p2_line_diagonal), circle1,true, circle2,false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_1; theConstruct_intersect_2(line_arc_horizontal, line_arc_diagonal, std::back_inserter(vector_for_intersection_1)); std::pair the_pair; - assert(assign(the_pair, vector_for_intersection_1[0])); + assert(assign_variant(the_pair, vector_for_intersection_1[0])); Circular_arc_point_2 first = the_pair.first; assert(CGAL::CircularFunctors::compare_y_to_right(line_arc_horizontal, @@ -934,22 +950,22 @@ void _test_compare_y_to_right(CK ck) part_low, line_arc_horizontal_low.source()) == CGAL::SMALLER); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_2; theConstruct_intersect_2(part_high, line_arc_diagonal, std::back_inserter(vector_for_intersection_2)); - assert(assign(the_pair, vector_for_intersection_2[0])); + assert(assign_variant(the_pair, vector_for_intersection_2[0])); first = the_pair.first; assert(CGAL::CircularFunctors::compare_y_to_right(line_arc_diagonal, part_high, first) == CGAL::LARGER); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_3; theConstruct_intersect_2(part_low, line_arc_diagonal, std::back_inserter(vector_for_intersection_3)); - assert(assign(the_pair, vector_for_intersection_3[0])); + assert(assign_variant(the_pair, vector_for_intersection_3[0])); first = the_pair.first; assert(CGAL::CircularFunctors::compare_y_to_right(line_arc_diagonal, part_low, @@ -959,22 +975,22 @@ void _test_compare_y_to_right(CK ck) p2_line_diagonal2), circle1,true, circle2,false); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_4; theConstruct_intersect_2(part_high, line_arc_diagonal2, std::back_inserter(vector_for_intersection_4)); - assert(assign(the_pair, vector_for_intersection_4[0])); + assert(assign_variant(the_pair, vector_for_intersection_4[0])); first = the_pair.first; assert(CGAL::CircularFunctors::compare_y_to_right(line_arc_diagonal2, part_high, first) == CGAL::SMALLER); - std::vector< CGAL::Object > + std::vector< Intersection_result > vector_for_intersection_5; theConstruct_intersect_2(part_low, line_arc_diagonal2, std::back_inserter(vector_for_intersection_5)); - assert(assign(the_pair, vector_for_intersection_5[0])); + assert(assign_variant(the_pair, vector_for_intersection_5[0])); first = the_pair.first; assert(CGAL::CircularFunctors::compare_y_to_right(line_arc_diagonal2, part_low, diff --git a/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp b/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp index 1502fb44db2..b7192481138 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp +++ b/Circular_kernel_3/demo/Circular_kernel_3/Viewer.cpp @@ -893,20 +893,19 @@ void Viewer::naive_compute_intersection_points(const std::vector& for (std::vector::const_iterator it_f=circles.begin();it_f!=--circles.end();++it_f){ std::vector::const_iterator it_s=it_f; ++it_s; + typedef std::pair Point_and_multiplicity; for (;it_s!=circles.end();++it_s){ - std::vector intersections; + std::vector intersections; //ensure_circles are different CGAL_precondition(*it_s!=*it_f); - CGAL::intersection(*it_f,*it_s,std::back_inserter(intersections)); + CGAL::intersection(*it_f,*it_s,CGAL::dispatch_or_drop_output(std::back_inserter(intersections))); if (!intersections.empty()){ - for (std::vector ::const_iterator it_pt=intersections.begin();it_pt!=intersections.end();++it_pt){ - const std::pair* pt= - CGAL::object_cast< std::pair > (&(*it_pt)); - assert(pt!=nullptr); - *out++=EPIC::Point_3( CGAL::to_double(pt->first.x()), - CGAL::to_double(pt->first.y()), - CGAL::to_double(pt->first.z()) - ); + for (const Point_and_multiplicity& pt : intersections) + { + *out++=EPIC::Point_3( CGAL::to_double(pt.first.x()), + CGAL::to_double(pt.first.y()), + CGAL::to_double(pt.first.z()) + ); } } } diff --git a/Circular_kernel_3/examples/Circular_kernel_3/functor_compare_theta_3.cpp b/Circular_kernel_3/examples/Circular_kernel_3/functor_compare_theta_3.cpp index d318216621f..439b1a55793 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/functor_compare_theta_3.cpp +++ b/Circular_kernel_3/examples/Circular_kernel_3/functor_compare_theta_3.cpp @@ -1,4 +1,5 @@ #include +#include typedef CGAL::Exact_spherical_kernel_3 SK; @@ -15,15 +16,20 @@ int main(){ SK::Intersect_3 inter; //create a functor to compare theta-coordinates on sphere s1 SK::Compare_theta_z_3 cmp(s1); - std::vector< CGAL::Object > intersections; - inter(C1,C2,std::back_inserter(intersections)); + + //unsigned integer indicates multiplicity of intersection point - std::pair p1= - CGAL::object_cast< std::pair >(intersections[0]); - std::pair p2= - CGAL::object_cast< std::pair >(intersections[1]); + typedef std::pair Point_and_multiplicity; + // only recover points + std::vector< Point_and_multiplicity > intersections; + inter(C1,C2, + CGAL::dispatch_or_drop_output(std::back_inserter(intersections))); + + + const Point_and_multiplicity& p1=intersections[0]; + const Point_and_multiplicity& p2=intersections[1]; SK::Circular_arc_point_3 t_extreme[2]; //Compute theta extremal points of circle C1 on sphere s1 diff --git a/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp b/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp index 587e53cbe85..a31eef6daf3 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp +++ b/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp @@ -1,10 +1,12 @@ #include #include -typedef CGAL::Exact_spherical_kernel_3 Spherical_k; +typedef CGAL::Exact_spherical_kernel_3 SK; -typedef CGAL::Point_3 Point_3; -typedef CGAL::Sphere_3 Sphere_3; +typedef CGAL::Point_3 Point_3; +typedef CGAL::Sphere_3 Sphere_3; +typedef CGAL::Circle_3 Circle_3; +typedef CGAL::Circular_arc_point_3 Circular_arc_point_3; int main() { @@ -33,9 +35,9 @@ int main() { Sphere_3 s2 = Sphere_3(Point_3(x2,y2,z2), r); Sphere_3 s3 = Sphere_3(Point_3(x3,y3,z3), r); - std::vector< CGAL::Object > intersecs; + std::vector< std::variant > > intersecs; CGAL::intersection(s1, s2, s3, std::back_inserter(intersecs)); - if(intersecs.size() > 0) count++; + if(intersecs.size() > 0) ++count; } std::cout << "The approximate probability that 3 spheres with radius 1" diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_3.h index 9ef9b35f134..fb5420471db 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_3.h @@ -167,11 +167,11 @@ namespace CGAL { CGAL_kernel_precondition(sols1.size() > 0); CGAL_kernel_precondition(sols2.size() > 0); const std::pair& pair1= - *boost::get >( + *std::get >( &sols1[(sols1.size()==1)?(0):(less_xyz_s1?0:1)] ); const std::pair& pair2= - *boost::get >( + *std::get >( &sols2[(sols2.size()==1)?(0):(less_xyz_s2?0:1)] ); // the source and target must be different @@ -194,11 +194,11 @@ namespace CGAL { CGAL_kernel_precondition(sols1.size() > 0); CGAL_kernel_precondition(sols2.size() > 0); const std::pair& pair1= - *boost::get >( + *std::get >( &sols1[(sols1.size()==1)?(0):(less_xyz_p1?0:1)] ); const std::pair& pair2= - *boost::get >( + *std::get >( &sols2[(sols2.size()==1)?(0):(less_xyz_p2?0:1)] ); // the source and target must be different diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h index bfb44edf924..99eb521e1fa 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h @@ -81,13 +81,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } @@ -104,13 +104,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } @@ -127,13 +127,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } @@ -149,13 +149,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } @@ -171,13 +171,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } @@ -193,13 +193,13 @@ public: if(sols.size() == 1) { // the intersection must be a point const std::pair* pair= - boost::get >(&sols[0]); + std::get_if >(&sols[0]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } else { // the intersections must be a point const std::pair* pair= - boost::get >(&sols[less_xyz?0:1]); + std::get_if >(&sols[less_xyz?0:1]); CGAL_kernel_precondition(pair!=nullptr); *this = pair->first.rep(); } diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Intersection_traits.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Intersection_traits.h index 7a90c240e03..9612d2ca578 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Intersection_traits.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Intersection_traits.h @@ -15,7 +15,7 @@ #include -#include +#include #include namespace CGAL { @@ -36,7 +36,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair< typename SK::Circular_arc_point_3, unsigned int > CGAL_ADDITIONAL_VARIANT_FOR_ICL > type; @@ -49,7 +49,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair< typename SK::Circular_arc_point_3, unsigned int >, typename SK::Circle_3 CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -63,7 +63,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair< typename SK::Circular_arc_point_3, unsigned int >, typename SK::Circle_3 CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -77,7 +77,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair , typename SK::Circle_3 CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -87,7 +87,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair CGAL_ADDITIONAL_VARIANT_FOR_ICL > type; @@ -100,7 +100,7 @@ struct SK3_Intersection_traits template struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< typename SK::Circle_3, std::pair , typename SK::Circular_arc_3 @@ -111,7 +111,7 @@ struct SK3_Intersection_traits struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair , typename SK::Circular_arc_3 CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -125,7 +125,7 @@ struct SK3_Intersection_traits struct SK3_Intersection_traits { - typedef boost::variant< + typedef std::variant< std::pair , typename SK::Line_arc_3 CGAL_ADDITIONAL_VARIANT_FOR_ICL @@ -136,7 +136,7 @@ struct SK3_Intersection_traits struct SK3_intersect_ternary { - typedef boost::variant< + typedef std::variant< typename SK::Circle_3, typename SK::Plane_3, typename SK::Sphere_3, @@ -167,25 +167,4 @@ struct SK3_Intersection_traits - inline RT - sk3_intersection_return(T&& t) { return RT(std::forward(t)); } - template - inline RT - sk3_intersection_return() { return RT(); } - -} } //end of namespace CGAL::internal - - #endif // CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h index 9d10940f0aa..de30249490d 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h @@ -94,9 +94,9 @@ namespace CGAL { // l must intersect s in 2 points CGAL_kernel_precondition(sols.size() == 2); const std::pair& pair1= - *boost::get >(&sols[0]); + *std::get_if >(&sols[0]); const std::pair& pair2= - *boost::get >(&sols[1]); + *std::get_if >(&sols[1]); if(less_xyz_first) { *this = Line_arc_3(l, pair1.first, pair2.first); } else { @@ -115,9 +115,9 @@ namespace CGAL { CGAL_kernel_precondition(sols1.size() > 0); CGAL_kernel_precondition(sols2.size() > 0); const std::pair& pair1= - *boost::get >(&sols1[(sols1.size()==1)?(0):(less_xyz_s1?0:1)]); + *std::get_if >(&sols1[(sols1.size()==1)?(0):(less_xyz_s1?0:1)]); const std::pair& pair2= - *boost::get >(&sols2[(sols2.size()==1)?(0):(less_xyz_s2?0:1)]); + *std::get_if >(&sols2[(sols2.size()==1)?(0):(less_xyz_s2?0:1)]); // the source and target must be different CGAL_kernel_precondition(pair1.first != pair2.first); *this = Line_arc_3(l, pair1.first, pair2.first); @@ -134,8 +134,8 @@ namespace CGAL { typedef typename SK3_Intersection_traits::type Intersection; Intersection i1 = SK().intersect_3_object()(l, p1); Intersection i2 = SK().intersect_3_object()(l, p2); - const typename SK::Point_3* point1=boost::get( & *i1 ); - const typename SK::Point_3* point2=boost::get( & *i2 ); + const typename SK::Point_3* point1=std::get_if( & *i1 ); + const typename SK::Point_3* point2=std::get_if( & *i2 ); CGAL_assertion(point1!=nullptr); CGAL_assertion(point2!=nullptr); // the source and target must be different diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h index 33e0451fc3f..56fd4d712ff 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h @@ -189,8 +189,6 @@ namespace CGAL { const typename SK::Circular_arc_3 & ca, OutputIterator res) { - typedef typename SK3_Intersection_traits::type result_type; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef std::vector< typename SK3_Intersection_traits::type @@ -198,7 +196,7 @@ namespace CGAL { typedef std::pair Solution; if(SK().has_on_3_object()(p,ca.supporting_circle())) { - *res++ = CGAL::internal::sk3_intersection_return(ca); + *res++ = ca; } solutions_container solutions; @@ -208,14 +206,14 @@ namespace CGAL { if(solutions.size() == 1) { const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) - *res++ = CGAL::internal::sk3_intersection_return(sol); + *res++ = sol; } else { const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true)) - *res++ = CGAL::internal::sk3_intersection_return(sol1); + *res++ = sol1; if(SK().has_on_3_object()(ca,sol2.first,true)) - *res++ = CGAL::internal::sk3_intersection_return(sol2); + *res++ = sol2; } return res; } @@ -261,8 +259,6 @@ namespace CGAL { const typename SK::Circular_arc_3 & a2, OutputIterator res) { - typedef typename SK3_Intersection_traits::type result_type; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Circular_arc_3 Circular_arc_3; typedef std::vector< typename SK3_Intersection_traits @@ -272,11 +268,11 @@ namespace CGAL { if(non_oriented_equal(a1.supporting_circle(), a2.supporting_circle())) { if(a1.rep().is_full()) { - *res++ = CGAL::internal::sk3_intersection_return(a2); + *res++ = a2; //return res; } else if(a2.rep().is_full()) { - *res++ = CGAL::internal::sk3_intersection_return(a1); + *res++ = a1; //return res; } else { bool t2_in_a1 = SK().has_on_3_object()(a1,a2.target(),true); @@ -289,58 +285,58 @@ namespace CGAL { SK().compare_xyz_3_object()(a1.source(), a2.source()); if(comp < 0) { if(a1.source() == a2.target()) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } if(a2.source() == a1.target()) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } } else if(comp > 0) { if(a2.source() == a1.target()) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } if(a1.source() == a2.target()) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } } else { - *res++ = CGAL::internal::sk3_intersection_return(a1); + *res++ = a1; } } else { - *res++ = CGAL::internal::sk3_intersection_return(a2); + *res++ = a2; } } else if(t2_in_a1) { if(a1.source() == a2.target()) - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a1.source(),1u)); + *res++ = std::make_pair(a1.source(),1u); else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } //return res; } else if(s2_in_a1) { if(a2.source() == a1.target()) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(a2.source(),1u)); + *res++ = std::make_pair(a2.source(),1u); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = CGAL::internal::sk3_intersection_return(arc); + *res++ = arc; } } else if(SK().has_on_3_object()(a2,a1.source(),true)) { - *res++ = CGAL::internal::sk3_intersection_return(a1); + *res++ = a1; } } } else { @@ -353,16 +349,16 @@ namespace CGAL { const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(a1,sol.first,true) && SK().has_on_3_object()(a2,sol.first,true)) - *res++ = solutions[0]; + *res++ = sol; } else { const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(a1,sol1.first,true) && SK().has_on_3_object()(a2,sol1.first,true)) - *res++ = solutions[0]; + *res++ = sol1; if(SK().has_on_3_object()(a1,sol2.first,true) && SK().has_on_3_object()(a2,sol2.first,true)) - *res++ = solutions[1]; + *res++ = sol2; } } return res; diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h index f26063282b1..8491e83d5db 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h @@ -83,7 +83,6 @@ namespace CGAL { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Line_3 Line_3; typedef typename SK::Line_arc_3 Line_arc_3; - typedef typename SK3_Intersection_traits::type result_type; typename Intersection_traits::result_type o = SK().intersect_3_object()(l1.supporting_line(), @@ -96,7 +95,7 @@ namespace CGAL { Circular_arc_point_3 p = *inters_p; if(!SK().has_on_3_object()(l1,p,true)) return res; if(!SK().has_on_3_object()(l2,p,true)) return res; - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(p,1u)); + *res++ = std::make_pair(p,1u); } else if( CGAL::Intersections::internal::intersect_get(o) ) { if(SK().compare_xyz_3_object()(l1.lower_xyz_extremity(), l2.lower_xyz_extremity()) < 0) { @@ -106,15 +105,15 @@ namespace CGAL { if(comparison < 0) { if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(), l2.higher_xyz_extremity()) <= 0) { - *res++ = CGAL::internal::sk3_intersection_return - (Line_arc_3(l1.supporting_line(), - l2.lower_xyz_extremity(), - l1.higher_xyz_extremity())); + *res++ = + Line_arc_3(l1.supporting_line(), + l2.lower_xyz_extremity(), + l1.higher_xyz_extremity()); } else { - *res++ = CGAL::internal::sk3_intersection_return(l2); + *res++ = l2; } } else if (comparison == 0) { - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(l2.lower_xyz_extremity(),1u)); + *res++ = std::make_pair(l2.lower_xyz_extremity(),1u); } } else { @@ -124,16 +123,16 @@ namespace CGAL { if(comparison < 0){ if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(), l2.higher_xyz_extremity()) <= 0) { - *res++ = CGAL::internal::sk3_intersection_return(l1); + *res++ = l1; } else { - *res++ = CGAL::internal::sk3_intersection_return - (Line_arc_3(l1.supporting_line(), - l1.lower_xyz_extremity(), - l2.higher_xyz_extremity() )); + *res++ = + Line_arc_3(l1.supporting_line(), + l1.lower_xyz_extremity(), + l2.higher_xyz_extremity() ); } } else if (comparison == 0){ - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(l1.lower_xyz_extremity(),1u)); + *res++ = std::make_pair(l1.lower_xyz_extremity(),1u); } } } @@ -149,8 +148,6 @@ namespace CGAL { typedef typename SK::Point_3 Point_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Line_3 Line_3; - typedef typename SK::Line_arc_3 Line_arc_3; - typedef typename SK3_Intersection_traits::type result_type; typename Intersection_traits::result_type o = SK().intersect_3_object()(l, la.supporting_line()); @@ -159,11 +156,11 @@ namespace CGAL { return res; if(const Line_3* inters_l = CGAL::Intersections::internal::intersect_get(o)) { - *res++ = CGAL::internal::sk3_intersection_return(la); + *res++ = la; } else if(const Point_3* inters_p = CGAL::Intersections::internal::intersect_get(o)) { Circular_arc_point_3 p = *inters_p; if(!SK().has_on_3_object()(la,p,true)) return res; - *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(p,1u)); + *res++ = std::make_pair(p,1u); } return res; diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h index 43a371937ec..3fb21589539 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h @@ -202,17 +202,10 @@ namespace CGAL { namespace internal { // we need to pass the result_type, to hack around the fact that // object doesn't support operator=(const T&) and so we keep backwards compatibility - template - struct pair_transform { - RT operator()(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { - return RT(std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second)); - } - }; - template - struct pair_transform { - CGAL::Object operator()(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { - return CGAL::make_object(std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second)); + struct pair_transform { + auto operator()(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { + return std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second); } }; @@ -222,15 +215,15 @@ namespace CGAL { // pair, otherwise just dump the value with conversion to RT // (again: converting to RT before assigning to the Iterator is // just to keep object working) - template - struct Point_conversion_visitor : public boost::static_visitor { + template + struct Point_conversion_visitor { Point_conversion_visitor(const OutputIterator& it) : it(it) {} template - OutputIterator operator()(const T& t) { *it++ = RT(t); return it; } + OutputIterator operator()(const T& t) { *it++ = t; return it; } OutputIterator operator()(const typename SK::Point_3& p) { // 2 multiplicities - *it++ = RT(std::make_pair(typename SK::Circular_arc_point_3(p), 2u)); + *it++ = std::make_pair(typename SK::Circular_arc_point_3(p), 2u); return it; } OutputIterator it; @@ -244,8 +237,6 @@ namespace CGAL { const typename SK::Line_3 & l, OutputIterator res) { - typedef typename SK3_Intersection_traits - ::type result_type; typedef typename SK::Algebraic_kernel Algebraic_kernel; typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere; typedef typename SK::Polynomials_for_line_3 Equation_line; @@ -259,7 +250,7 @@ namespace CGAL { solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } // The special 3 object functions @@ -278,20 +269,19 @@ namespace CGAL { typedef typename SK::Point_3 Point_3; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Algebraic_kernel Algebraic_kernel; - typedef typename SK3_Intersection_traits::type result_type; CGAL_kernel_precondition(!s1.is_degenerate()); CGAL_kernel_precondition(!s2.is_degenerate()); CGAL_kernel_precondition(!s3.is_degenerate()); if(non_oriented_equal(s1,s2) && non_oriented_equal(s2,s3)) { - *res++ = result_type(s1); + *res++ = s1; return res; } if(non_oriented_equal(s1,s2)) { if(typename Intersection_traits::result_type v = SK().intersect_3_object()(s1, s3)) { - internal::Point_conversion_visitor visitor(res); - return boost::apply_visitor(visitor, + internal::Point_conversion_visitor visitor(res); + return std::visit(visitor, *v); } return res; @@ -299,8 +289,8 @@ namespace CGAL { if(non_oriented_equal(s1,s3) || non_oriented_equal(s2,s3)) { if(typename Intersection_traits::result_type v = SK().intersect_3_object()(s1, s2)) { - internal::Point_conversion_visitor visitor(res); - return boost::apply_visitor( + internal::Point_conversion_visitor visitor(res); + return std::visit( visitor, *v); } @@ -312,13 +302,13 @@ namespace CGAL { if(!v) return res; if(const Point_3* p = CGAL::Intersections::internal::intersect_get(v)) { if(SK().has_on_3_object()(s3, *p)) { - *res++ = result_type(std::make_pair(Circular_arc_point_3(*p),2u)); + *res++ = std::make_pair(Circular_arc_point_3(*p),2u); } return res; } if(const Circle_3* c = CGAL::Intersections::internal::intersect_get(v)) { if(SK().has_on_3_object()(s3, *c)) { - *res++ = result_type(*c); + *res++ = *c; } return res; } @@ -332,7 +322,7 @@ namespace CGAL { algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -342,8 +332,6 @@ namespace CGAL { const typename SK::Sphere_3 & s2, OutputIterator res) { - typedef typename boost::variant< std::pair< typename SK::Circular_arc_point_3, unsigned int>, - typename SK::Circle_3 > result_type; typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere; typedef typename SK::Polynomial_1_3 Equation_plane; @@ -356,8 +344,8 @@ namespace CGAL { if(non_oriented_equal(s1,s2)) { if(typename Intersection_traits::result_type v = SK().intersect_3_object()(p, s1)) { - internal::Point_conversion_visitor visitor(res); - return boost::apply_visitor( + internal::Point_conversion_visitor visitor(res); + return std::visit( visitor, *v); } @@ -367,8 +355,8 @@ namespace CGAL { if(non_oriented_equal(p,radical_p)) { if(typename Intersection_traits::result_type v = SK().intersect_3_object()(p, s1)) { - internal::Point_conversion_visitor visitor(res); - return boost::apply_visitor( + internal::Point_conversion_visitor visitor(res); + return std::visit( visitor, *v); } @@ -381,7 +369,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -391,8 +379,6 @@ namespace CGAL { const typename SK::Sphere_3 & s, OutputIterator res) { - typedef typename boost::variant< std::pair< typename SK::Circular_arc_point_3, unsigned int>, - typename SK::Circle_3 > result_type; typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere; typedef typename SK::Polynomial_1_3 Equation_plane; @@ -405,8 +391,8 @@ namespace CGAL { if(non_oriented_equal(p1,p2)) { if(typename Intersection_traits::result_type v = SK().intersect_3_object()(p1, s)) { - internal::Point_conversion_visitor visitor(res); - return boost::apply_visitor( + internal::Point_conversion_visitor visitor(res); + return std::visit( visitor, *v); } @@ -419,7 +405,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -449,13 +435,9 @@ namespace CGAL { typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename SK::Polynomials_for_circle_3 Equation_circle; typedef typename SK::Algebraic_kernel Algebraic_kernel; - typedef typename SK::Circle_3 Circle_3; - - typedef typename SK3_Intersection_traits - ::type result_type; if(non_oriented_equal(c1,c2)) { - *res++ = CGAL::internal::sk3_intersection_return(c1); + *res++ = c1; return res; } Equation_circle e1 = get_equation(c1); @@ -464,7 +446,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -476,10 +458,6 @@ namespace CGAL { typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename SK::Polynomials_for_circle_3 Equation_circle; typedef typename SK::Polynomials_for_line_3 Equation_line; - typedef typename SK::Circle_3 Circle_3; - - typedef typename SK3_Intersection_traits - ::type result_type; typedef typename SK::Algebraic_kernel Algebraic_kernel; CGAL_kernel_precondition(!l.is_degenerate()); @@ -489,7 +467,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } // At the moment we dont need those functions diff --git a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_functionalities_on_sphere.h b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_functionalities_on_sphere.h index d02daa9fe8a..a4ba682726d 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_functionalities_on_sphere.h +++ b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_functionalities_on_sphere.h @@ -66,21 +66,21 @@ void test_normal_circle_monotonicity(const typename SK::Circle_3& circle, const typename SK::Sphere_3& ref_sphere) { typename SK::Is_theta_monotone_3 is_t_mon=SK().is_theta_monotone_3_object(ref_sphere); - std::vector vect_obj; + std::vector>> vect_obj; typename SK::FT zcoord = CGAL::SphericalFunctors::extremal_points_z_coordinate(circle,ref_sphere); //create extremal points of circle SK().intersect_3_object()(circle,typename SK::Plane_3(0,0,1,-zcoord),std::back_inserter(vect_obj)); assert(vect_obj.size()==2); typename SK::Circular_arc_point_3 extrems[2]; - extrems[0]=CGAL::object_cast >(&vect_obj[0])->first; - extrems[1]=CGAL::object_cast >(&vect_obj[1])->first; + extrems[0]=std::get_if >(&vect_obj[0])->first; + extrems[1]=std::get_if >(&vect_obj[1])->first; //create non extremal points on circle vect_obj.clear(); SK().intersect_3_object()(circle,typename SK::Plane_3(0,0,1,-zcoord-typename SK::FT(0.1)),std::back_inserter(vect_obj)); assert(vect_obj.size()==2); typename SK::Circular_arc_point_3 other_pts[2]; - other_pts[0]=CGAL::object_cast >(&vect_obj[0])->first; - other_pts[1]=CGAL::object_cast >(&vect_obj[1])->first; + other_pts[0]=std::get_if >(&vect_obj[0])->first; + other_pts[1]=std::get_if >(&vect_obj[1])->first; //Test Make_theta_monotone+[Ii]s_theta_monotone(_3) on monotone arcs test_make_monotone_an_already_monotone_arc(typename SK::Circular_arc_3(circle,extrems[0],extrems[1]),ref_sphere); @@ -122,18 +122,18 @@ void test_threaded_circle_monotonicity(const typename SK::Circle_3& circle, const typename SK::Sphere_3& ref_sphere) { typename SK::Is_theta_monotone_3 is_t_mon=SK().is_theta_monotone_3_object(ref_sphere); - std::vector vect_obj; + std::vector>> vect_obj; SK().intersect_3_object()(circle,typename SK::Plane_3(1,0,0,-ref_sphere.center().x()),std::back_inserter(vect_obj)); assert(vect_obj.size()==2); typename SK::Circular_arc_point_3 pts1[2]; - pts1[0]=CGAL::object_cast >(&vect_obj[0])->first; - pts1[1]=CGAL::object_cast >(&vect_obj[1])->first; + pts1[0]=std::get_if >(&vect_obj[0])->first; + pts1[1]=std::get_if >(&vect_obj[1])->first; vect_obj.clear(); SK().intersect_3_object()(circle,typename SK::Plane_3(1,1,0,-ref_sphere.center().x()-ref_sphere.center().y()),std::back_inserter(vect_obj)); assert(vect_obj.size()==2); typename SK::Circular_arc_point_3 pts2[2]; - pts2[0]=CGAL::object_cast >(&vect_obj[0])->first; - pts2[1]=CGAL::object_cast >(&vect_obj[1])->first; + pts2[0]=std::get_if >(&vect_obj[0])->first; + pts2[1]=std::get_if >(&vect_obj[1])->first; //assertions test_make_monotone_an_already_monotone_arc(typename SK::Circular_arc_3(circle,pts1[0],pts1[1]),ref_sphere); test_make_monotone_an_already_monotone_arc(typename SK::Circular_arc_3(circle,pts2[0],pts2[1]),ref_sphere); @@ -154,12 +154,12 @@ void test_polar_circle_monotonicity(const typename SK::Circle_3& circle, const typename SK::Sphere_3& ref_sphere) { typename SK::Is_theta_monotone_3 is_t_mon=SK().is_theta_monotone_3_object(ref_sphere); - std::vector vect_obj; + std::vector>> vect_obj; SK().intersect_3_object()(circle,typename SK::Plane_3(0,0,1,-circle.center().z()),std::back_inserter(vect_obj)); assert(vect_obj.size()==2); typename SK::Circular_arc_point_3 pts[2]; - pts[0]=CGAL::object_cast >(&vect_obj[0])->first; - pts[1]=CGAL::object_cast >(&vect_obj[1])->first; + pts[0]=std::get_if >(&vect_obj[0])->first; + pts[1]=std::get_if >(&vect_obj[1])->first; @@ -262,11 +262,11 @@ void fill_intersections(const typename SK::Circle_3& circle, typename SK::Circular_arc_point_3* inters,unsigned i) { typename SK::Plane_3 meridians=get_meridians(i,ref.center()); - std::vector objs; + std::vector>> objs; SK().intersect_3_object()(circle,meridians,std::back_inserter(objs)); assert(objs.size()==2); - inters[get_num(i,0)]=CGAL::object_cast >(&objs[0])->first; - inters[get_num(i,1)]=CGAL::object_cast >(&objs[1])->first; + inters[get_num(i,0)]=std::get_if >(&objs[0])->first; + inters[get_num(i,1)]=std::get_if >(&objs[1])->first; } @@ -316,7 +316,7 @@ void test_extremal_points(const typename SK::Circle_3& circle, const typename SK::Circular_arc_point_3& inter2=cut_by_M0?xtrms[0]:xtrms[1]; typename SK::Intersect_3 func=SK().intersect_3_object(); - std::vector intersections; + std::vector>> intersections; std::pair vect_pair=get_bounding_vectors(inter1,ref_sphere); func(circle,typename SK::Plane_3(ref_sphere.center(),ref_sphere.center()+typename SK::Vector_3(0,0,1),ref_sphere.center()+vect_pair.first),std::back_inserter(intersections)); @@ -391,11 +391,11 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher assert( cmp_theta(y_xtrems[0],y_xtrems[1])==CGAL::LARGER ); typename SK::FT zcoord=CGAL::SphericalFunctors::extremal_points_z_coordinate(normal_cut_M0,ref_sphere); - CGAL::Object objs[2]; + std::variant> objs[2]; SK().intersect_3_object()(normal_cut_M0,typename SK::Plane_3(0,0,1,-zcoord),objs); typename SK::Circular_arc_point_3 xtrms[2]; - xtrms[0]=CGAL::object_cast >(&objs[0])->first; - xtrms[1]=CGAL::object_cast >(&objs[1])->first; + xtrms[0]=std::get_if >(&objs[0])->first; + xtrms[1]=std::get_if >(&objs[1])->first; assert( cmp_theta(xtrms[0],xtrms[1])==CGAL::LARGER ); assert( cmp_theta(xtrms[0],y_xtrems[0])==CGAL::SMALLER ); @@ -440,11 +440,11 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher //polar circle typename SK::Line_3 line_n(ref_sphere_center,north_polar.center()-ref_sphere_center); typename SK::Line_3 line_s(ref_sphere_center,south_polar.center()-ref_sphere_center); - CGAL::Object objs[2]; + std::variant> objs[2]; SK().intersect_3_object()(line_n,ref_sphere,objs); - typename SK::Circular_arc_point_3 cn=CGAL::object_cast >(&objs[1])->first; + typename SK::Circular_arc_point_3 cn=std::get_if >(&objs[1])->first; SK().intersect_3_object()(line_s,ref_sphere,objs); - typename SK::Circular_arc_point_3 cs=CGAL::object_cast >(&objs[1])->first; + typename SK::Circular_arc_point_3 cs=std::get_if >(&objs[1])->first; assert (cmp_z_at_theta(cn,typename SK::Circular_arc_3(north_polar,north_pole))==CGAL::LARGER ); assert (cmp_z_at_theta(cs,typename SK::Circular_arc_3(north_polar,north_pole))==CGAL::SMALLER ); @@ -472,9 +472,9 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher typename SK::Line_3 line_1(ref_sphere_center,normal1.center()-ref_sphere_center); typename SK::Line_3 line_2(ref_sphere_center,normal2.center()-ref_sphere_center); SK().intersect_3_object()(line_1,ref_sphere,objs); - typename SK::Circular_arc_point_3 c1=CGAL::object_cast >(&objs[1])->first; + typename SK::Circular_arc_point_3 c1=std::get_if >(&objs[1])->first; SK().intersect_3_object()(line_2,ref_sphere,objs); - typename SK::Circular_arc_point_3 c2=CGAL::object_cast >(&objs[1])->first; + typename SK::Circular_arc_point_3 c2=std::get_if >(&objs[1])->first; typename SK::Circular_arc_point_3 xtrms1[2]; typename SK::Circular_arc_point_3 xtrms2[2]; @@ -541,10 +541,10 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher //normal vs normal typename SK::Circle_3 normal3 (ref_sphere,typename SK::Plane_3(0.08,1.1,0.9 ,-1-FT(0.08)*ref_sphere_center.x() -FT(1.1)*ref_sphere_center.y()-FT(0.9)*ref_sphere_center.z())); typename SK::Circle_3 normal4 (ref_sphere,typename SK::Plane_3(0.05,1.1,-0.9 ,-1-FT(0.05)*ref_sphere_center.x() -FT(1.1)*ref_sphere_center.y()+FT(0.9)*ref_sphere_center.z())); - std::vector objs; + std::vector>> objs; SK().intersect_3_object()(normal3,normal4,std::back_inserter(objs)); - typename SK::Circular_arc_point_3 int1=CGAL::object_cast >(&objs[1])->first; - typename SK::Circular_arc_point_3 int2=CGAL::object_cast >(&objs[0])->first; + typename SK::Circular_arc_point_3 int1=std::get_if >(&objs[1])->first; + typename SK::Circular_arc_point_3 int2=std::get_if >(&objs[0])->first; typename SK::Circular_arc_point_3 xtrms3[2]; typename SK::Circular_arc_point_3 xtrms4[2]; CGAL::theta_extremal_points(normal3,ref_sphere,xtrms3); @@ -554,8 +554,8 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher //normal vs threaded objs.clear(); SK().intersect_3_object()(threaded,normal4,std::back_inserter(objs)); - int1=CGAL::object_cast >(&objs[1])->first; - int2=CGAL::object_cast >(&objs[0])->first; + int1=std::get_if >(&objs[1])->first; + int2=std::get_if >(&objs[0])->first; assert ( cmp_right(typename SK::Circular_arc_3(threaded),typename SK::Circular_arc_3(normal4,xtrms4[1],xtrms4[0]),int1)==CGAL::SMALLER ); assert ( cmp_right(typename SK::Circular_arc_3(threaded),typename SK::Circular_arc_3(normal4,xtrms4[1],xtrms4[0]),int2)==CGAL::LARGER ); //normal vs polar @@ -563,8 +563,8 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher typename SK::Circular_arc_point_3 xtrms2[2]; CGAL::theta_extremal_points(normal2,ref_sphere,xtrms2); SK().intersect_3_object()(south_polar,normal2,std::back_inserter(objs)); - int1=CGAL::object_cast >(&objs[1])->first; - int2=CGAL::object_cast >(&objs[0])->first; + int1=std::get_if >(&objs[1])->first; + int2=std::get_if >(&objs[0])->first; assert ( cmp_right(typename SK::Circular_arc_3(south_polar,south_pole),typename SK::Circular_arc_3(normal2,xtrms2[0],xtrms2[1]),int1)==CGAL::LARGER ); assert ( cmp_right(typename SK::Circular_arc_3(south_polar,south_pole),typename SK::Circular_arc_3(normal2,xtrms2[0],xtrms2[1]),int2)==CGAL::SMALLER ); //polar vs polar @@ -574,15 +574,15 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher assert(CGAL::classify(spolar,ref_sphere)==CGAL::POLAR); objs.clear(); SK().intersect_3_object()(npolar,spolar,std::back_inserter(objs)); - int1=CGAL::object_cast >(&objs[1])->first; - int2=CGAL::object_cast >(&objs[0])->first; + int1=std::get_if >(&objs[1])->first; + int2=std::get_if >(&objs[0])->first; assert ( cmp_right(typename SK::Circular_arc_3(npolar,north_pole),typename SK::Circular_arc_3(spolar,south_pole),int1)==CGAL::SMALLER ); assert ( cmp_right(typename SK::Circular_arc_3(npolar,north_pole),typename SK::Circular_arc_3(spolar,south_pole),int2)==CGAL::LARGER ); //polar vs threaded objs.clear(); SK().intersect_3_object()(south_polar,threaded,std::back_inserter(objs)); - int1=CGAL::object_cast >(&objs[1])->first; - int2=CGAL::object_cast >(&objs[0])->first; + int1=std::get_if >(&objs[1])->first; + int2=std::get_if >(&objs[0])->first; assert ( cmp_right(typename SK::Circular_arc_3(south_polar,south_pole),typename SK::Circular_arc_3(threaded),int1)==CGAL::LARGER ); assert ( cmp_right(typename SK::Circular_arc_3(south_polar,south_pole),typename SK::Circular_arc_3(threaded),int2)==CGAL::SMALLER ); //threaded vs threaded @@ -590,8 +590,8 @@ test_functionalities_on_a_reference_sphere(const typename SK::Point_3& ref_spher typename SK::Circle_3 threaded2 (ref_sphere,typename SK::Plane_3(0,1.1,-0.9,-FT(1.1)*ref_sphere_center.y()+FT(0.9)*ref_sphere_center.z())); objs.clear(); SK().intersect_3_object()(threaded1,threaded2,std::back_inserter(objs)); - int1=CGAL::object_cast >(&objs[1])->first; - int2=CGAL::object_cast >(&objs[0])->first; + int1=std::get_if >(&objs[1])->first; + int2=std::get_if >(&objs[0])->first; assert ( cmp_right(typename SK::Circular_arc_3(threaded1),typename SK::Circular_arc_3(threaded2),int1)==CGAL::SMALLER ); assert ( cmp_right(typename SK::Circular_arc_3(threaded1),typename SK::Circular_arc_3(threaded2),int2)==CGAL::LARGER ); //tangency tests global diff --git a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_constructions.h b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_constructions.h index 363d4b2087b..cac9217e371 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_constructions.h +++ b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_constructions.h @@ -15,6 +15,31 @@ #include #include +#include +#include + +template +bool assign_variant(Expected& e, const V& v) +{ + if (std::get_if(&v) != nullptr) + { + e = std::get(v); + return true; + } + return false; +} + +template +bool assign_variant(Expected& e, const std::optional& ov) +{ + if (ov==std::nullopt) return false; + if (std::get_if(&(ov.value())) != nullptr) + { + e = std::get(ov.value()); + return true; + } + return false; +} template void _test_circular_arc_point_construct(SK sk) { @@ -547,7 +572,7 @@ void _test_intersection_construct(SK sk) { const FT z = FT(vz); Line_3 l1 = theConstruct_line_3(Point_3(-1,0,0), Point_3(x,y,z)); Line_3 l2 = theConstruct_line_3(Point_3(FT(-1)-FT(FT(1) / FT(1000000)),FT(0),FT(0)), Point_3(x,y,z)); - std::vector< CGAL::Object > intersection_1, intersection_2; + std::vector< std::variant< std::pair > > intersection_1, intersection_2; theIntersect_3(s, l1, std::back_inserter(intersection_1)); theIntersect_3(s, l2, std::back_inserter(intersection_2)); @@ -557,7 +582,7 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s, l1)); assert(intersection_1.size() == 1); std::pair the_pair1; - assert(assign(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair1, intersection_1[0])); assert(theHas_on_3(s,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); @@ -572,8 +597,8 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s, l1)); std::pair the_pair1; std::pair the_pair2; - assert(assign(the_pair1, intersection_1[0])); - assert(assign(the_pair2, intersection_1[1])); + assert(assign_variant(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair2, intersection_1[1])); assert(theHas_on_3(s,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); assert(theHas_on_3(s,the_pair2.first)); @@ -583,8 +608,8 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s, l2)); std::pair the_pair3; std::pair the_pair4; - assert(assign(the_pair3, intersection_2[0])); - assert(assign(the_pair4, intersection_2[1])); + assert(assign_variant(the_pair3, intersection_2[0])); + assert(assign_variant(the_pair4, intersection_2[1])); assert(theHas_on_3(s,the_pair3.first)); assert(theHas_on_3(l2,the_pair3.first)); assert(theHas_on_3(s,the_pair4.first)); @@ -604,7 +629,7 @@ void _test_intersection_construct(SK sk) { const FT z = FT(vz); Line_3 l1 = theConstruct_line_3(Point_3(-1,0,0), Point_3(x,y,z)); Line_3 l2 = theConstruct_line_3(Point_3(FT(-1)-FT(FT(1) / FT(1000000)),FT(0),FT(0)), Point_3(x,y,z)); - std::vector< CGAL::Object > intersection_1, intersection_2; + std::vector< std::variant< std::pair > > intersection_1, intersection_2; intersection(s, l1, std::back_inserter(intersection_1)); intersection(s, l2, std::back_inserter(intersection_2)); @@ -614,7 +639,7 @@ void _test_intersection_construct(SK sk) { assert(do_intersect(s, l1)); assert(intersection_1.size() == 1); std::pair the_pair1; - assert(assign(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair1, intersection_1[0])); assert(theHas_on_3(s,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); @@ -629,8 +654,8 @@ void _test_intersection_construct(SK sk) { assert(do_intersect(s, l1)); std::pair the_pair1; std::pair the_pair2; - assert(assign(the_pair1, intersection_1[0])); - assert(assign(the_pair2, intersection_1[1])); + assert(assign_variant(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair2, intersection_1[1])); assert(theHas_on_3(s,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); assert(theHas_on_3(s,the_pair2.first)); @@ -640,8 +665,8 @@ void _test_intersection_construct(SK sk) { assert(do_intersect(s, l2)); std::pair the_pair3; std::pair the_pair4; - assert(assign(the_pair3, intersection_2[0])); - assert(assign(the_pair4, intersection_2[1])); + assert(assign_variant(the_pair3, intersection_2[0])); + assert(assign_variant(the_pair4, intersection_2[1])); assert(theHas_on_3(s,the_pair3.first)); assert(theHas_on_3(l2,the_pair3.first)); assert(theHas_on_3(s,the_pair4.first)); @@ -665,20 +690,20 @@ void _test_intersection_construct(SK sk) { const FT r = 4*FT(vr) / FT(2); Sphere_3 sl = theConstruct_sphere_3( Polynomial_for_spheres_2_3(x,y,z,r*r)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant > > intersection_1; + std::vector< std::variant > > intersection_2; theIntersect_3(s1, s2, sl, std::back_inserter(intersection_1)); theIntersect_3(s1, s3, sl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(theDo_intersect_3(s1, s2, sl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s2,circle)); assert(theHas_on_3(sl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { // This case must never happen assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s2,cap.first)); @@ -688,8 +713,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(theDo_intersect_3(s1, s2, sl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s2,cap1.first)); assert(theHas_on_3(sl,cap1.first)); @@ -702,13 +727,13 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s1, s3, sl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { // This case must never happen assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s3,circle)); assert(theHas_on_3(sl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s3,cap.first)); assert(theHas_on_3(sl,cap.first)); @@ -718,8 +743,8 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s1, s3, sl)); // This case must never happen std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s3,cap1.first)); assert(theHas_on_3(sl,cap1.first)); @@ -743,20 +768,20 @@ void _test_intersection_construct(SK sk) { const FT r = 4*FT(vr) / FT(2); Sphere_3 sl = theConstruct_sphere_3( Polynomial_for_spheres_2_3(x,y,z,r*r)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3, Sphere_3> > intersection_1; + std::vector< std::variant , Circle_3, Sphere_3> > intersection_2; intersection(s1, s2, sl, std::back_inserter(intersection_1)); intersection(s1, s3, sl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(CGAL::do_intersect(s1, s2, sl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s2,circle)); assert(theHas_on_3(sl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { // This case must never happen assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s2,cap.first)); @@ -766,8 +791,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(CGAL::do_intersect(s1, s2, sl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s2,cap1.first)); assert(theHas_on_3(sl,cap1.first)); @@ -780,13 +805,13 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(s1, s3, sl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { // This case must never happen assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s3,circle)); assert(theHas_on_3(sl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s3,cap.first)); assert(theHas_on_3(sl,cap.first)); @@ -796,8 +821,8 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(s1, s3, sl)); // This case must never happen std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s3,cap1.first)); assert(theHas_on_3(sl,cap1.first)); @@ -823,20 +848,20 @@ void _test_intersection_construct(SK sk) { if(a == 0 && b == 0 && c == 0) continue; Plane_3 pl = theConstruct_plane_3( Polynomial_1_3(a,b,c,d)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_1; + std::vector< std::variant , Circle_3> > intersection_2; theIntersect_3(s1, s2, pl, std::back_inserter(intersection_1)); theIntersect_3(s1, s3, pl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(theDo_intersect_3(s1, s2, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s2,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s2,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -845,8 +870,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(theDo_intersect_3(s1, s2, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s2,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -858,12 +883,12 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s1, s3, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s3,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s3,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -872,8 +897,8 @@ void _test_intersection_construct(SK sk) { if(intersection_2.size() == 2) { assert(theDo_intersect_3(s1, s3, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s3,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -898,20 +923,20 @@ void _test_intersection_construct(SK sk) { if(a == 0 && b == 0 && c == 0) continue; Plane_3 pl = theConstruct_plane_3( Polynomial_1_3(a,b,c,d)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_1; + std::vector< std::variant , Circle_3> > intersection_2; intersection(s1, s2, pl, std::back_inserter(intersection_1)); intersection(s1, s3, pl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(CGAL::do_intersect(s1, s2, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s2,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s2,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -920,8 +945,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(CGAL::do_intersect(s1, s2, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s2,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -933,12 +958,12 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(s1, s3, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(s3,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(s3,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -947,8 +972,8 @@ void _test_intersection_construct(SK sk) { if(intersection_2.size() == 2) { assert(CGAL::do_intersect(s1, s3, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(s3,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -976,20 +1001,20 @@ void _test_intersection_construct(SK sk) { if(a == 0 && b == 0 && c == 0) continue; Plane_3 pl = theConstruct_plane_3( Polynomial_1_3(a,b,c,d)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_1; + std::vector< std::variant , Circle_3> > intersection_2; theIntersect_3(s1, p1, pl, std::back_inserter(intersection_1)); theIntersect_3(s1, p2, pl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(theDo_intersect_3(s1, p1, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(p1,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(p1,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -998,8 +1023,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(theDo_intersect_3(s1, p1, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(p1,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -1011,12 +1036,12 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(s1, p2, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(p2,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(p2,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -1025,8 +1050,8 @@ void _test_intersection_construct(SK sk) { if(intersection_2.size() == 2) { assert(theDo_intersect_3(s1, p2, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(p2,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -1051,20 +1076,20 @@ void _test_intersection_construct(SK sk) { if(a == 0 && b == 0 && c == 0) continue; Plane_3 pl = theConstruct_plane_3( Polynomial_1_3(a,b,c,d)); - std::vector< CGAL::Object > intersection_1; - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_1; + std::vector< std::variant , Circle_3> > intersection_2; intersection(s1, p1, pl, std::back_inserter(intersection_1)); intersection(s1, p2, pl, std::back_inserter(intersection_2)); if(intersection_1.size() == 1) { assert(CGAL::do_intersect(s1, p1, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_1[0])) { + if(assign_variant(circle,intersection_1[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(p1,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_1[0])) { + if(assign_variant(cap,intersection_1[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(p1,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -1073,8 +1098,8 @@ void _test_intersection_construct(SK sk) { if(intersection_1.size() == 2) { assert(CGAL::do_intersect(s1, p1, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_1[0])); - assert(assign(cap2,intersection_1[1])); + assert(assign_variant(cap1,intersection_1[0])); + assert(assign_variant(cap2,intersection_1[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(p1,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -1086,12 +1111,12 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(s1, p2, pl)); Circle_3 circle; std::pair cap; - if(assign(circle,intersection_2[0])) { + if(assign_variant(circle,intersection_2[0])) { assert(theHas_on_3(s1,circle)); assert(theHas_on_3(p2,circle)); assert(theHas_on_3(pl,circle)); } - if(assign(cap,intersection_2[0])) { + if(assign_variant(cap,intersection_2[0])) { assert(theHas_on_3(s1,cap.first)); assert(theHas_on_3(p2,cap.first)); assert(theHas_on_3(pl,cap.first)); @@ -1100,8 +1125,8 @@ void _test_intersection_construct(SK sk) { if(intersection_2.size() == 2) { assert(CGAL::do_intersect(s1, p2, pl)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(s1,cap1.first)); assert(theHas_on_3(p2,cap1.first)); assert(theHas_on_3(pl,cap1.first)); @@ -1134,27 +1159,27 @@ void _test_intersection_construct(SK sk) { Circle_3 c2 = theConstruct_circle_3(std::make_pair(es2, pol)); Circle_3 c3 = theConstruct_circle_3(std::make_pair(es3, pol)); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant , Circle_3> > intersection_1; theIntersect_3(c1, c1, std::back_inserter(intersection_1)); assert(intersection_1.size() == 1); assert(theDo_intersect_3(c1, c1)); Circle_3 circle; - assert(assign(circle,intersection_1[0])); + assert(assign_variant(circle,intersection_1[0])); assert(circle == c1); - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_2; theIntersect_3(c1, c2, std::back_inserter(intersection_2)); assert(intersection_2.size() == 2); assert(theDo_intersect_3(c1, c2)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c2,cap1.first)); assert(theHas_on_3(c1,cap2.first)); assert(theHas_on_3(c2,cap2.first)); - std::vector< CGAL::Object > intersection_3; + std::vector< std::variant , Circle_3> > intersection_3; theIntersect_3(c1, c3, std::back_inserter(intersection_3)); if(a != 0) { assert(!theDo_intersect_3(c1, c3)); @@ -1163,7 +1188,7 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(c1, c3)); assert(intersection_3.size() == 1); std::pair cap; - assert(assign(cap,intersection_3[0])); + assert(assign_variant(cap,intersection_3[0])); assert(theHas_on_3(c1,cap.first)); assert(theHas_on_3(c3,cap.first)); } @@ -1175,12 +1200,12 @@ void _test_intersection_construct(SK sk) { const FT dl = 0; Polynomial_1_3 pol2 = Polynomial_1_3(al,bl,cl,dl); Circle_3 c4 = theConstruct_circle_3(std::make_pair(es1, pol2)); - std::vector< CGAL::Object > intersection_4; + std::vector< std::variant , Circle_3> > intersection_4; theIntersect_3(c1, c4, std::back_inserter(intersection_4)); assert(theDo_intersect_3(c1, c4)); assert(intersection_4.size() == 2); - assert(assign(cap1,intersection_4[0])); - assert(assign(cap2,intersection_4[1])); + assert(assign_variant(cap1,intersection_4[0])); + assert(assign_variant(cap2,intersection_4[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c4,cap1.first)); assert(theHas_on_3(c1,cap2.first)); @@ -1193,12 +1218,12 @@ void _test_intersection_construct(SK sk) { const FT d_c = -FT(va) / FT(10); Polynomial_1_3 pol2 = Polynomial_1_3(a_c,b_c,c_c,d_c); Circle_3 c5 = theConstruct_circle_3(std::make_pair(es2, pol2)); - std::vector< CGAL::Object > intersection_5; + std::vector< std::variant , Circle_3> > intersection_5; theIntersect_3(c1, c5, std::back_inserter(intersection_5)); assert(theDo_intersect_3(c1, c5)); assert(intersection_5.size() == 2); - assert(assign(cap1,intersection_5[0])); - assert(assign(cap2,intersection_5[1])); + assert(assign_variant(cap1,intersection_5[0])); + assert(assign_variant(cap2,intersection_5[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c5,cap1.first)); assert(theHas_on_3(c1,cap2.first)); @@ -1217,27 +1242,27 @@ void _test_intersection_construct(SK sk) { Circle_3 c2 = theConstruct_circle_3(std::make_pair(es2, pol)); Circle_3 c3 = theConstruct_circle_3(std::make_pair(es3, pol)); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant , Circle_3> > intersection_1; intersection(c1, c1, std::back_inserter(intersection_1)); assert(intersection_1.size() == 1); assert(CGAL::do_intersect(c1, c1)); Circle_3 circle; - assert(assign(circle,intersection_1[0])); + assert(assign_variant(circle,intersection_1[0])); assert(circle == c1); - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant , Circle_3> > intersection_2; intersection(c1, c2, std::back_inserter(intersection_2)); assert(intersection_2.size() == 2); assert(CGAL::do_intersect(c1, c2)); std::pair cap1, cap2; - assert(assign(cap1,intersection_2[0])); - assert(assign(cap2,intersection_2[1])); + assert(assign_variant(cap1,intersection_2[0])); + assert(assign_variant(cap2,intersection_2[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c2,cap1.first)); assert(theHas_on_3(c1,cap2.first)); assert(theHas_on_3(c2,cap2.first)); - std::vector< CGAL::Object > intersection_3; + std::vector< std::variant , Circle_3> > intersection_3; intersection(c1, c3, std::back_inserter(intersection_3)); if(a != 0) { assert(!do_intersect(c1, c3)); @@ -1246,7 +1271,7 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(c1, c3)); assert(intersection_3.size() == 1); std::pair cap; - assert(assign(cap,intersection_3[0])); + assert(assign_variant(cap,intersection_3[0])); assert(theHas_on_3(c1,cap.first)); assert(theHas_on_3(c3,cap.first)); } @@ -1258,12 +1283,12 @@ void _test_intersection_construct(SK sk) { const FT dl = 0; Polynomial_1_3 pol2 = Polynomial_1_3(al,bl,cl,dl); Circle_3 c4 = theConstruct_circle_3(std::make_pair(es1, pol2)); - std::vector< CGAL::Object > intersection_4; + std::vector< std::variant , Circle_3> > intersection_4; intersection(c1, c4, std::back_inserter(intersection_4)); assert(CGAL::do_intersect(c1, c4)); assert(intersection_4.size() == 2); - assert(assign(cap1,intersection_4[0])); - assert(assign(cap2,intersection_4[1])); + assert(assign_variant(cap1,intersection_4[0])); + assert(assign_variant(cap2,intersection_4[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c4,cap1.first)); assert(theHas_on_3(c1,cap2.first)); @@ -1276,12 +1301,12 @@ void _test_intersection_construct(SK sk) { const FT d_c = -FT(va) / FT(10); Polynomial_1_3 pol2 = Polynomial_1_3(a_c,b_c,c_c,d_c); Circle_3 c5 = theConstruct_circle_3(std::make_pair(es2, pol2)); - std::vector< CGAL::Object > intersection_5; + std::vector< std::variant , Circle_3> > intersection_5; intersection(c1, c5, std::back_inserter(intersection_5)); assert(CGAL::do_intersect(c1, c5)); assert(intersection_5.size() == 2); - assert(assign(cap1,intersection_5[0])); - assert(assign(cap2,intersection_5[1])); + assert(assign_variant(cap1,intersection_5[0])); + assert(assign_variant(cap2,intersection_5[1])); assert(theHas_on_3(c1,cap1.first)); assert(theHas_on_3(c5,cap1.first)); assert(theHas_on_3(c1,cap2.first)); @@ -1310,7 +1335,7 @@ void _test_intersection_construct(SK sk) { Circle_3 c1 = theConstruct_circle_3(std::make_pair(pol_s, pol_pl1)); Circle_3 c2 = theConstruct_circle_3(std::make_pair(pol_s, pol_pl2)); - std::vector< CGAL::Object > intersection_1, intersection_2; + std::vector< std::variant > > intersection_1, intersection_2; theIntersect_3(c1, l1, std::back_inserter(intersection_1)); theIntersect_3(c2, l2, std::back_inserter(intersection_2)); @@ -1320,7 +1345,7 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(c1, l1)); assert(intersection_1.size() == 1); std::pair the_pair1; - assert(assign(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair1, intersection_1[0])); assert(theHas_on_3(c1,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); @@ -1336,8 +1361,8 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(c1, l1)); std::pair the_pair1; std::pair the_pair2; - assert(assign(the_pair1, intersection_1[0])); - assert(assign(the_pair2, intersection_1[1])); + assert(assign_variant(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair2, intersection_1[1])); assert(theHas_on_3(c1,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); assert(theHas_on_3(c1,the_pair2.first)); @@ -1347,8 +1372,8 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(c2, l2)); std::pair the_pair3; std::pair the_pair4; - assert(assign(the_pair3, intersection_2[0])); - assert(assign(the_pair4, intersection_2[1])); + assert(assign_variant(the_pair3, intersection_2[0])); + assert(assign_variant(the_pair4, intersection_2[1])); assert(theHas_on_3(c2,the_pair3.first)); assert(theHas_on_3(l2,the_pair3.first)); assert(theHas_on_3(c2,the_pair4.first)); @@ -1378,7 +1403,7 @@ void _test_intersection_construct(SK sk) { Circle_3 c1 = theConstruct_circle_3(std::make_pair(pol_s, pol_pl1)); Circle_3 c2 = theConstruct_circle_3(std::make_pair(pol_s, pol_pl2)); - std::vector< CGAL::Object > intersection_1, intersection_2; + std::vector< std::variant > > intersection_1, intersection_2; intersection(c1, l1, std::back_inserter(intersection_1)); intersection(c2, l2, std::back_inserter(intersection_2)); @@ -1388,7 +1413,7 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(c1, l1)); assert(intersection_1.size() == 1); std::pair the_pair1; - assert(assign(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair1, intersection_1[0])); assert(theHas_on_3(c1,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); @@ -1404,8 +1429,8 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(c1, l1)); std::pair the_pair1; std::pair the_pair2; - assert(assign(the_pair1, intersection_1[0])); - assert(assign(the_pair2, intersection_1[1])); + assert(assign_variant(the_pair1, intersection_1[0])); + assert(assign_variant(the_pair2, intersection_1[1])); assert(theHas_on_3(c1,the_pair1.first)); assert(theHas_on_3(l1,the_pair1.first)); assert(theHas_on_3(c1,the_pair2.first)); @@ -1415,8 +1440,8 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(c2, l2)); std::pair the_pair3; std::pair the_pair4; - assert(assign(the_pair3, intersection_2[0])); - assert(assign(the_pair4, intersection_2[1])); + assert(assign_variant(the_pair3, intersection_2[0])); + assert(assign_variant(the_pair4, intersection_2[1])); assert(theHas_on_3(c2,the_pair3.first)); assert(theHas_on_3(l2,the_pair3.first)); assert(theHas_on_3(c2,the_pair4.first)); @@ -1444,13 +1469,13 @@ void _test_intersection_construct(SK sk) { for(int t4=t3+1;t4<3;t4++) { Point_3 targetl = Point_3(a*t4,b*t4,c*t4); Line_arc_3 lb = theConstruct_line_arc_3(l,sourcel,targetl); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; theIntersect_3(la, lb, std::back_inserter(intersection_1)); if(t1 == t3) { Line_arc_3 line_a; assert(theDo_intersect_3(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t2 <= t4) { assert(theEqual_3(line_a, la)); } else { @@ -1460,7 +1485,7 @@ void _test_intersection_construct(SK sk) { Line_arc_3 line_a; assert(theDo_intersect_3(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t1 > t3) { assert(theEqual_3(line_a, la)); } else { @@ -1471,14 +1496,14 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(la, lb)); std::pair pair; assert(intersection_1.size() == 1); - assert(assign(pair, intersection_1[0])); + assert(assign_variant(pair, intersection_1[0])); if(t2 == t3) assert(theEqual_3(pair.first,target)); if(t1 == t4) assert(theEqual_3(pair.first,source)); } else if((t1 < t3) && (t3 < t2 )) { Line_arc_3 line_a; assert(theDo_intersect_3(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t2 < t4) { Line_arc_3 line_b; line_b = theConstruct_line_arc_3(l,sourcel,target); @@ -1490,7 +1515,7 @@ void _test_intersection_construct(SK sk) { Line_arc_3 line_a; assert(intersection_1.size() == 1); assert(theDo_intersect_3(la, lb)); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t4 < t2) { Line_arc_3 line_b; line_b = theConstruct_line_arc_3(l,source,targetl); @@ -1562,7 +1587,7 @@ void _test_intersection_construct(SK sk) { int n_of_intersection = 0; for(int j=0;j<6;j++) { if(i == j) continue; - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; theIntersect_3(l[i], l[j], std::back_inserter(intersection_1)); assert((intersection_1.size() == 0) || (intersection_1.size() == 1)); @@ -1570,7 +1595,7 @@ void _test_intersection_construct(SK sk) { assert(theDo_intersect_3(l[i], l[j])); n_of_intersection++; std::pair pair; - assert(assign(pair, intersection_1[0])); + assert(assign_variant(pair, intersection_1[0])); assert(theHas_on_3(l[i],pair.first)); assert(theHas_on_3(l[j],pair.first)); int n_of_edges = 2; @@ -1611,13 +1636,13 @@ void _test_intersection_construct(SK sk) { for(int t4=t3+1;t4<3;t4++) { Point_3 targetl = Point_3(a*t4,b*t4,c*t4); Line_arc_3 lb = theConstruct_line_arc_3(l,sourcel,targetl); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; intersection(la, lb, std::back_inserter(intersection_1)); if(t1 == t3) { Line_arc_3 line_a; assert(CGAL::do_intersect(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t2 <= t4) { assert(theEqual_3(line_a, la)); } else { @@ -1627,7 +1652,7 @@ void _test_intersection_construct(SK sk) { Line_arc_3 line_a; assert(CGAL::do_intersect(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t1 > t3) { assert(theEqual_3(line_a, la)); } else { @@ -1638,14 +1663,14 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(la, lb)); std::pair pair; assert(intersection_1.size() == 1); - assert(assign(pair, intersection_1[0])); + assert(assign_variant(pair, intersection_1[0])); if(t2 == t3) assert(theEqual_3(pair.first,target)); if(t1 == t4) assert(theEqual_3(pair.first,source)); } else if((t1 < t3) && (t3 < t2 )) { Line_arc_3 line_a; assert(CGAL::do_intersect(la, lb)); assert(intersection_1.size() == 1); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t2 < t4) { Line_arc_3 line_b; line_b = theConstruct_line_arc_3(l,sourcel,target); @@ -1657,7 +1682,7 @@ void _test_intersection_construct(SK sk) { Line_arc_3 line_a; assert(intersection_1.size() == 1); assert(CGAL::do_intersect(la, lb)); - assert(assign(line_a, intersection_1[0])); + assert(assign_variant(line_a, intersection_1[0])); if(t4 < t2) { Line_arc_3 line_b; line_b = theConstruct_line_arc_3(l,source,targetl); @@ -1729,7 +1754,7 @@ void _test_intersection_construct(SK sk) { int n_of_intersection = 0; for(int j=0;j<6;j++) { if(i == j) continue; - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; intersection(l[i], l[j], std::back_inserter(intersection_1)); assert((intersection_1.size() == 0) || (intersection_1.size() == 1)); @@ -1737,7 +1762,7 @@ void _test_intersection_construct(SK sk) { assert(CGAL::do_intersect(l[i], l[j])); n_of_intersection++; std::pair pair; - assert(assign(pair, intersection_1[0])); + assert(assign_variant(pair, intersection_1[0])); assert(theHas_on_3(l[i],pair.first)); assert(theHas_on_3(l[j],pair.first)); int n_of_edges = 2; @@ -1801,7 +1826,7 @@ void _test_intersection_construct(SK sk) { for(int t2=0;t2<8;t2++) { if(t1 == t2) continue; Circular_arc_3 cb = theConstruct_circular_arc_3(cc,cp[t1],cp[t2]); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; theIntersect_3(ca, cb, std::back_inserter(intersection_1)); Circular_arc_3 cres, cres2; std::pair< Circular_arc_point_3, unsigned > cp1, cp2; @@ -1809,37 +1834,37 @@ void _test_intersection_construct(SK sk) { if(t2 == j) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca,cres)); } else if(simulate_has_on(i,j,t2)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } } else if(t2 == j) { if(simulate_has_on(i,j,t1)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } } else if(t1 == j) { if(t2 == i) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cp1,intersection_1[0])); - assert(assign(cp2,intersection_1[1])); + assert(assign_variant(cp1,intersection_1[0])); + assert(assign_variant(cp2,intersection_1[1])); assert(theEqual_3(cp1.first, cp[i]) || theEqual_3(cp1.first, cp[j])); assert(theEqual_3(cp2.first, cp[i]) || @@ -1848,13 +1873,13 @@ void _test_intersection_construct(SK sk) { } else if(simulate_has_on(t1,i,t2)) { assert(intersection_1.size() == 1); assert(theDo_intersect_3(ca, cb)); - assert(assign(cp1,intersection_1[0])); + assert(assign_variant(cp1,intersection_1[0])); assert(theEqual_3(cp1.first, cp[t1])); } else { assert(intersection_1.size() == 2); assert(theDo_intersect_3(ca, cb)); - if(assign(cp1,intersection_1[0]) && assign(cres,intersection_1[1])); - else if(assign(cres,intersection_1[0]) && assign(cp1,intersection_1[1])); + if(assign_variant(cp1,intersection_1[0]) && assign_variant(cres,intersection_1[1])); + else if(assign_variant(cres,intersection_1[0]) && assign_variant(cp1,intersection_1[1])); else assert(false); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert(theEqual_3(conf, cres)); @@ -1864,8 +1889,8 @@ void _test_intersection_construct(SK sk) { if(t1 == j) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cp1,intersection_1[0])); - assert(assign(cp2,intersection_1[1])); + assert(assign_variant(cp1,intersection_1[0])); + assert(assign_variant(cp2,intersection_1[1])); assert(theEqual_3(cp1.first, cp[i]) || theEqual_3(cp1.first, cp[j])); assert(theEqual_3(cp2.first, cp[i]) || @@ -1874,13 +1899,13 @@ void _test_intersection_construct(SK sk) { } else if(simulate_has_on(j,i,t1)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cp1,intersection_1[0])); + assert(assign_variant(cp1,intersection_1[0])); assert(theEqual_3(cp1.first, cp[i])); } else { assert(intersection_1.size() == 2); assert(theDo_intersect_3(ca, cb)); - if(assign(cp1,intersection_1[0]) && assign(cres,intersection_1[1])); - else if(assign(cres,intersection_1[0]) && assign(cp1,intersection_1[1])); + if(assign_variant(cp1,intersection_1[0]) && assign_variant(cres,intersection_1[1])); + else if(assign_variant(cres,intersection_1[0]) && assign_variant(cp1,intersection_1[1])); else assert(false); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); assert(theEqual_3(conf, cres)); @@ -1890,19 +1915,19 @@ void _test_intersection_construct(SK sk) { if(simulate_has_on(t1,j,t2)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else if(simulate_has_on(t2,j,i)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); assert(theEqual_3(cres, conf)); } else { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cres,intersection_1[0])); - assert(assign(cres2,intersection_1[1])); + assert(assign_variant(cres,intersection_1[0])); + assert(assign_variant(cres2,intersection_1[1])); Circular_arc_3 conf1 = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); Circular_arc_3 conf2 = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert((theEqual_3(cres, conf1) && theEqual_3(cres2, conf2)) || @@ -1912,20 +1937,20 @@ void _test_intersection_construct(SK sk) { if(simulate_has_on(i,t2,t1)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else if(simulate_has_on(j,i,t1)) { assert(theDo_intersect_3(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert(theEqual_3(cres, conf)); } else { // This case should never happen, because it already happen before assert(intersection_1.size() == 2); assert(theDo_intersect_3(ca, cb)); - assert(assign(cres,intersection_1[0])); - assert(assign(cres2,intersection_1[1])); + assert(assign_variant(cres,intersection_1[0])); + assert(assign_variant(cres2,intersection_1[1])); Circular_arc_3 conf1 = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); Circular_arc_3 conf2 = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert((theEqual_3(cres, conf1) && theEqual_3(cres2, conf2)) || @@ -1935,7 +1960,7 @@ void _test_intersection_construct(SK sk) { // the case whether (i,j) contains (t1,t2) is handled before assert(intersection_1.size() == 1); assert(theDo_intersect_3(ca, cb)); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } else { assert(intersection_1.size() == 0); @@ -1956,7 +1981,7 @@ void _test_intersection_construct(SK sk) { for(int t2=0;t2<8;t2++) { if(t1 == t2) continue; Circular_arc_3 cb = theConstruct_circular_arc_3(cc,cp[t1],cp[t2]); - std::vector< CGAL::Object > intersection_1; + std::vector< std::variant > > intersection_1; intersection(ca, cb, std::back_inserter(intersection_1)); Circular_arc_3 cres, cres2; std::pair< Circular_arc_point_3, unsigned > cp1, cp2; @@ -1964,37 +1989,37 @@ void _test_intersection_construct(SK sk) { if(t2 == j) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca,cres)); } else if(simulate_has_on(i,j,t2)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } } else if(t2 == j) { if(simulate_has_on(i,j,t1)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } } else if(t1 == j) { if(t2 == i) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cp1,intersection_1[0])); - assert(assign(cp2,intersection_1[1])); + assert(assign_variant(cp1,intersection_1[0])); + assert(assign_variant(cp2,intersection_1[1])); assert(theEqual_3(cp1.first, cp[i]) || theEqual_3(cp1.first, cp[j])); assert(theEqual_3(cp2.first, cp[i]) || @@ -2003,13 +2028,13 @@ void _test_intersection_construct(SK sk) { } else if(simulate_has_on(t1,i,t2)) { assert(intersection_1.size() == 1); assert(CGAL::do_intersect(ca, cb)); - assert(assign(cp1,intersection_1[0])); + assert(assign_variant(cp1,intersection_1[0])); assert(theEqual_3(cp1.first, cp[t1])); } else { assert(intersection_1.size() == 2); assert(CGAL::do_intersect(ca, cb)); - if(assign(cp1,intersection_1[0]) && assign(cres,intersection_1[1])); - else if(assign(cres,intersection_1[0]) && assign(cp1,intersection_1[1])); + if(assign_variant(cp1,intersection_1[0]) && assign_variant(cres,intersection_1[1])); + else if(assign_variant(cres,intersection_1[0]) && assign_variant(cp1,intersection_1[1])); else assert(false); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert(theEqual_3(conf, cres)); @@ -2019,8 +2044,8 @@ void _test_intersection_construct(SK sk) { if(t1 == j) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cp1,intersection_1[0])); - assert(assign(cp2,intersection_1[1])); + assert(assign_variant(cp1,intersection_1[0])); + assert(assign_variant(cp2,intersection_1[1])); assert(theEqual_3(cp1.first, cp[i]) || theEqual_3(cp1.first, cp[j])); assert(theEqual_3(cp2.first, cp[i]) || @@ -2029,13 +2054,13 @@ void _test_intersection_construct(SK sk) { } else if(simulate_has_on(j,i,t1)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cp1,intersection_1[0])); + assert(assign_variant(cp1,intersection_1[0])); assert(theEqual_3(cp1.first, cp[i])); } else { assert(intersection_1.size() == 2); assert(CGAL::do_intersect(ca, cb)); - if(assign(cp1,intersection_1[0]) && assign(cres,intersection_1[1])); - else if(assign(cres,intersection_1[0]) && assign(cp1,intersection_1[1])); + if(assign_variant(cp1,intersection_1[0]) && assign_variant(cres,intersection_1[1])); + else if(assign_variant(cres,intersection_1[0]) && assign_variant(cp1,intersection_1[1])); else assert(false); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); assert(theEqual_3(conf, cres)); @@ -2045,19 +2070,19 @@ void _test_intersection_construct(SK sk) { if(simulate_has_on(t1,j,t2)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else if(simulate_has_on(t2,j,i)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); assert(theEqual_3(cres, conf)); } else { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 2); - assert(assign(cres,intersection_1[0])); - assert(assign(cres2,intersection_1[1])); + assert(assign_variant(cres,intersection_1[0])); + assert(assign_variant(cres2,intersection_1[1])); Circular_arc_3 conf1 = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); Circular_arc_3 conf2 = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert((theEqual_3(cres, conf1) && theEqual_3(cres2, conf2)) || @@ -2067,20 +2092,20 @@ void _test_intersection_construct(SK sk) { if(simulate_has_on(i,t2,t1)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(cb, cres)); } else if(simulate_has_on(j,i,t1)) { assert(CGAL::do_intersect(ca, cb)); assert(intersection_1.size() == 1); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); Circular_arc_3 conf = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert(theEqual_3(cres, conf)); } else { // This case should never happen, because it already happen before assert(intersection_1.size() == 2); assert(CGAL::do_intersect(ca, cb)); - assert(assign(cres,intersection_1[0])); - assert(assign(cres2,intersection_1[1])); + assert(assign_variant(cres,intersection_1[0])); + assert(assign_variant(cres2,intersection_1[1])); Circular_arc_3 conf1 = theConstruct_circular_arc_3(cc,cp[t1],cp[j]); Circular_arc_3 conf2 = theConstruct_circular_arc_3(cc,cp[i],cp[t2]); assert((theEqual_3(cres, conf1) && theEqual_3(cres2, conf2)) || @@ -2090,7 +2115,7 @@ void _test_intersection_construct(SK sk) { // the case whether (i,j) contains (t1,t2) is handled before assert(intersection_1.size() == 1); assert(CGAL::do_intersect(ca, cb)); - assert(assign(cres,intersection_1[0])); + assert(assign_variant(cres,intersection_1[0])); assert(theEqual_3(ca, cres)); } else { assert(intersection_1.size() == 0); @@ -2280,11 +2305,11 @@ void _test_bounding_box_construct(SK sk) Circle_3 c1 = theConstruct_circle_3(std::make_pair(es1, pol)); Circle_3 c2 = theConstruct_circle_3(std::make_pair(es2, pol)); - std::vector< CGAL::Object > intersection_2; + std::vector< std::variant > > intersection_2; theIntersect_3(c1, c2, std::back_inserter(intersection_2)); std::pair cap1, cap2; - assign(cap1,intersection_2[0]); - assign(cap2,intersection_2[1]); + assign_variant(cap1,intersection_2[0]); + assign_variant(cap2,intersection_2[1]); _test_bbox(cap1.first); _test_bbox(cap2.first); @@ -2295,10 +2320,10 @@ void _test_bounding_box_construct(SK sk) const FT dl = 0; Polynomial_1_3 pol2 = Polynomial_1_3(al,bl,cl,dl); Circle_3 c4 = theConstruct_circle_3(std::make_pair(es1, pol2)); - std::vector< CGAL::Object > intersection_4; + std::vector< std::variant > > intersection_4; theIntersect_3(c1, c4, std::back_inserter(intersection_4)); - assign(cap1,intersection_4[0]); - assign(cap2,intersection_4[1]); + assign_variant(cap1,intersection_4[0]); + assign_variant(cap2,intersection_4[1]); _test_bbox(cap1.first); _test_bbox(cap2.first); } @@ -2309,10 +2334,10 @@ void _test_bounding_box_construct(SK sk) const FT d_c = -FT(va) / FT(10); Polynomial_1_3 pol2 = Polynomial_1_3(a_c,b_c,c_c,d_c); Circle_3 c5 = theConstruct_circle_3(std::make_pair(es2, pol2)); - std::vector< CGAL::Object > intersection_5; + std::vector< std::variant > > intersection_5; theIntersect_3(c1, c5, std::back_inserter(intersection_5)); - assign(cap1,intersection_5[0]); - assign(cap2,intersection_5[1]); + assign_variant(cap1,intersection_5[0]); + assign_variant(cap2,intersection_5[1]); _test_bbox(cap1.first); _test_bbox(cap2.first); } @@ -2334,15 +2359,15 @@ void _test_bounding_box_construct(SK sk) Sphere_3 sl_2 = theConstruct_sphere_3( Polynomial_for_spheres_2_3(x+10,y+10,z+10,r*r)); int d2 = (vx*vx + vy*vy + vz*vz); - CGAL::Object intersection_1 = theIntersect_3(s, sl_1); - CGAL::Object intersection_2 = theIntersect_3(s_t10, sl_2); + std::optional> intersection_1 = theIntersect_3(s, sl_1); + std::optional> intersection_2 = theIntersect_3(s_t10, sl_2); // No intersection if((d2 > (r+1)*(r+1)) || (d2 < (r-1)*(r-1))) continue; if(x == 0 && y == 0 && z == 0) continue; if((d2 == (r+1)*(r+1)) || (d2 == (r-1)*(r-1))) continue; Circle_3 circle1, circle2; - assign(circle1, intersection_1); - assign(circle2, intersection_2); + assign_variant(circle1, intersection_1); + assign_variant(circle2, intersection_2); _test_bbox(circle1); _test_bbox(circle2); } diff --git a/Circulator/doc/Circulator/CGAL/circulator.h b/Circulator/doc/Circulator/CGAL/circulator.h index 7bfeae56805..2973413afd0 100644 --- a/Circulator/doc/Circulator/CGAL/circulator.h +++ b/Circulator/doc/Circulator/CGAL/circulator.h @@ -246,7 +246,7 @@ Circulator_from_iterator(); /*! a circulator `c` initialized to refer to the element `*cur` in a range `[begin, end)`. -The circulator `c` refers to a empty sequence +The circulator `c` refers to an empty sequence if `begin==end`. */ @@ -255,7 +255,7 @@ const I& end, const I& cur = begin); /*! a copy of circulator `d` referring to the element `*cur`. -The circulator `c` refers to a empty sequence +The circulator `c` refers to an empty sequence if `d` does so. */ diff --git a/Circulator/include/CGAL/Circulator/Safe_circulator_from_iterator.h b/Circulator/include/CGAL/Circulator/Safe_circulator_from_iterator.h index 17b05f8cffb..f1642bce862 100644 --- a/Circulator/include/CGAL/Circulator/Safe_circulator_from_iterator.h +++ b/Circulator/include/CGAL/Circulator/Safe_circulator_from_iterator.h @@ -22,7 +22,7 @@ #include -#include +#include #include @@ -53,9 +53,9 @@ public: private: - boost::optional m_begin; - boost::optional m_end; - boost::optional m_current; + std::optional m_begin; + std::optional m_end; + std::optional m_current; bool m_empty; public: diff --git a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp index c20b9b7155f..6d2ebb01acf 100644 --- a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp +++ b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp @@ -45,7 +45,7 @@ #include #endif #include -#include +#include #include #include #include diff --git a/Classification/include/CGAL/Classification/Feature/Gradient_of_feature.h b/Classification/include/CGAL/Classification/Feature/Gradient_of_feature.h index 85d703c5ed1..d87ee8f2830 100644 --- a/Classification/include/CGAL/Classification/Feature/Gradient_of_feature.h +++ b/Classification/include/CGAL/Classification/Feature/Gradient_of_feature.h @@ -37,7 +37,7 @@ class Gradient_of_feature : public Feature_base const InputRange& m_input; ItemMap m_map; Feature_handle m_feature; - boost::shared_ptr m_query; + std::shared_ptr m_query; public: /*! diff --git a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt index ed3c60b63b5..2867dc1c2f7 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt +++ b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt @@ -168,7 +168,7 @@ Considering these different advantages and drawbacks, you can choose to use gene The diagram in \cgalFigureRef{fig_cmap_diagramme_class} shows the different classes of the package. `Combinatorial_map` is the main class (see Section \ref sseccombinatorialmap "Combinatorial Maps"). It allows to manage darts and attributes (see Section \ref ssecattributes "Cell Attributes"). Users can customize a combinatorial map thanks to an items class (see Section \ref ssecitem "Combinatorial Map Items"), which defines the information associated with darts and the attribute types. These types may be different for different dimensions, and they may also be void (note that the main concepts of `GenericMap`, `GenericMapItems` and `CellAttribute` are shared between combinatorial maps and generalized maps). -The darts and attributes are accessed through descriptors (either Indices or Handles). A handle is a model of the `Handle` concept, thus supporting the two dereference operators `operator*` and `operator->`. All handles are model of `LessThanComparable` and `Hashable`, that is they can be used as keys in containers such as `std::map` and `std::unordered_map`. An index is a model of the `Index` concept, which is mainly an integer which is convertible from and to std::size_t. Indices can be used as index into vectors which store properties (cf. one example in Section \ref ssecexample3DCMWI "3D Combinatorial Map using Indices"). +The darts and attributes are accessed through descriptors (either Indices or Handles). A handle is a model of the `Handle` concept, thus supporting the two dereference operators `operator*` and `operator->`. All handles are model of `LessThanComparable` and `Hashable`, that is they can be used as keys in containers such as `std::map` and `std::unordered_map`. An index is a model of the `Index` concept, which is mainly an integer which is convertible from and to std::size_t. Indices can be used as index into vectors which store properties (cf. one example in Section \ref ssecexample3DCMWI "3D Combinatorial Map Using Indices"). \cgalFigureBegin{fig_cmap_diagramme_class,cmap_diagramme_class.svg} UML diagram of the main classes of the package. k is the number of non void attributes. @@ -393,6 +393,8 @@ Example of \link GenericMap::insert_cell_1_in_cell_2 `insert_cell_1_in_cell_2`\e `cm.`\link GenericMap::insert_dangling_cell_1_in_cell_2 `insert_dangling_cell_1_in_cell_2(d0)`\endlink adds a 1-cell in the 2-cell containing dart `d0`, the 1-cell being attached by only one of its vertex to the 0-cell containing dart `d0`. This operation is possible if `d0`\f$ \in \f$ \link GenericMap::darts `cm.darts()`\endlink. +`cm.`\link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2(d1,d2)`\endlink adds a 1-cell between the two faces containing containing darts `d1` and `d2`, between the two 0-cells containing darts `d1` and `d2`. The 2-cells are merged in one. This operation is possible if d1\f$ \not \in \f$ \f$ \langle{}\f$\f$ \beta_1\f$\f$ \rangle{}\f$(d2) which can be tested thanks to `cm.`\link GenericMap::is_insertable_cell_1_between_two_cells_2 `is_insertable_cell_1_between_two_cells_2(d1,d2)`\endlink. + `cm.`\link GenericMap::insert_cell_2_in_cell_3 `insert_cell_2_in_cell_3(itbegin,itend)`\endlink adds a 2-cell in the 3-cell containing all the darts between `itbegin` and `itend`, along the path of 1-cells containing darts in [`itbegin`,`itend`). The 3-cell is split in two. This operation is possible if all the darts in [`itbegin`,`itend`) form a closed path inside a same 3-cell which can be tested thanks to `cm.`\link GenericMap::is_insertable_cell_2_in_cell_3 `is_insertable_cell_2_in_cell_3(itbegin,itend)`\endlink (see example on \cgalFigureRef{fig_cmap_insert_facet}). \cgalFigureBegin{fig_cmap_insert_facet,cmap_insert_facet.svg} @@ -456,6 +458,24 @@ The second line is the result after the removal operations. We retrieve the orig Example of high level operations. Left: Initial 3D combinatorial map after the creation of the combinatorial hexahedron. Middle: Combinatorial map obtained after the two 1-cell insertions. The two 2-cells were split in two. Right: Combinatorial map obtained after the 2-cell insertion. The 3-cell was split in two. \cgalFigureEnd +\subsection Combinatorial_mapInsertion Insert an Edge Between Two Different Faces + +\anchor ssecexempleinsertion + +This example shows the use of \link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2`\endlink operation. First we create a combinatorial hexahedron and a face with 4 edges. This face is inserted in the face of the hexahedron containing dart d1. We display the characteristics of the combinatorial map and check its validity. Then we count and display the number of 2-free darts. + +\cgalExample{Combinatorial_map/map_3_insert.cpp} + +The output is: +\verbatim +#Darts=30, #0-cells=12, #1-cells=17, #2-cells=6, #3-cells=1, #ccs=1, valid=1 +Number of 2-free darts: 4 +\endverbatim + +We can verify that there are 6 2-cells after the insertion since the squared face was inserted as a hole in one face of the hexahedron. We can also see that there are 4 2-free darts, which are the darts of the squared face. Since they bound an hole, there is no face filling the hole and thus 4 darts are 2-free. + +See also a similar example for Linear cell complex \ref Linear_cell_complexInsert "Insert an Edge Between Two Different Faces". + \subsection Combinatorial_mapA4DGenericMap A 4D Combinatorial Map In this example, a 4-dimensional combinatorial map is used. Two tetrahedral cells are created and sewn by \f$ \beta_4\f$. Then the numbers of cells of the combinatorial map are displayed, and its validity is checked. @@ -502,7 +522,7 @@ Lastly we remove the dynamic onmerge functor (step 7). This is done by initializ \cgalExample{Combinatorial_map/map_3_dynamic_onmerge.cpp} -\subsection ssecexample3DCMWI 3D Combinatorial Map using Indices +\subsection ssecexample3DCMWI 3D Combinatorial Map Using Indices In this example, a 3-dimensional combinatorial map is used, but using indices instead of handles. Two vectors are created to store some external information associated with darts and 3-attributes. Since descriptors are indices, they can directly be used to access elements of the vector. diff --git a/Combinatorial_map/doc/Combinatorial_map/Concepts/GenericMap.h b/Combinatorial_map/doc/Combinatorial_map/Concepts/GenericMap.h index ae828e3cdf0..2439a614f03 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Concepts/GenericMap.h +++ b/Combinatorial_map/doc/Combinatorial_map/Concepts/GenericMap.h @@ -267,12 +267,12 @@ using One_dart_per_cell_const_range = unspecified_type; /// @{ /*! -Returns true iff the generic map is empty, i.e.\ it contains no dart. +Returns `true` iff the generic map is empty, i.e.\ it contains no dart. */ bool is_empty() const; /*! -Returns true iff the generic map is without i-boundary. +Returns `true` iff the generic map is without i-boundary. The map is without i-boundary if there is no `i`-free dart. \pre 1\f$ \leq \f$ i \f$ \leq \f$ \link GenericMap::dimension `dimension`\endlink. @@ -280,7 +280,7 @@ The map is without i-boundary if there is no `i`-free dart. bool is_without_boundary(unsigned int i) const; /*! -Returns true iff the generic map is without boundary in all dimensions. +Returns `true` iff the generic map is without boundary in all dimensions. */ bool is_without_boundary() const; @@ -308,18 +308,18 @@ Returns an upper bound of the id of i-attributes descriptors if indices a template size_type upper_bound_on_attribute_ids() const; -/*! Returns true if `d` is a descriptor of a used dart (i.e.\ valid). +/*! Returns `true` if `d` is a descriptor of a used dart (i.e.\ valid). */ bool is_dart_used(Dart_const_descriptor d) const; /*! -Returns true iff dart `d` is i-free. +Returns `true` iff dart `d` is i-free. \pre 0 \f$ \leq \f$ i \f$ \leq \f$ \link GenericMap::dimension `dimension`\endlink. */ bool is_free(Dart_const_descriptor d, unsigned int i) const; /*! -Returns true iff dart `d` is i-free. +Returns `true` iff dart `d` is i-free. \pre 0 \f$ \leq \f$ i \f$ \leq \f$ \link GenericMap::dimension `dimension`\endlink. */ template @@ -477,7 +477,7 @@ A shortcut for \link GenericMap::dart_of_attribute(typename Attribute_const_desc template Dart_const_descriptor dart(Dart_const_descriptor adart) const; -/*! Returns true if ah points to a used i-attribute (i.e.\ valid). +/*! Returns `true` if ah points to a used i-attribute (i.e.\ valid). \pre 0 \f$ \leq \f$ i \f$ \leq \f$ \link GenericMap::dimension `dimension`\endlink, and i-attributes are non `void`. */ template @@ -703,13 +703,13 @@ void correct_invalid_attributes(); /// \cond SKIP_IN_MANUAL boost::function \endcond -/// \name Dynamic Onmerge/Onsplit functors +/// \name Dynamic On-Merge/On-Split functors /// @{ /*! - Return the current dynamic onsplit function associated with i-attributes. + Return the current dynamic on-split function associated with i-attributes. This is a boost::function returning void and having two references to \link GenericMap::Attribute_type `Attribute_type::type`\endlink as parameters. - The onsplit function is returned by reference so that we can modify it. + The on-split function is returned by reference so that we can modify it. */ template boost::function::type&, @@ -717,7 +717,7 @@ void correct_invalid_attributes(); onsplit_function(); /*! - Return the current dynamic onsplit function associated with i-attributes, when *this is const. + Return the current dynamic on-split function associated with i-attributes, when *this is const. This is a boost::function returning void and having two references to \link GenericMap::Attribute_type `Attribute_type::type`\endlink as parameters. */ template @@ -726,9 +726,9 @@ void correct_invalid_attributes(); onsplit_function() const; /*! - Return the current dynamic onmerge function associated with i-attributes. + Return the current dynamic on-merge function associated with i-attributes. This is a boost::function returning void and having two references to \link GenericMap::Attribute_type `Attribute_type::type`\endlink as parameters. - The onmerge function is returned by reference so that we can modify it. + The on-merge function is returned by reference so that we can modify it. */ template boost::function::type&, @@ -736,7 +736,7 @@ void correct_invalid_attributes(); onmerge_function(); /*! - Return the current dynamic onmerge function associated with i-attributes, when *this is const. + Return the current dynamic on-merge function associated with i-attributes, when *this is const. This is a boost::function returning void and having two references to \link GenericMap::Attribute_type `Attribute_type::type`\endlink as parameters. */ template @@ -756,13 +756,13 @@ index. If there is no more available free mark, throw the exception Exception_no size_type get_new_mark() const; /*! -Returns true iff `m` is a reserved mark of the generic map. +Returns `true` iff `m` is a reserved mark of the generic map. \pre 0\f$ \leq \f$ m \f$ < \f$ \link GenericMap::NB_MARKS `NB_MARKS`\endlink. */ bool is_reserved(size_type m) const; /*! -Returns true iff dart `d` is marked for `m`. +Returns `true` iff dart `d` is marked for `m`. \pre \link GenericMap::is_reserved `is_reserved(m)`\endlink and `d`\f$ \in \f$ `darts()`. */ bool is_marked(Dart_const_descriptor d, size_type m) const; @@ -820,9 +820,9 @@ void free_mark(size_type m) const; Creates a combinatorial hexahedron (six combinatorial quadrangles 2-sewn together), and adds it in the generic map. Returns a descriptor on one dart of this combinatorial hexahedron. \pre `dimension` \f$\geq\f$ 2. -\sa `make_edge` -\sa `make_combinatorial_polygon` -\sa `make_combinatorial_tetrahedron` +\sa `make_edge()` +\sa `make_combinatorial_polygon()` +\sa `make_combinatorial_tetrahedron()` */ Dart_descriptor make_combinatorial_hexahedron(); @@ -831,9 +831,9 @@ Dart_descriptor make_combinatorial_hexahedron(); Creates a combinatorial polygon of length `lg` (a cycle of `lg` edges), and adds it in the generic map. Returns a descriptor on one dart of this combinatorial polygon. \pre `dimension`\f$ \geq\f$ 1 and `lg`\f$ >\f$ 0. -\sa `make_edge` -\sa `make_combinatorial_tetrahedron` -\sa `make_combinatorial_hexahedron` +\sa `make_edge()` +\sa `make_combinatorial_tetrahedron()` +\sa `make_combinatorial_hexahedron()` */ Dart_descriptor make_combinatorial_polygon(unsigned int lg); @@ -841,9 +841,9 @@ Dart_descriptor make_combinatorial_polygon(unsigned int lg); Creates a combinatorial tetrahedron (four combinatorial triangles 2-sewn together), and adds it in the generic map. Returns a descriptor on one dart of this combinatorial tetrahedron. \pre `dimension`\f$ \geq\f$ 2. -\sa `make_edge` -\sa `make_combinatorial_polygon` -\sa `make_combinatorial_hexahedron` +\sa `make_edge()` +\sa `make_combinatorial_polygon()` +\sa `make_combinatorial_hexahedron()` */ Dart_descriptor make_combinatorial_tetrahedron(); @@ -851,9 +851,9 @@ Dart_descriptor make_combinatorial_tetrahedron(); Creates an isolated edge (two darts sewn to represent one edge and two vertices) and adds it in the generic map. Returns a descriptor on one dart of this edge. \pre `dimension`\f$ \geq\f$ 2. -\sa `make_combinatorial_polygon` -\sa `make_combinatorial_tetrahedron` -\sa `make_combinatorial_hexahedron` +\sa `make_combinatorial_polygon()` +\sa `make_combinatorial_tetrahedron()` +\sa `make_combinatorial_hexahedron()` */ Dart_descriptor make_edge(); @@ -868,17 +868,18 @@ Inserts a 0-cell in the 1-cell containing `d`. Returns `next(d)`, a descriptor o See examples for combinatorial map in \cgalFigureRef{fig_cmap_insert_vertex} and for generalized map in \cgalFigureRef{fig_gmap_insert_vertex}. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 1-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<1>::type::On_split`\endlink(a,a') is called, with a the original 1-attribute associated with d and a' the new 1-attribute created during the operation. If set, the dynamic onsplit function of 1-attributes is also called on a and a'. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 1-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<1>::type::On_split`\endlink(a,a') is called, with a the original 1-attribute associated with d and a' the new 1-attribute created during the operation. If set, the dynamic on-split function of 1-attributes is also called on a and a'. \cgalAdvancedBegin If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `insert_cell_0_in_cell_2` -\sa `insert_cell_1_in_cell_2` -\sa `insert_dangling_cell_1_in_cell_2` -\sa `insert_cell_2_in_cell_3` -\sa `remove_cell` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `insert_cell_2_in_cell_3()` +\sa `remove_cell()` */ Dart_descriptor insert_cell_0_in_cell_1(Dart_descriptor d); @@ -888,17 +889,18 @@ Inserts a 0-cell in the 2-cell containing `d`. The 2-cell is split in triangles, See examples for combinatorial map in \cgalFigureRef{fig_cmap_triangulation} and for generalized map in \cgalFigureRef{fig_gmap_triangulation}. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 2-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<2>::type::On_split`\endlink(a,a') is called, with a the original 2-attribute associated with `d` and a' each new 2-attribute created during the operation. If set, the dynamic onsplit function of 2-attributes is also called on a and a'. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 2-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<2>::type::On_split`\endlink(a,a') is called, with a the original 2-attribute associated with `d` and a' each new 2-attribute created during the operation. If set, the dynamic on-split function of 2-attributes is also called on a and a'. \cgalAdvancedBegin If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `insert_cell_0_in_cell_2` -\sa `insert_cell_1_in_cell_2` -\sa `insert_dangling_cell_1_in_cell_2` -\sa `insert_cell_2_in_cell_3` -\sa `remove_cell` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `insert_cell_2_in_cell_3()` +\sa `remove_cell()` */ Dart_descriptor insert_cell_0_in_cell_2(Dart_descriptor d); @@ -908,39 +910,68 @@ Inserts a 1-cell in the 2-cell containing `d1` and `d2`. Returns `previous(d1)`, See examples for combinatorial map in \cgalFigureRef{fig_cmap_insert_edge} and for generalized map in \cgalFigureRef{fig_gmap_insert_edge}. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 2-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<2>::type::On_split`\endlink(a,a') is called, with a the original 2-attribute associated with `d` and a' the new 2-attribute created during the operation. If set, the dynamic onsplit function of 2-attributes is also called on a and a'. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 2-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<2>::type::On_split`\endlink(a,a') is called, with a the original 2-attribute associated with `d1` and a' the new 2-attribute created during the operation. If set, the dynamic on-split function of 2-attributes is also called on a and a'. \cgalAdvancedBegin If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `is_insertable_cell_1_in_cell_2` -\sa `insert_cell_0_in_cell_1` -\sa `insert_cell_0_in_cell_2` -\sa `insert_dangling_cell_1_in_cell_2` -\sa `insert_cell_2_in_cell_3` -\sa `remove_cell` +\sa `is_insertable_cell_1_in_cell_2()` +\sa `insert_cell_0_in_cell_1()` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `insert_cell_2_in_cell_3()` +\sa `remove_cell()` */ Dart_descriptor insert_cell_1_in_cell_2(Dart_descriptor d1, Dart_descriptor d2); +/*! +Inserts a 1-cell between the 2-cell containing `d1` and the one containing `d2`. Returns `previous(d1)`, a descriptor on one dart belonging to the new 1-cell. +\pre `is_insertable_cell_1_between_two_cells_2(d1,d2)`. + +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, call \link CellAttribute::On_merge `Attribute_type::type::On_merge`\endlink(a,a') is called for all enabled i-attributes, for i>=2, with a the original 2-attribute associated with `d1` and a' the original 2-attribute associated with `d2`. If set, the dynamic on-merge function of i-attributes is also called on a and a'. + +\cgalAdvancedBegin +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. +\cgalAdvancedEnd + +\sa `is_insertable_cell_1_between_two_cells_2()` +\sa `insert_cell_0_in_cell_1()` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `insert_cell_2_in_cell_3()` +\sa `remove_cell()` +*/ +Dart_descriptor insert_cell_1_between_two_cells_2(Dart_descriptor d1, Dart_descriptor d2); + +/*! Call `insert_cell_1_in_cell_2()` if `is_insertable_cell_1_in_cell_2(d1, d2)`, otherwise call `insert_cell_1_between_two_cells_2()`. +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `is_insertable_cell_1_in_cell_2()` +*/ +Dart_descriptor insert_cell_1(Dart_descriptor d1, Dart_descriptor d2); + /*! Inserts a 2-cell along the path of 1-cells containing darts given by the range `[afirst,alast)`. Returns `opposite<2>(*afirst)`, a descriptor on one dart belonging to the new 2-cell. \pre `is_insertable_cell_2_in_cell_3(afirst,alast)`. See examples for combinatorial map in \cgalFigureRef{fig_cmap_insert_facet} and for generalized map in \cgalFigureRef{fig_gmap_insert_facet}. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 3-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<3>::type::On_split`\endlink(a,a') is called, with a the original 3-attribute associated with `d` and a' the new 3-attribute created during the operation. If set, the dynamic onsplit function of 3-attributes is also called on a and a'. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if 3-attributes are non `void`, \link CellAttribute::On_split `Attribute_type<3>::type::On_split`\endlink(a,a') is called, with a the original 3-attribute associated with `d` and a' the new 3-attribute created during the operation. If set, the dynamic on-split function of 3-attributes is also called on a and a'. \cgalAdvancedBegin If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `is_insertable_cell_2_in_cell_3` -\sa `insert_cell_0_in_cell_1` -\sa `insert_cell_0_in_cell_2` -\sa `insert_cell_1_in_cell_2` -\sa `insert_dangling_cell_1_in_cell_2` -\sa `remove_cell` +\sa `is_insertable_cell_2_in_cell_3()` +\sa `insert_cell_0_in_cell_1()` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `remove_cell()` */ template Dart_descriptor insert_cell_2_in_cell_3(InputIterator afirst, InputIterator alast); @@ -955,45 +986,57 @@ See examples for combinatorial map in \cgalFigureRef{fig_cmap_insert_edge} and f If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `insert_cell_0_in_cell_1` -\sa `insert_cell_0_in_cell_2` -\sa `insert_cell_1_in_cell_2` -\sa `insert_cell_2_in_cell_3` -\sa `remove_cell` +\sa `insert_cell_0_in_cell_1()` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_cell_2_in_cell_3()` +\sa `remove_cell()` */ Dart_descriptor insert_dangling_cell_1_in_cell_2(Dart_descriptor d); /*! -Returns true iff it is possible to insert a 1-cell in the generic map between `d1` and `d2`. +Returns `true` iff it is possible to insert a 1-cell in the generic map between `d1` and `d2`. This is possible if `d1`\f$ \neq \f$ `d2` and `d1` can be reached from `d2` by using some `previous` and `next` calls. \pre \link GenericMap::dimension `dimension`\endlink \f$ \geq\f$ 2, `d1`\f$ \in \f$ \link GenericMap::darts `darts()`\endlink, and `d2`\f$ \in \f$ \link GenericMap::darts `darts()`\endlink. -\sa `insert_cell_1_in_cell_2` -\sa `is_insertable_cell_2_in_cell_3` +\sa `insert_cell_1_in_cell_2()` +\sa `is_insertable_cell_2_in_cell_3()` */ bool is_insertable_cell_1_in_cell_2(Dart_const_descriptor d1, Dart_const_descriptor d2); /*! -Returns true iff it is possible to insert a 2-cell in the generic map along the path of darts given by the range `[afirst,alast)`. The 2-cell can be inserted iff the ordered list of darts form a closed path of edges inside a same volume. +Returns `true` iff it is possible to insert a 1-cell in the generic map between `d1` and `d2`. + +This is possible if `d1`\f$ \neq \f$ `d2` and `d1` can not be reached from `d2` by using some `previous` and `next` calls. +\pre \link GenericMap::dimension `dimension`\endlink \f$ \geq\f$ 2, `d1`\f$ \in \f$ \link GenericMap::darts `darts()`\endlink, and `d2`\f$ \in \f$ \link GenericMap::darts `darts()`\endlink. + +\sa `insert_cell_1_between_two_cells_2()` + +*/ +bool is_insertable_cell_1_between_two_cells_2(Dart_const_descriptor d1, Dart_const_descriptor d2); + +/*! +Returns `true` iff it is possible to insert a 2-cell in the generic map along the path of darts given by the range `[afirst,alast)`. The 2-cell can be inserted iff the ordered list of darts form a closed path of edges inside a same volume. \pre \link GenericMap::dimension `dimension`\endlink \f$ \geq\f$ 3. -\sa `insert_cell_2_in_cell_3` -\sa `is_insertable_cell_1_in_cell_2` +\sa `insert_cell_2_in_cell_3()` +\sa `is_insertable_cell_1_in_cell_2()` */ template bool is_insertable_cell_2_in_cell_3(InputIterator afirst, InputIterator alast); /*! -Returns true iff the i-cell containing `d` can be removed. +Returns `true` iff the i-cell containing `d` can be removed. An i-cell can be removed if `i`==\link GenericMap::dimension `dimension`\endlink or if `i`==\link GenericMap::dimension `dimension`\endlink-1 or if `i`\f$ < \f$ \link GenericMap::dimension `dimension`\endlink-1 and the i-cell containing `d` is incident to at most two (i+1)-cells. \pre 0\f$ \leq \f$ `i`\f$ \leq \f$ \link GenericMap::dimension `dimension`\endlink and `d`\f$ \in \f$ \link GenericMap::darts `darts()`\endlink. -\sa `remove_cell` +\sa `remove_cell()` */ template bool is_removable(Dart_const_descriptor d); @@ -1004,20 +1047,21 @@ Removes the i-cell containing `d`. Returns the number of darts removed fr See examples in \cgalFigureRef{fig_cmap_insert_vertex}, \cgalFigureRef{fig_cmap_insert_edge} and \cgalFigureRef{fig_cmap_insert_facet}. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if `i`\f$ < \f$ \link GenericMap::dimension `dimension`\endlink, and i+1-attributes are non `void`, and if there are two distinct (i+1)-cells around dart `d`, \link CellAttribute::On_merge `Attribute_type::type::On_merge`\endlink(a1,a2) is called, with a1 the (i+1)-attribute associated to `d`, and a2 the (i+1)-attribute associated to \f$ \beta_{i+1}\f$(d). If set, the dynamic onmerge function of i+1-attributes is also called on a1 and a2. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if `i`\f$ < \f$ \link GenericMap::dimension `dimension`\endlink, and i+1-attributes are non `void`, and if there are two distinct (i+1)-cells around dart `d`, \link CellAttribute::On_merge `Attribute_type::type::On_merge`\endlink(a1,a2) is called, with a1 the (i+1)-attribute associated to `d`, and a2 the (i+1)-attribute associated to \f$ \beta_{i+1}\f$(d). If set, the dynamic on-merge function of i+1-attributes is also called on a1 and a2. -If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if a j-cell is disconnected in two j-cells during the operation, and if j-attributes are non void, \link CellAttribute::On_split `Attribute_type::type::On_split`\endlink(a,a') is called with a the original j-attribute and a' the new j-attribute created due to the disconnection. If set, the dynamic onsplit function of j-attributes is also called on a and a'. +If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==true`, if a j-cell is disconnected in two j-cells during the operation, and if j-attributes are non void, \link CellAttribute::On_split `Attribute_type::type::On_split`\endlink(a,a') is called with a the original j-attribute and a' the new j-attribute created due to the disconnection. If set, the dynamic on-split function of j-attributes is also called on a and a'. \cgalAdvancedBegin If \link GenericMap::are_attributes_automatically_managed `are_attributes_automatically_managed()`\endlink`==false`, non void attributes are not updated; thus the generic map can be no more valid after this operation. \cgalAdvancedEnd -\sa `is_removable` -\sa `insert_cell_0_in_cell_1` -\sa `insert_cell_0_in_cell_2` -\sa `insert_cell_1_in_cell_2` -\sa `insert_dangling_cell_1_in_cell_2` -\sa `insert_cell_2_in_cell_3` +\sa `is_removable()` +\sa `insert_cell_0_in_cell_1()` +\sa `insert_cell_0_in_cell_2()` +\sa `insert_cell_1_in_cell_2()` +\sa `insert_cell_1_between_two_cells_2()` +\sa `insert_dangling_cell_1_in_cell_2()` +\sa `insert_cell_2_in_cell_3()` */ template size_type remove_cell(Dart_descriptor d); diff --git a/Combinatorial_map/doc/Combinatorial_map/examples.txt b/Combinatorial_map/doc/Combinatorial_map/examples.txt index ce72b6a64a2..c77e4e6c522 100644 --- a/Combinatorial_map/doc/Combinatorial_map/examples.txt +++ b/Combinatorial_map/doc/Combinatorial_map/examples.txt @@ -6,4 +6,5 @@ \example Combinatorial_map/map_3_with_colored_facets.cpp \example Combinatorial_map/map_3_dynamic_onmerge.cpp \example Combinatorial_map/map_3_index.cpp +\example Combinatorial_map/map_3_insert.cpp */ diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_insert.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_insert.cpp new file mode 100644 index 00000000000..4963fcb23a7 --- /dev/null +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_insert.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +typedef CGAL::Combinatorial_map<3> CMap_3; +typedef CMap_3::Dart_descriptor Dart_descriptor; + +int main() +{ + CMap_3 cm; + + // Create one combinatorial hexahedron + Dart_descriptor d1 = cm.make_combinatorial_hexahedron(); + + // Create one square face + Dart_descriptor d2=cm.make_combinatorial_polygon(4); + + assert(cm.is_insertable_cell_1_between_two_cells_2(d1,d2)); + + // Insert the square face as a hole of the face of the hexahedron containing d1 + cm.insert_cell_1_between_two_cells_2(d1, d2); + + // Display the combinatorial map characteristics. + cm.display_characteristics(std::cout)<<", valid=" + <(dh)) ++nb; } + std::cout<<"Number of 2-free darts: "<::value>=0, "set_attribute but i-attributes are disabled"); - for ( typename Dart_of_cell_range::iterator it(*this, dh); - it.cont(); ++it) + for (typename Dart_of_cell_range::iterator it(*this, dh); + it.cont(); ++it) { this->template set_dart_attribute(it, ah); } + if(ah!=null_descriptor) + // To ensure that the dart of this attribute is dh + { this->template set_dart_of_attribute(ah, dh); } } /// @return a Attributes_range (range through all the @@ -4410,7 +4413,8 @@ namespace CGAL { bool is_insertable_cell_1_in_cell_2(Dart_const_descriptor adart1, Dart_const_descriptor adart2) const { - if ( adart1==adart2 ) return false; + if (adart1==adart2 || adart1==null_descriptor) return false; + if (adart2==null_descriptor) return true; for ( CMap_dart_const_iterator_of_orbit it(*this,adart1); it.cont(); ++it ) { @@ -4427,15 +4431,81 @@ namespace CGAL { * same vertex than adart1. */ Dart_descriptor insert_cell_1_in_cell_2(Dart_descriptor adart1, - Dart_descriptor adart2, - bool update_attributes=true) + Dart_descriptor adart2, + bool update_attributes=true) { + CGAL_assertion(is_insertable_cell_1_in_cell_2(adart1, adart2)); if ( adart2==null_descriptor ) return insert_dangling_cell_1_in_cell_2(adart1, null_descriptor, update_attributes); + return generic_insert_cell_1(adart1, adart2, false, update_attributes); + } - CGAL_assertion(is_insertable_cell_1_in_cell_2(adart1, adart2)); + /** Test if an edge can be inserted between two different 2-cells + * between two given darts. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @return true iff an edge can be inserted between adart1 and adart2. + */ + bool is_insertable_cell_1_between_two_cells_2(Dart_const_descriptor adart1, + Dart_const_descriptor adart2) const + { + if (adart1==adart2 || adart1==null_descriptor || adart2==null_descriptor) + { return false; } + for ( CMap_dart_const_iterator_of_orbit it(*this,adart1); + it.cont(); ++it ) + { + if ( it==adart2 ) return false; + } + return true; + } + /** Insert an edge between two different 2-cells, between two given darts. + * @param adart1 a first dart of the first facet (!=null_descriptor && !=null_dart_descriptor). + * @param adart2 a second dart of the second facet (!=null_descriptor && !=null_dart_descriptor). + * @param update_attributes a boolean to update the enabled attributes + * @return a dart of the new edge, and not incident to the + * same vertex than adart1. + */ + Dart_descriptor insert_cell_1_between_two_cells_2(Dart_descriptor adart1, + Dart_descriptor adart2, + bool update_attributes=true) + { + CGAL_assertion(is_insertable_cell_1_between_two_cells_2(adart1, adart2)); + return generic_insert_cell_1(adart1, adart2, true, update_attributes); + } + + /** Insert an edge between two given darts. If the two darts belong to the same facet, call + * insert_cell_1_in_cell_2, otherwise call insert_cell_1_between_two_cells_2. + * @param adart1 a first dart (!=null_descriptor && !=null_dart_descriptor). + * @param adart2 a second dart. + * @param update_attributes a boolean to update the enabled attributes + * @return a dart of the new edge, and not incident to the + * same vertex than adart1. + */ + Dart_descriptor insert_cell_1(Dart_descriptor adart1, + Dart_descriptor adart2, + bool update_attributes=true) + { + if(is_insertable_cell_1_in_cell_2(adart1, adart2)) + { return insert_cell_1_in_cell_2(adart1, adart2, update_attributes); } + return insert_cell_1_between_two_cells_2(adart1, adart2, update_attributes); + } + + /** Generic method to insert a 1-cell, either in a 2-cell (cf. insert_cell_1_in_cell_2) + * or between two different 2-cells (cf. insert_cell_1_between_two_cells_2). + * Indeed the code is the same, except for the group/degroup attribute. + * merge is true if adart1 and adart2 belongs to two different facets; in this case + * the two facets should be merged (they are now linked by the new edge); + * merge is false it adart1 and adart2 belongs to the same facet; in this case + * the facet is split in two. + * Internal method not supposed to be called by users. + */ + Dart_descriptor generic_insert_cell_1(Dart_descriptor adart1, + Dart_descriptor adart2, + bool merge, + bool update_attributes) + { size_type m1=get_new_mark(); CMap_dart_iterator_basic_of_involution it1(*this, adart1, m1); @@ -4492,7 +4562,7 @@ namespace CGAL { } this->template basic_link_beta_for_involution<2>(d2, d1); - for ( unsigned int dim=3; dim<=dimension; ++dim) + for (unsigned int dim=3; dim<=dimension; ++dim) { if ( !is_free(it1, dim) && is_marked(beta(it1, dim), treated) ) @@ -4509,7 +4579,19 @@ namespace CGAL { if (are_attributes_automatically_managed() && update_attributes) { - internal::Degroup_attribute_functor_run::run(*this, d1, d2); + if(merge) + { // Here we group all enabled attributes starting from 2 to dimension + Helper::template Foreach_enabled_attributes + , 2>::run(*this, adart1, adart2); + // And we need to group also beta_i(adart1) and beta_i(adart2) for all + // enabled attributes starting from 3 dimension. Indeed when two i-cells + // are grouped for adart1 and adart2, this group also all beta_j two by two + // except for beta_i. + Helper::template Foreach_enabled_attributes + , 3>::run(*this, adart1, adart2); + } + else // Here we degroup 2-attributes + { internal::Degroup_attribute_functor_run::run(*this, adart1, adart2); } } negate_mark(m1); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h index 2b55a2c21c9..a8da5c4ddd5 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h @@ -36,12 +36,19 @@ * non nullptr, we override all the i-attribute of the second i-cell to the * first i-attribute. * + * Group_neighboor_attribute to group the -attributes of beta_i(d1) and + * beta_i(d2) if they exist. + * * Degroup_attribute_functor_run to degroup one i-attributes in two * (except for j-adim). * * Test_split_attribute_functor to test if there is some i-attributes * that are split after an operation. Modified darts are given in a * std::deque. + * + * Set_dart_of_attribute_if_marked to set the dart of the i-attribute + * associated with a dart if the old dart is marked. Used in remove_cell + * functions. */ namespace CGAL { @@ -238,7 +245,8 @@ struct Group_nonvoid_attribute_functor_run { static void run(CMap& amap, typename CMap::Dart_descriptor adart1, - typename CMap::Dart_descriptor adart2) + typename CMap::Dart_descriptor adart2, + bool dart1_deleted=true) { static_assert( 1<=i && i<=CMap::dimension ); static_assert( i!=j ); @@ -251,8 +259,13 @@ struct Group_nonvoid_attribute_functor_run a2=amap.template attribute(adart2); // If the two attributes are equal, nothing to do. - if ( a1 == a2 ) return; - + if (a1==a2) + { + if(a1!=CMap::null_descriptor && dart1_deleted && + amap.template dart_of_attribute(a1)==adart1) + { amap.template set_dart_of_attribute(a1, adart2); } + return; + } typename CMap::Dart_descriptor toSet = amap.null_descriptor; // If the attribute associated to adart1 is nullptr, set it with @@ -268,6 +281,8 @@ struct Group_nonvoid_attribute_functor_run } } amap.template set_attribute(toSet, a1); + if(dart1_deleted && toSet==adart1) + { amap.template set_dart_of_attribute(a1, adart2); } } }; // Specialization for i=0 and 2<=j. We update 0-attributes for beta_j j>=2. @@ -277,7 +292,8 @@ struct Group_nonvoid_attribute_functor_run { static void run( CMap& amap, typename CMap::Dart_descriptor dh1, - typename CMap::Dart_descriptor dh2 ) + typename CMap::Dart_descriptor dh2, + bool dart1_deleted=true) { static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, @@ -306,6 +322,8 @@ struct Group_nonvoid_attribute_functor_run } } amap.template set_attribute<0>(toSet, a1); + if(dart1_deleted && toSet==dh1) + { amap.template set_dart_of_attribute<0>(a1, od); } } } // Second extremity @@ -338,7 +356,8 @@ struct Group_nonvoid_attribute_functor_run { static void run( CMap& amap, typename CMap::Dart_descriptor dh1, - typename CMap::Dart_descriptor dh2 ) + typename CMap::Dart_descriptor dh2, + bool dart1_deleted=true) { static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, @@ -364,6 +383,8 @@ struct Group_nonvoid_attribute_functor_run } } amap.template set_attribute<0>(toSet, a1); + if(dart1_deleted && toSet==dh1) + { amap.template set_dart_of_attribute<0>(a1, od); } } } } @@ -375,7 +396,8 @@ struct Group_nonvoid_attribute_functor_run { static void run( CMap& amap, typename CMap::Dart_descriptor dh1, - typename CMap::Dart_descriptor dh2 ) + typename CMap::Dart_descriptor dh2, + bool=true) { static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, @@ -411,7 +433,8 @@ struct Group_nonvoid_attribute_functor_run { static void run(CMap&, typename CMap::Dart_descriptor, - typename CMap::Dart_descriptor) + typename CMap::Dart_descriptor, + bool=true) {} }; // Specialization for i=1 and j=0. Do nothing as edges attributes are not @@ -421,7 +444,8 @@ struct Group_nonvoid_attribute_functor_run { static void run(CMap&, typename CMap::Dart_descriptor, - typename CMap::Dart_descriptor) + typename CMap::Dart_descriptor, + bool=true) {} }; //------------------------------------------------------------------------------ @@ -432,8 +456,10 @@ struct Group_attribute_functor_run { static void run( CMap& amap, typename CMap::Dart_descriptor d1, - typename CMap::Dart_descriptor d2) - { Group_nonvoid_attribute_functor_run::run(amap, d1, d2); } + typename CMap::Dart_descriptor d2, + bool dart1_deleted=true) + { Group_nonvoid_attribute_functor_run:: + run(amap, d1, d2, dart1_deleted); } }; // Specialization for void attributes. template @@ -441,7 +467,8 @@ struct Group_attribute_functor_run { static void run( CMap&, typename CMap::Dart_descriptor, - typename CMap::Dart_descriptor ) + typename CMap::Dart_descriptor, + bool=true) {} }; // ************************************************************************ @@ -464,6 +491,22 @@ struct Group_attribute_functor run(amap,adart1,adart2); } }; // ************************************************************************ +/// Group i-attribute of beta_i(d1) and beta_i(d2) if they exist. +template +struct Group_neighboor_attribute +{ + template + static void run(CMap& amap, typename CMap::Dart_descriptor d1, + typename CMap::Dart_descriptor d2) + { + if(!amap.template is_free(d1) && !amap.template is_free(d2)) + { + CGAL::internal::Group_attribute_functor_run::run + (amap, amap.template opposite(d1), amap.template opposite(d2), false); + } + } +}; +// ************************************************************************ // Functor used to degroup one i-attribute of one i-cell in two, except the // attribute of j. template::type> +struct Set_dart_of_attribute_if_marked +{ + static void run(CMap& amap, typename CMap::Dart_descriptor d1, + typename CMap::size_type amark) + { + if(amap.template attribute(d1)!=CMap::null_descriptor && + amap.template dart(d1)!=CMap::null_descriptor && + amap.is_marked(amap.template dart(d1), amark)) + { amap.template dart(d1)=d1; } + } +}; +// Specialization for void attributes. +template +struct Set_dart_of_attribute_if_marked +{ + static void run(CMap&, typename CMap::Dart_descriptor, + typename CMap::size_type) + {} +}; +// ************************************************************************ } // namespace internal } // namespace CGAL diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_utility.h b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_utility.h index 2a8d24c0123..b7ca3d12b42 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_utility.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_utility.h @@ -342,23 +342,24 @@ namespace CGAL //is called for case k only if the k'th type in the tuple //is different from Void. Note that to the converse of Foreach_static //Functor are called from n =0 to k - template + template struct Foreach_static_restricted; - template + template struct Foreach_static_restricted,n> + std::tuple,n, startn> { template static void run(T& ... t){ - Conditionnal_run::run(t...); + if(n>=startn) + { Conditionnal_run::run(t...); } Foreach_static_restricted - ,n+1>::run(t...); + , n+1, startn>::run(t...); } }; - template - struct Foreach_static_restricted,n>{ + template + struct Foreach_static_restricted,n, startn>{ template static void run(T& ... ){} }; @@ -609,13 +610,13 @@ namespace CGAL struct Attribute_const_range { typedef CGAL::Void type; }; - // To iterate onto each enabled attributes - template + // To iterate onto each enabled attributes, starting from startn-attributes (0 by default) + template struct Foreach_enabled_attributes { template static void run(Ts& ... t) - { Foreach_static_restricted::run(t...); } + { Foreach_static_restricted::run(t...); } }; // To iterate onto each enabled attributes, except j-attributes template diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h index 6a7a1b6f271..72c89d40142 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h @@ -107,8 +107,10 @@ namespace CGAL { // We group the two (i+1)-cells incident if they exist. if ( dg1!=amap.null_descriptor ) + { CGAL::internal::Group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be removed + } } // During the operation, we store in modified_darts the darts modified @@ -148,6 +150,9 @@ namespace CGAL if ( d1!=amap.null_dart_descriptor ) { + internal::Set_dart_of_attribute_if_marked:: + run(amap, d1, mark); + if ( d2!=amap.null_dart_descriptor && d1!=d2 ) { amap.template basic_link_beta(d1, d2); @@ -353,7 +358,7 @@ namespace CGAL // We group the two edges incident if they exist. if ( dg1!=amap.null_descriptor ) CGAL::internal::Group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be removed } // During the operation, we store in modified_darts the darts modified @@ -369,6 +374,9 @@ namespace CGAL { if ( !amap.template is_free<0>(*it) ) { + internal::Set_dart_of_attribute_if_marked:: + run(amap, amap.template beta<0>(*it), mark); + if ( !amap.template is_free<1>(*it) && amap.template beta<0>(*it)!=(*it) ) { @@ -523,7 +531,7 @@ namespace CGAL // We group the two (i-1)-cells incident if they exist. if ( dg1!=amap.null_descriptor ) CGAL::internal::Group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be removed } // During the operation, we store in modified_darts the darts modified @@ -677,7 +685,7 @@ namespace CGAL // We group the two vertices incident if they exist. if ( dg1!=amap.null_descriptor ) CGAL::internal::Group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be removed } // During the operation, we store in modified_darts the darts modified diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index 044db27dc87..d3d67c57a88 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -738,6 +738,9 @@ public: size_type index(const_iterator cit) const { return static_cast(cit); } + size_type index(Index idx) const + { return static_cast(idx); } + // Returns whether the iterator "cit" is in the range [begin(), end()]. // This function is mostly useful for purposes of efficient debugging at // higher levels. diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h index 1abea6aef50..aecd73c271a 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h @@ -1012,6 +1012,17 @@ bool test3D() map.insert_cell_1_in_cell_2(d1, map.beta(d1,1,1)); map.display_characteristics(cout) << ", valid=" << map.is_valid() << endl; map.clear(); + + d1 = map.make_combinatorial_polygon(4); + d2 = map.make_combinatorial_polygon(4); + map.insert_cell_1_between_two_cells_2(d1, d2); + if(!map.is_valid()) + { + map.display_characteristics(cout) << ", valid=" << map.is_valid() << endl; + std::cout<<"ERROR after map.insert_cell_1_between_two_cells_2(d1, d2);"< void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end, PolygonMesh &pm, - boost::optional::value_type>::Kernel::Point_3> > origin = boost::none); + std::optional::value_type>::Kernel::Point_3> > origin = std::nullopt); } /* namespace CGAL */ diff --git a/Convex_hull_3/doc/Convex_hull_3/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h b/Convex_hull_3/doc/Convex_hull_3/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h index a234d1905ca..76cd8dff9f3 100644 --- a/Convex_hull_3/doc/Convex_hull_3/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h +++ b/Convex_hull_3/doc/Convex_hull_3/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h @@ -25,7 +25,7 @@ template void halfspace_intersection_with_constructions_3(PlaneIterator pbegin, PlaneIterator pend, PolygonMesh &pm, - boost::optional::value_type>::Kernel::Point_3> > origin = boost::none, + std::optional::value_type>::Kernel::Point_3> > origin = std::nullopt, const Traits & ch_traits = Default_traits); } /* namespace CGAL */ diff --git a/Convex_hull_3/examples/Convex_hull_3/lloyd_algorithm.cpp b/Convex_hull_3/examples/Convex_hull_3/lloyd_algorithm.cpp index 4976b5e4a04..75d8847375d 100644 --- a/Convex_hull_3/examples/Convex_hull_3/lloyd_algorithm.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/lloyd_algorithm.cpp @@ -170,7 +170,7 @@ void lloyd_algorithm (PolyIterator poly_begin, CGAL::halfspace_intersection_3(planes.begin(), planes.end(), P, - boost::make_optional(vit->point())); + std::make_optional(vit->point())); // Centroid apply_function_object_polyhedron(P, centroid_acc); diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h index 87062e5c29d..19ee436cc52 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h @@ -66,7 +66,7 @@ namespace CGAL // Typedefs for intersection typedef typename Kernel::Plane_3 Plane_3; typedef typename Kernel::Line_3 Line_3; - typedef boost::optional< boost::variant< Point_3, + typedef std::optional< std::variant< Point_3, Line_3, Plane_3 > > result_inter; @@ -96,10 +96,10 @@ namespace CGAL result_inter result = CGAL::intersection(pp1, pp2, pp3); CGAL_assertion_msg(bool(result), "halfspace_intersection_3: no intersection"); - CGAL_assertion_msg(boost::get(& *result) != nullptr, + CGAL_assertion_msg(std::get_if(& *result) != nullptr, "halfspace_intersection_3: intersection is not a point"); - const Point_3* pp = boost::get(& *result); + const Point_3* pp = std::get_if(& *result); // Primal vertex associated to the current dual plane Point_3 ppp(origin.x() + pp->x(), @@ -227,7 +227,7 @@ namespace CGAL template void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end, Polyhedron &P, - boost::optional::value_type>::Kernel::Point_3> origin = boost::none) { + std::optional::value_type>::Kernel::Point_3> origin = std::nullopt) { // Checks whether the intersection is a polyhedron CGAL_assertion_msg(Convex_hull_3::internal::is_intersection_dim_3(begin, end), "halfspace_intersection_3: intersection not a polyhedron"); @@ -241,8 +241,8 @@ namespace CGAL // find a point inside the intersection origin = halfspace_intersection_interior_point_3(begin, end); - CGAL_assertion_msg(origin!=boost::none, "halfspace_intersection_3: problem when determining a point inside the intersection"); - if (origin==boost::none) + CGAL_assertion_msg(origin!=std::nullopt, "halfspace_intersection_3: problem when determining a point inside the intersection"); + if (origin==std::nullopt) return; } @@ -272,7 +272,7 @@ namespace CGAL void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end, Polyhedron &P, typename Kernel_traits::value_type>::Kernel::Point_3 const& origin) { - halfspace_intersection_3(begin, end , P, boost::make_optional(origin)); + halfspace_intersection_3(begin, end , P, std::make_optional(origin)); } #endif } // namespace CGAL diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_interior_point_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_interior_point_3.h index ba396c0e2e0..5ce8dbe7579 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_interior_point_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_interior_point_3.h @@ -165,7 +165,7 @@ public: \ingroup PkgConvexHull3Functions computes a point belonging to the intersection of the halfspaces defined by the planes contained in the range `[begin, end)`. -If the intersection is empty, `boost::none` is returned. +If the intersection is empty, `std::nullopt` is returned. \attention Halfspaces are considered as lower halfspaces that is to say if the plane's equation is \f$ a\, x +b\, y +c\, z + d = 0 \f$ then the corresponding halfspace is defined by \f$ a\, x +b\, y +c\, z + d \le 0 \f$ . @@ -173,7 +173,7 @@ is \f$ a\, x +b\, y +c\, z + d = 0 \f$ then the corresponding halfspace is defin \tparam PlaneIterator must be an input iterator with the value type being a `Plane_3` object from \cgal Kernel */ template -boost::optional::value_type>::Kernel::Point_3> +std::optional::value_type>::Kernel::Point_3> halfspace_intersection_interior_point_3(PlaneIterator begin, PlaneIterator end) { // Types @@ -185,9 +185,9 @@ halfspace_intersection_interior_point_3(PlaneIterator begin, PlaneIterator end) // find a point inside the intersection internal::Interior_polyhedron_3 interior; if (!interior.find(begin, end)) - return boost::none; + return std::nullopt; - return boost::make_optional(interior.inside_point()); + return std::make_optional(interior.inside_point()); } } // namespace CGAL diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h index 4a0b9c26d44..d8946af7353 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h @@ -90,7 +90,7 @@ namespace CGAL void halfspace_intersection_with_constructions_3(PlaneIterator pbegin, PlaneIterator pend, Polyhedron &P, - boost::optional::value_type>::Kernel::Point_3> origin, + std::optional::value_type>::Kernel::Point_3> origin, const Traits & ch_traits) { typedef typename Kernel_traits::value_type>::Kernel K; typedef typename K::Point_3 Point; @@ -101,8 +101,8 @@ namespace CGAL // find a point inside the intersection origin = halfspace_intersection_interior_point_3(pbegin, pend); - CGAL_assertion_msg(origin!=boost::none, "halfspace_intersection_with_constructions_3: problem when determining a point inside the intersection"); - if (origin==boost::none) + CGAL_assertion_msg(origin!=std::nullopt, "halfspace_intersection_with_constructions_3: problem when determining a point inside the intersection"); + if (origin==std::nullopt) return; } @@ -134,7 +134,7 @@ namespace CGAL void halfspace_intersection_with_constructions_3 (PlaneIterator pbegin, PlaneIterator pend, Polyhedron &P, - boost::optional::value_type>::Kernel::Point_3> const& origin = boost::none) { + std::optional::value_type>::Kernel::Point_3> const& origin = std::nullopt) { typedef typename Kernel_traits::value_type>::Kernel K; typedef typename K::Point_3 Point_3; typedef typename Convex_hull_3::internal::Default_traits_for_Chull_3::type Traits; diff --git a/Convex_hull_3/test/Convex_hull_3/test_halfspace_intersections.cpp b/Convex_hull_3/test/Convex_hull_3/test_halfspace_intersections.cpp index a0eef18da7f..686a2b8c717 100644 --- a/Convex_hull_3/test/Convex_hull_3/test_halfspace_intersections.cpp +++ b/Convex_hull_3/test/Convex_hull_3/test_halfspace_intersections.cpp @@ -32,7 +32,7 @@ void test() CGAL::halfspace_intersection_3(planes.begin(), planes.end(), P1, - boost::make_optional(Point(0, 0, 0)) ); + std::make_optional(Point(0, 0, 0)) ); // test halfspace_intersection_3 with non point inside CGAL::halfspace_intersection_3(planes.begin(), @@ -43,7 +43,7 @@ void test() CGAL::halfspace_intersection_with_constructions_3( planes.begin(), planes.end(), P3, - boost::make_optional(Point(0, 0, 0)) ); + std::make_optional(Point(0, 0, 0)) ); // test halfspace_intersection_with_constructions_3 with non point inside CGAL::halfspace_intersection_with_constructions_3( planes.begin(), @@ -54,7 +54,7 @@ void test() CGAL::halfspace_intersection_with_constructions_3( planes.begin(), planes.end(), P5, - boost::optional(), + std::optional(), K()); assert(num_vertices(P1)==8 && num_faces(P1)==6); diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index 415fb56131e..481b1792c4f 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -414,6 +414,15 @@ else() endforeach() endif() +#special cases +foreach(pkg "Mesher_level") + if(CGAL_BRANCH_BUILD) + set(CGAL_${pkg}_INCLUDE_DIR "${CGAL_ROOT}/${pkg}/include") + else() + set(CGAL_${pkg}_INCLUDE_DIR "${CGAL_ROOT}/include") + endif() +endforeach() + option(CGAL_BUILD_THREE_DOC "Build the documentation of the Three package" OFF) if(NOT CGAL_BUILD_THREE_DOC) diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 15a863470a2..7f347c1529c 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -660,7 +660,8 @@ PREDEFINED = DOXYGEN_RUNNING \ "CGAL_NP_CLASS_1=NamedParameters1" \ "CGAL_NP_TEMPLATE_PARAMETERS_2=NamedParameters2 = CGAL::parameters::Default_named_parameter" \ "CGAL_NP_CLASS_2=NamedParameters2" \ - CGAL_DEPRECATED + CGAL_DEPRECATED \ + CGAL_DEPRECATED_MSG(name)= #--------------------------------------------------------------------------- # Configuration options related to external references diff --git a/Documentation/doc/resources/1.9.6/BaseDoxyfile.in b/Documentation/doc/resources/1.9.6/BaseDoxyfile.in index 67b8fd643f3..f5d4533ce70 100644 --- a/Documentation/doc/resources/1.9.6/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.9.6/BaseDoxyfile.in @@ -645,7 +645,9 @@ PREDEFINED = DOXYGEN_RUNNING \ "CGAL_NP_CLASS_1=NamedParameters1" \ "CGAL_NP_TEMPLATE_PARAMETERS_2=NamedParameters2 = CGAL::parameters::Default_named_parameter" \ "CGAL_NP_CLASS_2=NamedParameters2" \ - CGAL_DEPRECATED + CGAL_DEPRECATED \ + CGAL_DEPRECATED_MSG(name)= + #--------------------------------------------------------------------------- # Configuration options related to external references diff --git a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h index fc2f04a27ec..4e17e189b11 100644 --- a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h +++ b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -116,9 +116,7 @@ public: { // Subdivide the curves into x-monotone subcurves. CurvesIterator it; - std::list objects; - std::list::iterator obj_it; - X_monotone_curve_2 xcv; + std::list> objects; std::list x_curves; for (it = begin; it != end; it++) @@ -127,10 +125,10 @@ public: objects.clear(); traits->make_x_monotone_2_object()(*it, std::back_inserter(objects)); - for (obj_it = objects.begin(); obj_it != objects.end(); ++obj_it) + for (auto obj_it = objects.begin(); obj_it != objects.end(); ++obj_it) { - if(CGAL::assign (xcv, *obj_it)) - x_curves.push_back (xcv); + if(const X_monotone_curve_2* xcv_ptr = std::get_if(&(*obj_it))) + x_curves.push_back (*xcv_ptr); } } diff --git a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h index 9503e338311..657bb0168ea 100644 --- a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h +++ b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h @@ -19,7 +19,7 @@ * Definitions of the functions of the Envelope_divide_and_conquer_2 class. */ -#include +#include namespace CGAL { @@ -609,9 +609,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1, // This is the rightmost vertex in the current minimization diagram (out_d). // The intersection points/curves that interest us are the ones in // [v_leftmost, v]. - // Without using make_optional we get a "maybe uninitialized" warning with gcc -Wall - boost::optional v_leftmost = - boost::make_optional(false, Vertex_const_handle()); + std::optional v_leftmost; if (is_leftmost1 == true) { if (is_leftmost2 == false) @@ -632,9 +630,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1, // Find the next intersection of the envelopes to the right of the current // rightmost point in the merged diagram. - // \todo Use the faster object_cast. - std::list objects; - CGAL::Object obj; + std::list> objects; const X_monotone_curve_2* intersection_curve; const Intersection_point* intersection_point; @@ -643,10 +639,10 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1, while (! objects.empty()) { // Pop the xy-lexicographically smallest intersection object. - obj = objects.front(); + auto obj = objects.front(); objects.pop_front(); - if ((intersection_point = CGAL::object_cast(&obj)) != + if ((intersection_point = std::get_if(&obj)) != nullptr) { // We have a simple intersection point. @@ -727,7 +723,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1, else { // We have an x-monotone curve representing an overlap of the two // curves. - intersection_curve = CGAL::object_cast(&obj); + intersection_curve = std::get_if(&obj); if (intersection_curve == nullptr) CGAL_error_msg("unrecognized intersection object."); diff --git a/Envelope_3/include/CGAL/Env_plane_traits_3.h b/Envelope_3/include/CGAL/Env_plane_traits_3.h index 1bf7f790a10..85fbbf161be 100644 --- a/Envelope_3/include/CGAL/Env_plane_traits_3.h +++ b/Envelope_3/include/CGAL/Env_plane_traits_3.h @@ -47,7 +47,6 @@ public: typedef typename Kernel::Ray_2 Ray_2; typedef typename Kernel::Line_2 Line_2; typedef typename Kernel::Line_3 Line_3; - typedef typename Kernel::Object_3 Object_3; typedef std::pair Intersection_curve; typedef typename Base::Left_side_category Left_side_category; @@ -326,8 +325,8 @@ public: const Plane_3& h = s.plane(); Line_2 proj_line(h.a(), h.b(), h.d()); - *o++ = make_object(std::make_pair(X_monotone_curve_2(proj_line), - ON_ORIENTED_BOUNDARY)); + *o++ = std::make_pair(X_monotone_curve_2(proj_line), + ON_ORIENTED_BOUNDARY); return o; } @@ -339,7 +338,7 @@ public: Oriented_side side = (res == SMALLER) ? ON_POSITIVE_SIDE : ON_NEGATIVE_SIDE; - *o++ = make_object(std::make_pair(X_monotone_curve_2(s.line()), side)); + *o++ = std::make_pair(X_monotone_curve_2(s.line()), side); return o; } }; @@ -369,11 +368,10 @@ public: { Line_2 l1(h1.a(), h1.b(), h1.d()); Line_2 l2(h2.a(), h2.b(), h2.d()); - Object obj = k.intersect_2_object()(l1, l2); + auto obj = k.intersect_2_object()(l1, l2); - Point_2 p; - if(assign(p, obj)) - *o++ = make_object(p); + if(const Point_2* p = std::get_if(&(*obj))) + *o++ = *p; // otherwise, the vertical planes are parallel or overlap, so we return // nothing. @@ -382,90 +380,82 @@ public: if(s1.is_all_plane() && s2.is_all_plane()) { - Object obj = k.intersect_3_object()(h1, h2); - Line_3 l; - if(assign(l, obj)) - *o++ = make_object(Intersection_curve(project_xy(l, k), 1)); + auto obj = k.intersect_3_object()(h1, h2); + CGAL_assertion(obj != std::nullopt); + if(const Line_3* l = std::get_if(&(*obj))) + *o++ = Intersection_curve(project_xy(*l, k), 1); return o; } if(s1.is_all_plane() && !s2.is_all_plane()) { - Object obj = plane_half_plane_proj_intersection(h1, - h2, - s2.line(), - k); - if(obj.is_empty()) + auto obj = plane_half_plane_proj_intersection(h1, + h2, + s2.line(), + k); + if(obj ==std::nullopt) return o; - Line_2 temp_l; - if(assign(temp_l, obj)) + if(const Line_2* line = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(temp_l, 1)); + *o++ = Intersection_curve(*line, 1); return o; } - Ray_2 ray; - if(assign(ray, obj)) + if(const Ray_2* ray = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(ray, 1)); + *o++ = Intersection_curve(*ray, 1); return o; } return o; } if(!s2.is_all_plane() && s2.is_all_plane()) { - Object obj = plane_half_plane_proj_intersection(h2, - h1, - s1.line(), - k); - if(obj.is_empty()) + auto obj = plane_half_plane_proj_intersection(h2, + h1, + s1.line(), + k); + if(obj == std::nullopt) return o; - Line_2 line; - if(assign(line, obj)) + if(const Line_2* line = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(line, 1)); + *o++ = Intersection_curve(*line, 1); return o; } - Ray_2 ray; - if(assign(ray, obj)) + if(const Ray_2* ray = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(ray, 1)); + *o++ = Intersection_curve(*ray, 1); return o; } return o; - } CGAL_assertion(!s2.is_all_plane() && !s2.is_all_plane()); - Object obj = + auto obj = half_plane_half_plane_proj_intersection(h1, s1.line(), h2, s2.line(), k); - if(obj.is_empty()) + if(obj ==std::nullopt ) return o; - Line_2 line; - if(assign(line, obj)) + + if(const Line_2* line = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(line, 1)); + *o++ = Intersection_curve(*line, 1); return o; } - Ray_2 ray; - if(assign(ray, obj)) + if(const Ray_2* ray = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(ray, 1)); + *o++ = Intersection_curve(*ray, 1); return o; } - Segment_2 seg; - if(assign(seg, obj)) + if(const Segment_2* seg = std::get_if(&(*obj))) { - *o++ = make_object(Intersection_curve(seg, 1)); + *o++ = Intersection_curve(*seg, 1); return o; } - Point_2 p; - if(assign(p, obj)) + if(const Point_2* p = std::get_if(&(*obj))) { - *o++ = make_object(p); + *o++ = *p; return o; } return o; diff --git a/Envelope_3/include/CGAL/Env_sphere_traits_3.h b/Envelope_3/include/CGAL/Env_sphere_traits_3.h index 9dcfa59fe5c..2a42d07f0a0 100644 --- a/Envelope_3/include/CGAL/Env_sphere_traits_3.h +++ b/Envelope_3/include/CGAL/Env_sphere_traits_3.h @@ -18,7 +18,6 @@ #include -#include #include #include #include @@ -26,6 +25,8 @@ #include #include +#include + namespace CGAL { template @@ -109,28 +110,28 @@ public: Rat_point_2 proj_center = parent.project(s.center()); Rat_circle_2 circ(proj_center, s.squared_radius()); Curve_2 curve = gt_2->construct_curve_2_object()(circ); - Object objs[2]; - CGAL_assertion_code(Object *p = ) + typedef std::variant Variant; + Variant objs[2]; + + CGAL_assertion_code(Variant* p = ) parent.make_x_monotone_2_object()(curve, objs); CGAL_assertion(p == objs + 2); - X_monotone_curve_2 cv1, cv2; + const X_monotone_curve_2* cv1 = std::get_if(&(objs[0])); + const X_monotone_curve_2* cv2 = std::get_if(&(objs[1])); - CGAL_assertion(assign(cv1, objs[0])); - CGAL_assertion(assign(cv2, objs[1])); + CGAL_assertion(cv1!=nullptr); + CGAL_assertion(cv2!=nullptr); - assign(cv1, objs[0]); - assign(cv2, objs[1]); - - if (cv1.is_lower()) { - CGAL_assertion(cv2.is_upper()); - *o++ = make_object(std::make_pair(cv1, ON_POSITIVE_SIDE)); - *o++ = make_object(std::make_pair(cv2, ON_NEGATIVE_SIDE)); + if (cv1->is_lower()) { + CGAL_assertion(cv2->is_upper()); + *o++ = std::make_pair(*cv1, ON_POSITIVE_SIDE); + *o++ = std::make_pair(*cv2, ON_NEGATIVE_SIDE); } else { - CGAL_assertion(cv2.is_lower()); - *o++ = make_object(std::make_pair(cv1, ON_NEGATIVE_SIDE)); - *o++ = make_object(std::make_pair(cv2, ON_POSITIVE_SIDE)); + CGAL_assertion(cv2->is_lower()); + *o++ = std::make_pair(*cv1, ON_NEGATIVE_SIDE); + *o++ = std::make_pair(*cv2, ON_POSITIVE_SIDE); } return o; @@ -237,7 +238,7 @@ public: if (n_ys == 1) { // intersection is a point Point_2 inter_point(xs , ys[0]); - *o++ = make_object(inter_point); + *o++ = inter_point; return o; } @@ -254,7 +255,7 @@ public: Curve_2 res = ctr_cv(0, 0, 0, 2*a_diff, 0, -m, COLLINEAR, end1, end2); parent.add_curve_to_output(res, o); - //*o++ = make_object(Intersection_curve(res, TRANSVERSAL)); + //*o++ = Intersection_curve(res, TRANSVERSAL); } else { // here we have c1 == c2, b1 != b2. @@ -308,7 +309,7 @@ public: if (n_xs == 1) { // intersection is a point Point_2 inter_point(xs[0], (-2*a_diff*xs[0] + m)/(2*b_diff) ); - *o++ = make_object(inter_point); + *o++ = inter_point; return o; } @@ -328,7 +329,7 @@ public: Curve_2 res = ctr_cv(0,0,0, 2*a_diff, 2*b_diff, -m, COLLINEAR, end1, end2); parent.add_curve_to_output(res, o); - //*o++ = make_object(Intersection_curve(res, TRANSVERSAL)); + //*o++ = Intersection_curve(res, TRANSVERSAL); } } // now the potential intersection is (a part of) a circle, @@ -439,7 +440,7 @@ public: // should check if the point is in the non-negative side of the // line if (CGAL_NTS sign(la*px + lb*py +lc) != NEGATIVE) - *o++ = make_object(Point_2(px, py)); + *o++ = Point_2(px, py); return o; } @@ -460,7 +461,7 @@ public: if (sign_lc != NEGATIVE) { Curve_2 res = ctr_cv(R, S, T, U, V, W); parent.add_curve_to_output(res, o); - //*o++ = make_object(Intersection_curve(res, TRANSVERSAL)); + //*o++ = Intersection_curve(res, TRANSVERSAL); } return o; } @@ -609,13 +610,13 @@ public: if (lval_sign == POSITIVE) { // the full ellipse is in the positive side parent.add_curve_to_output(inter_cv, o); - //*o++ = make_object(Intersection_curve(inter_cv, TRANSVERSAL)); + //*o++ = Intersection_curve(inter_cv, TRANSVERSAL); return o; } else if (lval_sign == NEGATIVE) { // the full ellipse is in the negative side, except maybe the point // source in the case n_inter_points = 1 (which lies on the line) - if (n_inter_points == 1) *o++ = make_object(Point_2(source)); + if (n_inter_points == 1) *o++ = Point_2(source); return o; } @@ -630,8 +631,8 @@ public: CGAL_assertion(lval_sign != ZERO); if (lval_sign == POSITIVE) parent.add_curve_to_output(inter_cv, o); - //*o++ = make_object(Intersection_curve(inter_cv, TRANSVERSAL)); - else *o++ = make_object(Point_2(source)); + //*o++ = Intersection_curve(inter_cv, TRANSVERSAL); + else *o++ = Point_2(source); return o; } @@ -651,7 +652,7 @@ public: Curve_2 res = ctr_cv(R, S, T, U, V, W, orient, source, target); CGAL_assertion(res.is_valid()); parent.add_curve_to_output(res, o); - //*o++ = make_object(Intersection_curve(res, TRANSVERSAL)); + //*o++ = Intersection_curve(res, TRANSVERSAL); } return o; @@ -1118,16 +1119,16 @@ public: template OutputIterator add_curve_to_output(const Curve_2& c, OutputIterator oi) const { - Object objs[2]; - Object* p_obj = this->make_x_monotone_2_object()(c, objs); - for(Object* o = objs; o != p_obj; ++o) { - X_monotone_curve_2 cv; - if(assign(cv, *o)) *oi++ = make_object(Intersection_curve(cv, 1)); + std::variant objs[2]; + + std::variant* p_obj = this->make_x_monotone_2_object()(c, objs); + for(std::variant* o = objs; o != p_obj; ++o) { + if(const X_monotone_curve_2* cv = std::get_if(o)) + *oi++ = Intersection_curve(*cv, 1); else { - Point_2 pt; - CGAL_assertion(assign(pt, *o)); - assign(pt, *o); - *oi++ = make_object(pt); + const Point_2* pt = std::get_if(o); + CGAL_assertion(pt!=nullptr); + *oi++ = *pt; } } return oi; diff --git a/Envelope_3/include/CGAL/Env_tracing_traits_3.h b/Envelope_3/include/CGAL/Env_tracing_traits_3.h index 06171831a1a..471299a7484 100644 --- a/Envelope_3/include/CGAL/Env_tracing_traits_3.h +++ b/Envelope_3/include/CGAL/Env_tracing_traits_3.h @@ -194,14 +194,15 @@ public: Base base; std::cerr << "Construct_projected_boundary_2: JUST FIRST" << std::endl; std::cerr << "Surface: " << s << std::endl; - std::list l; + // TODO UPDATE CONCEPT + CHANGES.md + std::list< std::variant, Point_2 > > l; base.construct_projected_boundary_2_object() (s, std::back_inserter(l)); if (l.size() > 0) { - std::pair i; - if (CGAL::assign(i, l.front())) - std::cerr << "First: " << i.first << std::endl; + if (const std::pair* i = + std::get_if>(&l.front())) + std::cerr << "First: " << i->first << std::endl; else std::cerr << "First intersection is a point" << std::endl; } @@ -232,15 +233,14 @@ public: << std::endl; std::cerr << "Surface1: " << s1 << std::endl; std::cerr << "Surface2: " << s2 << std::endl; - std::list l; + std::list< std::variant > l; base.construct_projected_intersections_2_object() (s1, s2, std::back_inserter(l)); if (l.size() > 0) { - Intersection_curve i; - if (CGAL::assign(i, l.front())) - std::cerr << "First: " << i.first << std::endl; + if (const Intersection_curve* i = std::get_if(&l.front())) + std::cerr << "First: " << i->first << std::endl; else std::cerr << "First intersection is not a point" << std::endl; } diff --git a/Envelope_3/include/CGAL/Env_triangle_traits_3.h b/Envelope_3/include/CGAL/Env_triangle_traits_3.h index 3587d922415..00ccc69e8fa 100644 --- a/Envelope_3/include/CGAL/Env_triangle_traits_3.h +++ b/Envelope_3/include/CGAL/Env_triangle_traits_3.h @@ -20,8 +20,6 @@ #include - -#include #include #include #include @@ -546,9 +544,9 @@ public: s2 != ON_ORIENTED_BOUNDARY && s3 != ON_ORIENTED_BOUNDARY); - *o++ = make_object(std::make_pair(A, s1)); - *o++ = make_object(std::make_pair(B, s2)); - *o++ = make_object(std::make_pair(C, s3)); + *o++ = std::make_pair(A, s1); + *o++ = std::make_pair(B, s2); + *o++ = std::make_pair(C, s3); } else { @@ -561,8 +559,8 @@ public: b2 = parent->project(a2); CGAL_assertion(b1 != b2); - *o++ = make_object(std::make_pair(X_monotone_curve_2(b1, b2), - ON_ORIENTED_BOUNDARY)); + *o++ = std::make_pair(X_monotone_curve_2(b1, b2), + ON_ORIENTED_BOUNDARY); } return o; } @@ -611,32 +609,30 @@ public: return o; } - Object inter_obj = parent->intersection(s1,s2); - if (inter_obj.is_empty()) + std::optional> inter_obj + = parent->intersection(s1,s2); + if (inter_obj == std::nullopt) { return o; } - Point_3 point; - Segment_3 curve; - if (k.assign_3_object()(point, inter_obj)) - *o++ = make_object(parent->project(point)); + if (const Point_3* point = std::get_if(&(*inter_obj))) + *o++ = parent->project(*point); else { - CGAL_assertion_code(bool b = ) - k.assign_3_object()(curve, inter_obj); - CGAL_assertion(b); + const Segment_3* curve = std::get_if(&(*inter_obj)); + CGAL_assertion(curve != nullptr); - Segment_2 proj_seg = parent->project(curve); + Segment_2 proj_seg = parent->project(*curve); if (! k.is_degenerate_2_object() (proj_seg)) { Intersection_curve inter_cv (proj_seg, 1); - *o++ = make_object(inter_cv); + *o++ = inter_cv; } else { const Point_2& p = k.construct_point_on_2_object() (proj_seg, 0); - *o++ = make_object(p); + *o++ = p; } } @@ -1044,8 +1040,9 @@ public: // intersect two xy-monotone surfaces (3D-triangles or segments) // if the triangles overlap, the result is empty // the result can be a segment or a point - Object intersection(const Xy_monotone_surface_3& s1, - const Xy_monotone_surface_3& s2) const + std::optional< std::variant> + intersection(const Xy_monotone_surface_3& s1, + const Xy_monotone_surface_3& s2) const { CGAL_precondition(s1.is_xy_monotone()); CGAL_precondition(s2.is_xy_monotone()); @@ -1054,14 +1051,13 @@ public: // first, try to intersect the bounding boxes of the triangles, // efficiently return empty object when the triangles are faraway if (!CGAL::do_overlap(s1.bbox(), s2.bbox())) - return Object(); + return std::nullopt; // if intersecting two segment - alculate the intersection // as in the case of dimension 2 if (s1.is_segment() && s2.is_segment()) { - Object res = intersection_of_segments(s1, s2); - return res; + return intersection_of_segments(s1, s2); } // if both triangles lie on the same (non-vertical) plane, they overlap @@ -1070,96 +1066,92 @@ public: Plane_3 p1 = s1.plane(); Plane_3 p2 = s2.plane(); if (p1 == p2 || p1 == p2.opposite()) - return Object(); + return std::nullopt; // calculate intersection between a triangle and the other triangle's // supporting plane // if there is no intersection - then the triangles have no intersection // between them. - Object inter_obj = intersection(p1, s2); + auto inter_obj = intersection(p1, s2); - if (inter_obj.is_empty()) - return Object(); + if (inter_obj == std::nullopt) + return std::nullopt; // otherwise, if the intersection in a point, we should check if it lies // inside the first triangle - Assign_3 assign_obj = k.assign_3_object(); - Point_3 inter_point; - if (assign_obj(inter_point, inter_obj)) + if (const Point_3* inter_point = std::get_if(&(*inter_obj))) { - Object res = intersection_on_plane_3(p1, s1, inter_point); - return res; + std::optional res = intersection_on_plane_3(p1, s1, *inter_point); + if (res != std::nullopt) + return res.value(); } else { // if the intersection is a segment, we check the intersection of the // other plane-triangle pair - Segment_3 inter_seg; - CGAL_assertion(assign_obj(inter_seg, inter_obj)); - assign_obj(inter_seg, inter_obj); + const Segment_3* inter_seg = std::get_if(&(*inter_obj)); + CGAL_assertion(inter_seg != nullptr); - inter_obj = intersection(p2, s1); + auto inter_obj2 = intersection(p2, s1); // if there is no intersection - then the triangles have no intersection // between them. - if (inter_obj.is_empty()) - return Object(); + if (inter_obj2 == std::nullopt) + return std::nullopt; - if (assign_obj(inter_point, inter_obj)) + if (const Point_3* inter_point = std::get_if(&(*inter_obj2))) { - // if the intersection is a point, which lies on the segment, - // than it is the result, - // otherwise, empty result - if (k.has_on_3_object()(inter_seg, inter_point)) - return make_object(inter_point); - else - return Object(); + // if the intersection is a point, which lies on the segment, + // than it is the result, + // otherwise, empty result + if (k.has_on_3_object()(*inter_seg, *inter_point)) + return *inter_point; + else + return std::nullopt; } else { - // both plane-triangle intersections are segments, which are collinear, - // and lie on the line which is the intersection of the two supporting - // planes - Segment_3 inter_seg2; - CGAL_assertion(assign_obj(inter_seg2, inter_obj)); - assign_obj(inter_seg2, inter_obj); + // both plane-triangle intersections are segments, which are collinear, + // and lie on the line which is the intersection of the two supporting + // planes + const Segment_3* inter_seg2 = std::get_if(&(*inter_obj)); + CGAL_assertion(inter_seg2 != nullptr); - Point_3 min1 = k.construct_min_vertex_3_object()(inter_seg), - max1 = k.construct_max_vertex_3_object()(inter_seg); - Point_3 min2 = k.construct_min_vertex_3_object()(inter_seg2), - max2 = k.construct_max_vertex_3_object()(inter_seg2); + Point_3 min1 = k.construct_min_vertex_3_object()(*inter_seg), + max1 = k.construct_max_vertex_3_object()(*inter_seg); + Point_3 min2 = k.construct_min_vertex_3_object()(*inter_seg2), + max2 = k.construct_max_vertex_3_object()(*inter_seg2); - CGAL_assertion((k.collinear_3_object()(min1, min2, max1) && + CGAL_assertion((k.collinear_3_object()(min1, min2, max1) && k.collinear_3_object()(min1, max2, max1))); - // we need to find the overlapping part, if exists - Point_3 min, max; - if (k.less_xyz_3_object()(min1, min2)) - min = min2; - else - min = min1; - if (k.less_xyz_3_object()(max1, max2)) - max = max1; - else - max = max2; + // we need to find the overlapping part, if exists + Point_3 min, max; + if (k.less_xyz_3_object()(min1, min2)) + min = min2; + else + min = min1; + if (k.less_xyz_3_object()(max1, max2)) + max = max1; + else + max = max2; - Object res; - Comparison_result comp_res = k.compare_xyz_3_object()(min, max); - if (comp_res == EQUAL) - res = make_object(min); - else if (comp_res == SMALLER) - res = make_object(Segment_3(min, max)); - // else - empty result - - return res; + Comparison_result comp_res = k.compare_xyz_3_object()(min, max); + if (comp_res == EQUAL) + return min; + else if (comp_res == SMALLER) + return Segment_3(min, max); + // else - empty result } } + return std::nullopt; } // calculate intersection between triangle & point on the same plane plane - Object intersection_on_plane_3(const Plane_3& plane, - const Xy_monotone_surface_3& triangle, - const Point_3& point) const + std::optional + intersection_on_plane_3(const Plane_3& plane, + const Xy_monotone_surface_3& triangle, + const Point_3& point) const { Kernel k; CGAL_precondition( triangle.is_xy_monotone() ); @@ -1177,14 +1169,15 @@ public: else has_on = k.has_on_3_object()(static_cast(triangle), point); if (has_on) - return make_object(point); + return point; else - return Object(); + return std::nullopt; } // calculate intersection between 2 segments on the same vertical plane plane - Object intersection_of_segments(const Xy_monotone_surface_3& s1, - const Xy_monotone_surface_3& s2) const + std::optional< std::variant> + intersection_of_segments(const Xy_monotone_surface_3& s1, + const Xy_monotone_surface_3& s2) const { Kernel k; CGAL_precondition( s1.is_xy_monotone() && s1.is_segment()); @@ -1193,14 +1186,14 @@ public: // if the segments are not coplanar, they cannot intersect if (!k.coplanar_3_object()(s1.vertex(0), s1.vertex(1), s2.vertex(0), s2.vertex(1))) - return Object(); + return std::nullopt; const Plane_3& plane = s1.plane(); if (s2.plane() != plane && s2.plane() != plane.opposite()) // todo: this case is not needed in the algorithm, // so we don't implement it - return Object(); + return std::nullopt; CGAL_precondition( !k.is_degenerate_3_object()(plane) ); CGAL_precondition( s2.plane() == plane || @@ -1212,30 +1205,24 @@ public: v2 = plane.to_2d(s1.vertex(1)); Segment_2 seg1_t(v1, v2); - Point_2 u1 = plane.to_2d(s2.vertex(0)), + Point_2 u1 = plane.to_2d(s2.vertex(0)), u2 = plane.to_2d(s2.vertex(1)); - Segment_2 seg2_t(u1, u2); + Segment_2 seg2_t(u1, u2); - Object inter_obj = k.intersect_2_object()(seg1_t, seg2_t); - Assign_2 assign_2 = k.assign_2_object(); - if (inter_obj.is_empty()) - return inter_obj; + auto inter_obj = k.intersect_2_object()(seg1_t, seg2_t); + if (inter_obj == std::nullopt) + return std::nullopt; - Point_2 inter_point; - Segment_2 inter_segment; - - if (assign_2(inter_point, inter_obj)) - return make_object(plane.to_3d(inter_point)); + if (const Point_2* inter_point = std::get_if(&(*inter_obj))) + return plane.to_3d(*inter_point); else { - CGAL_assertion_code(bool b = ) - assign_2(inter_segment, inter_obj); - CGAL_assertion(b); + const Segment_2* inter_segment = std::get_if(&(*inter_obj)); + CGAL_assertion(inter_segment!=nullptr); - return make_object - (Segment_3 - (plane.to_3d(k.construct_vertex_2_object()(inter_segment, 0)), - plane.to_3d(k.construct_vertex_2_object()(inter_segment, 1)))); + return Segment_3 + (plane.to_3d(k.construct_vertex_2_object()(*inter_segment, 0)), + plane.to_3d(k.construct_vertex_2_object()(*inter_segment, 1))); } } @@ -1244,8 +1231,9 @@ public: // and a (non degenerate) plane in 3d // the result object can be empty, a point, a segment or the original // triangle - Object intersection(const Plane_3& pl, - const Xy_monotone_surface_3& tri) const + std::optional> + intersection(const Plane_3& pl, + const Xy_monotone_surface_3& tri) const { Kernel k; CGAL_precondition( tri.is_xy_monotone() ); @@ -1278,24 +1266,23 @@ public: points_on_plane[n_points_on_plane++] = i; } - CGAL_assertion(n_points_on_plane + - n_points_on_positive + n_points_on_negative == 3); + CGAL_assertion(n_points_on_plane + n_points_on_positive + n_points_on_negative == 3); // if all vertices of tri lie on the same size (positive/negative) of pl, // there is no intersection if (n_points_on_positive == 3 || n_points_on_negative == 3) - return Object(); + return std::nullopt; // if all vertices of tri lie on pl then we return tri if (n_points_on_plane == 3) - return make_object(tri); + return tri; // if 2 vertices lie on pl, then return the segment between them if (n_points_on_plane == 2) { int point_idx1 = points_on_plane[0], point_idx2 = points_on_plane[1]; - return make_object (Segment_3(tri.vertex(point_idx1), - tri.vertex(point_idx2))); + return Segment_3(tri.vertex(point_idx1), + tri.vertex(point_idx2)); } // if only 1 lie on pl, should check the segment opposite to it on tri @@ -1306,7 +1293,7 @@ public: // if the other 2 vertices are on the same side of pl, // then the answer is just this vertex if (n_points_on_negative == 2 || n_points_on_positive == 2) - return make_object(tri.vertex(point_on_plane_idx)); + return tri.vertex(point_on_plane_idx); // now it is known that one vertex is on pl, and the segment of tri // opposite to it should intersect pl @@ -1315,15 +1302,14 @@ public: Segment_3 tri_segment(tri.vertex(point_on_plane_idx+1), tri.vertex(point_on_plane_idx+2)); - Object inter_result = k.intersect_3_object()(pl, tri_segment); - Point_3 inter_point; - CGAL_assertion( k.assign_3_object()(inter_point, inter_result) ); - k.assign_3_object()(inter_point, inter_result); + auto inter_result = k.intersect_3_object()(pl, tri_segment); + const Point_3* inter_point = std::get_if(&(*inter_result)); + CGAL_assertion( inter_point != nullptr ); // create the resulting segment // (between tri[point_on_plane_idx] and inter_point) - return make_object(Segment_3(tri.vertex(point_on_plane_idx), - inter_point)); + return Segment_3(tri.vertex(point_on_plane_idx), + *inter_point); } @@ -1341,16 +1327,14 @@ public: { Segment_3 seg(tri.vertex(points_on_positive[pos_it]), tri.vertex(points_on_negative[neg_it])); - Object inter_result = k.intersect_3_object()(pl, seg); - Point_3 inter_point; - // the result of the intersection must be a point - CGAL_assertion( k.assign_3_object()(inter_point, inter_result) ); - k.assign_3_object()(inter_point, inter_result); - inter_points[n_inter_points++] = inter_point; + auto inter_result = k.intersect_3_object()(pl, seg); + const Point_3* inter_point = std::get_if(&(*inter_result)); + CGAL_assertion( inter_point != nullptr ); + inter_points[n_inter_points++] = *inter_point; } CGAL_assertion( n_inter_points == 2 ); - return make_object(Segment_3(inter_points[0], inter_points[1])); + return Segment_3(inter_points[0], inter_points[1]); } // compare the value of s1 in p1 to the value of s2 in p2 @@ -1394,13 +1378,12 @@ public: Line_3 vl = k.construct_line_3_object() (point, dir); const Plane_3& plane = s.plane(); - Object res = k.intersect_3_object()(plane, vl); - CGAL_assertion(!res.is_empty()); - Point_3 ip; - CGAL_assertion(k.assign_3_object()(ip, res)); - k.assign_3_object()(ip, res); + auto res = k.intersect_3_object()(plane, vl); + CGAL_assertion(res != std::nullopt); + const Point_3* ip = std::get_if(&(*res)); + CGAL_assertion(ip != nullptr); - return ip; + return *ip; } } @@ -1438,12 +1421,10 @@ public: Line_2 l(tvl_point1, tvl_point2); Segment_2 seg(t1, t2); - Object inter_obj = k.intersect_2_object()(seg, l); - Point_2 inter_point; - CGAL_assertion_code(bool is_inter_point =) - k.assign_2_object()(inter_point, inter_obj); - CGAL_assertion(is_inter_point); - return plane.to_3d(inter_point); + auto inter_obj = k.intersect_2_object()(seg, l); + const Point_2* inter_point = std::get_if(&(*inter_obj)); + CGAL_assertion(inter_point != nullptr); + return plane.to_3d(*inter_point); } Point_2 construct_middle_point(const Point_2& p1, const Point_2& p2) const @@ -1495,14 +1476,11 @@ public: typename Kernel::Line_2 vl = k.construct_line_2_object() (pt, dir); // Compute the intersetion between the vertical line and the given curve. - Object res = k.intersect_2_object()(seg, vl); - Point_2 ip; - bool ray_shoot_successful = k.assign_2_object()(ip, res); + auto res = k.intersect_2_object()(seg, vl); + const Point_2* ip = std::get_if(&(*res)); + CGAL_assertion (ip != nullptr); - if (! ray_shoot_successful) - CGAL_assertion (ray_shoot_successful); - - return (ip); + return *ip; } }; diff --git a/Envelope_3/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h b/Envelope_3/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h index e0caf43d5cd..8ca94fb2049 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h +++ b/Envelope_3/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h @@ -16,65 +16,62 @@ #include -#include #include namespace CGAL { template -Object plane_half_plane_proj_intersection(const typename K::Plane_3 &h1, - const typename K::Plane_3 &h2, - const typename K::Line_2 &l, - const K& k) +std::optional< std::variant > +plane_half_plane_proj_intersection(const typename K::Plane_3 &h1, + const typename K::Plane_3 &h2, + const typename K::Line_2 &l, + const K& k) { typedef typename K::Line_3 Line_3; typedef typename K::Line_2 Line_2; typedef typename K::Plane_3 Plane_3; // intersect the two planes - Object h_obj = k.intersect_3_object()(h1, h2); - if(h_obj.is_empty()) - return Object(); // no intersection at all (parallel planes) + auto h_obj = k.intersect_3_object()(h1, h2); + if(h_obj == std::nullopt) + return std::nullopt; // no intersection at all (parallel planes) Plane_3 p; - if(assign(p, h_obj)) - return Object(); + if(std::get_if(&(*h_obj))==nullptr) + return std::nullopt; // if two planes are not parallel they must intersect at a 3D line - Line_3 l3; - CGAL_assertion_code(bool b =) - assign(l3, h_obj); - CGAL_assertion(b); + const Line_3* l3 = std::get_if(&(*h_obj)); + CGAL_assertion(l3!=nullptr); - const Line_2& proj_inter_line = project_xy(l3, k); + const Line_2& proj_inter_line = project_xy(*l3, k); - return line_under_linear_constraint(proj_inter_line, l, k); + return line_under_linear_constraint(proj_inter_line, l, k); //LR } template -Object half_plane_half_plane_proj_intersection(const typename K::Plane_3 &h1, - const typename K::Line_2 &l1, - const typename K::Plane_3 &h2, - const typename K::Line_2 &l2, - const K& k) +std::optional< std::variant > +half_plane_half_plane_proj_intersection(const typename K::Plane_3 &h1, + const typename K::Line_2 &l1, + const typename K::Plane_3 &h2, + const typename K::Line_2 &l2, + const K& k) { typedef typename K::Ray_2 Ray_2; typedef typename K::Line_2 Line_2; - Object obj = plane_half_plane_proj_intersection(h1, h2, l2, k); - if(obj.is_empty()) - return Object(); + auto obj = plane_half_plane_proj_intersection(h1, h2, l2, k); + if(obj == std::nullopt) + return std::nullopt; - Line_2 l; - if(assign(l, obj)) - return line_under_linear_constraint(l, l1, k); + if(const Line_2* line = std::get_if(&(*obj))) + return line_under_linear_constraint(*line, l1, k); - Ray_2 ray; - if(assign(ray, obj)) - return ray_under_linear_constraint(ray, l1, k); + if(const Ray_2* ray = std::get_if(&(*obj))) + return ray_under_linear_constraint(*ray, l1, k); CGAL_error(); // doesn't suppose to reach here - return Object(); + return std::nullopt; } template @@ -97,96 +94,91 @@ typename K::Line_2 project_xy(const typename K::Line_3& l, // l1 is a line, l2 is a linear constraint (determined by the direction // of the line). template -Object line_under_linear_constraint(const typename K::Line_2& l1, - const typename K::Line_2& l2, - const K& k) +std::optional< std::variant > +line_under_linear_constraint(const typename K::Line_2& l1, + const typename K::Line_2& l2, + const K& k) { typedef typename K::Ray_2 Ray_2; - typedef typename K::Line_2 Line_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Point_2 Point_2; - Object obj = k.intersect_2_object()(l1, l2); - Point_2 p; - if(assign(p, obj)) - { - const Vector_2& vec = k.construct_vector_2_object()(l1); - const Point_2& s = k.construct_translated_point_2_object()(p, vec); - const Ray_2& ray = k.construct_ray_2_object()(p, s); - Oriented_side side = k.oriented_side_2_object()(l2, s); - if(side == ON_NEGATIVE_SIDE) - { - return make_object(k.construct_opposite_ray_2_object()(ray)); - } + auto obj = k.intersect_2_object()(l1, l2); - CGAL_assertion(side == ON_POSITIVE_SIDE); //the two lines are not parallel - return make_object(ray); - } - - if(obj.is_empty()) // the two lines are parallel + if(obj == std::nullopt)// the two lines are parallel { const Point_2& s = k.construct_point_on_2_object()(l1, 0); Oriented_side side = k.oriented_side_2_object()(l2, s); if(side == ON_NEGATIVE_SIDE) - return Object(); + return std::nullopt; CGAL_assertion(side == ON_POSITIVE_SIDE); // the two lines are parallel - return make_object(l1); + return l1; + } + + if(const Point_2* p = std::get_if(&(*obj))) + { + const Vector_2& vec = k.construct_vector_2_object()(l1); + const Point_2& s = k.construct_translated_point_2_object()(*p, vec); + const Ray_2& ray = k.construct_ray_2_object()(*p, s); + Oriented_side side = k.oriented_side_2_object()(l2, s); + if(side == ON_NEGATIVE_SIDE) + { + return k.construct_opposite_ray_2_object()(ray); + } + + CGAL_assertion(side == ON_POSITIVE_SIDE); //the two lines are not parallel + return ray; } // the two lines overlap - CGAL_USE_TYPE(Line_2); - CGAL_assertion_code(Line_2 dummy;); - CGAL_assertion_code(bool b = assign(dummy, obj);); - CGAL_assertion(b); - - return make_object(l1); + return l1; } template -Object ray_under_linear_constraint(const typename K::Ray_2& ray, - const typename K::Line_2& l, - const K& k) +std::optional< std::variant > +ray_under_linear_constraint(const typename K::Ray_2& ray, + const typename K::Line_2& l, + const K& k) { typedef typename K::Vector_2 Vector_2; typedef typename K::Point_2 Point_2; const Point_2& s = k.construct_point_on_2_object()(ray, 0); Oriented_side side = k.oriented_side_2_object()(l, s); - Object obj = k.intersect_2_object()(ray, l); - if(obj.is_empty()) + auto obj = k.intersect_2_object()(ray, l); + if(obj == std::nullopt) { if(side == ON_NEGATIVE_SIDE) - return Object(); + return std::nullopt; CGAL_assertion(side == ON_POSITIVE_SIDE); - return make_object(ray); + return ray; } - Point_2 p; - if(assign(p, obj)) + if(const Point_2* p = std::get_if(&(*obj))) { if(side == ON_POSITIVE_SIDE) - return make_object(k.construct_segment_2_object()(s, p)); + return k.construct_segment_2_object()(s, *p); Vector_2 vec = k.construct_vector_2_object()(ray); if(side == ON_NEGATIVE_SIDE) - return make_object(k.construct_ray_2_object()(p, vec)); + return k.construct_ray_2_object()(*p, vec); CGAL_assertion(side == ON_ORIENTED_BOUNDARY); const Vector_2& vec_of_l = k.construct_vector_2_object()(l); Orientation orient = k.orientation_2_object()(vec_of_l, vec); if(orient == LEFT_TURN) - return make_object(ray); + return ray; CGAL_assertion(orient == RIGHT_TURN); - return make_object(s); + return s; } // the ray and the line overlap - return make_object(ray); + return ray; } diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h index 35b172c6233..a15422a19d2 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -307,9 +306,8 @@ protected: void deal_with_one_surface(Xy_monotone_surface_3& surf, Minimization_diagram_2& result) { - typedef std::list Boundary_list; typedef std::pair Boundary_xcurve; - typedef Boundary_list::iterator Boundary_iterator; + typedef std::list> Boundary_list; Boundary_list boundary; m_geom_traits-> @@ -325,17 +323,15 @@ protected: return; } - for (Boundary_iterator boundary_it = boundary.begin(); + for (auto boundary_it = boundary.begin(); boundary_it != boundary.end(); ++boundary_it) { - const Object& obj = *boundary_it; - Boundary_xcurve boundary_cv; - if (assign(boundary_cv, obj)) + if (const Boundary_xcurve* boundary_cv = std::get_if(&(*boundary_it))) { - Oriented_side side = boundary_cv.second; + Oriented_side side = boundary_cv->second; Halfedge_handle he = - insert_non_intersecting_curve(result, boundary_cv.first); + insert_non_intersecting_curve(result, boundary_cv->first); if (side == ON_ORIENTED_BOUNDARY) { @@ -408,10 +404,9 @@ protected: else { // the xy-surface is an isolated point - Point_2 p; - CGAL_assertion(assign(p, obj)); - assign(p, obj); - insert_point(result, p); + const Point_2* p = std::get_if(&(*boundary_it)); + CGAL_assertion(p!=nullptr); + insert_point(result, *p); } } diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h index 0376a0c1119..e5184ba9a2a 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h @@ -131,7 +131,8 @@ protected: Vertices_to_edges_map; typedef std::pair Intersection_curve; - typedef std::list Intersections_list; + typedef std::list> Intersections_list; // this is used in the resolve edge process typedef Triple Point_2_with_info; @@ -199,7 +200,8 @@ public: // find the projected intersections of the surfaces. if none - we have // a simple case: // need only resolve non-intersecting and return - std::list inter_objs; + std::list> inter_objs; + get_projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); if (inter_objs.size() == 0) @@ -243,11 +245,6 @@ public: map_copied_to_orig_faces[copied_face] = face; - // insert the projected intersections into the temporary minimization diagram - Point_2 point; - Intersection_curve curve; - Object cur_obj; - // we use our zone visitor, which only inserts into the arrangement the // points and curves which are inside the copied face // it updates the result arrangement at the same time (action after action @@ -287,12 +284,10 @@ public: this); Md_point_location pl(copied_face_arr); - std::list::iterator inter_objs_it = inter_objs.begin(); - for (; inter_objs_it != inter_objs.end(); ++inter_objs_it) + for (auto inter_objs_it = inter_objs.begin(); + inter_objs_it != inter_objs.end(); ++inter_objs_it) { - cur_obj = *inter_objs_it; - CGAL_assertion(!cur_obj.is_empty()); - if (assign(point, cur_obj)) + if (const Point_2* point = std::get_if(&(*inter_objs_it))) { // intersection can be a point when the surfaces only touch each other. // we are only interested in the points that are inside the face or @@ -302,12 +297,12 @@ public: // should use observer for split_edge // if not in a sub-face of "face", shouldn't insert it // the above information is available in zone_visitor - insert_point(copied_face_arr, point, pl, zone_visitor); + insert_point(copied_face_arr, *point, pl, zone_visitor); } - else if (assign(curve, cur_obj)) + else if (const Intersection_curve* curve = std::get_if(&(*inter_objs_it))) { - zone_visitor.set_current_intersection_type(curve.second); - insert(copied_face_arr, curve.first, pl, zone_visitor); + zone_visitor.set_current_intersection_type(curve->second); + insert(copied_face_arr, curve->first, pl, zone_visitor); CGAL_assertion(copied_face_arr.is_valid()); CGAL_assertion(result.is_valid()); } @@ -485,7 +480,7 @@ public: const Xy_monotone_surface_3& surf2 = get_aux_surface(edge, 1); // find the projected intersections - std::list inter_objs; + std::list> inter_objs; get_projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); if (inter_objs.size() == 0) @@ -522,48 +517,38 @@ public: bool is_min_end_at_inf = false; bool is_max_end_at_inf = false; - Point_2 point; - Intersection_curve icurve; - Object cur_obj; - - std::list::iterator inter_objs_it = inter_objs.begin(); - for (; inter_objs_it != inter_objs.end(); ++inter_objs_it) + for (auto inter_objs_it = inter_objs.begin(); + inter_objs_it != inter_objs.end(); ++inter_objs_it) { - cur_obj = *inter_objs_it; - CGAL_assertion(!cur_obj.is_empty()); - if (assign(point, cur_obj)) + if (const Point_2* point = std::get_if(&(*inter_objs_it))) { // if the point is on the curve, should add it the split points // list, otherwise, it is irrelevant and should be ignored - if (is_point_on_curve(point, original_cv)) - split_points.push_back(Point_2_with_info(point, false, false)); + if (is_point_on_curve(*point, original_cv)) + split_points.push_back(Point_2_with_info(*point, false, false)); } - else if (assign(icurve, cur_obj)) + else if (const Intersection_curve* icurve = std::get_if(&(*inter_objs_it))) { - const X_monotone_curve_2& x_curve = icurve.first; + const X_monotone_curve_2& x_curve = icurve->first; // find the intersection points and overlapping segments with the // original curve and insert them to the list of split points // intersect the x-monotone curve with the edge's curve typedef std::pair Intersect_point_2; - std::list intersections_list; - const Intersect_point_2* ip; - const X_monotone_curve_2* icv; + std::list> intersections_list; m_traits->intersect_2_object()(x_curve, original_cv, std::back_inserter(intersections_list)); - std::list::iterator inter_it = intersections_list.begin(); - for (; inter_it != intersections_list.end(); ++inter_it) + for (auto inter_it = intersections_list.begin(); inter_it != intersections_list.end(); ++inter_it) { - ip = object_cast(&(*inter_it)); - if (ip != nullptr) + if (const Intersect_point_2* ip = std::get_if(&(*inter_it))) { split_points.push_back(Point_2_with_info(ip->first, false, false)); } else { - icv = object_cast(&(*inter_it)); + const X_monotone_curve_2* icv = std::get_if(&(*inter_it)); CGAL_assertion(icv != nullptr); // we will add the *icv end points to the split_points, unless @@ -791,15 +776,15 @@ protected: const Vertex_const_handle* vh; Vertex_handle vh_for_p; - CGAL::Object obj = pl.locate(p); + auto obj = pl.locate(p); visitor.init(&arr); - if ((fh = object_cast(&obj)) + if ((fh = std::get_if(&obj)) != nullptr) { vh_for_p = visitor.found_point_in_face(p, arr.non_const_handle(*fh)); } - else if ((hh = object_cast(&obj)) != nullptr) + else if ((hh = std::get_if(&obj))) { vh_for_p = visitor.found_point_on_edge(p , arr.non_const_handle(*hh)); } @@ -807,7 +792,7 @@ protected: { // In this case p lies on an existing vertex, so we just update this // vertex. - vh = object_cast(&obj); + vh = std::get_if(&obj); CGAL_assertion(vh != nullptr); vh_for_p = visitor.found_point_on_vertex(p, arr.non_const_handle(*vh)); } diff --git a/Envelope_3/test/Envelope_3/Envelope_test_3.h b/Envelope_3/test/Envelope_3/Envelope_test_3.h index 997c4aced68..80656676ca7 100644 --- a/Envelope_3/test/Envelope_3/Envelope_test_3.h +++ b/Envelope_3/test/Envelope_3/Envelope_test_3.h @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -116,49 +115,41 @@ public: Xy_monotone_surface_3 &cur_surface = surfaces[i]; // first insert all the projected curves of the boundary of the current surface // collect the curve in this list, and use sweepline at the end - std::list boundary_list; typedef std::pair Boundary_xcurve; + std::list> boundary_list; - typedef std::list::const_iterator Boundary_iterator; traits.construct_projected_boundary_2_object()(cur_surface, std::back_inserter(boundary_list)); - for(Boundary_iterator boundary_it = boundary_list.begin(); + for(auto boundary_it = boundary_list.begin(); boundary_it != boundary_list.end(); ++boundary_it) { - const Object& obj = *boundary_it; - Boundary_xcurve boundary_cv; - assert(assign(boundary_cv, obj)); - assign(boundary_cv, obj); - curves_col.push_back(boundary_cv.first); + const Boundary_xcurve* boundary_cv = std::get_if(&(*boundary_it)); + assert(boundary_cv!=nullptr); + curves_col.push_back(boundary_cv->first); } // second, intersect it with all surfaces before it - Object cur_obj; for(j=0; j inter_objs; + std::vector> inter_objs; traits.construct_projected_intersections_2_object()(cur_surface, prev_surface, std::back_inserter(inter_objs)); // we collect all intersections and use sweep to insert them - Point_2 point; - Intersection_curve curve; for(std::size_t k=0; k(&inter_objs[k])) { #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 std::cout << "intersection between surfaces is a point: " << point << std::endl; #endif //insert_vertex(result, point, pl); - points_col.push_back(point); + points_col.push_back(*point); } - else if (CGAL::assign(curve, cur_obj)) + else if (const Intersection_curve* curve = std::get_if(&inter_objs[k])) { - curves_col.push_back(curve.first); + curves_col.push_back(curve->first); /*#ifdef CGAL_DEBUG_ENVELOPE_TEST_3 std::cout << "intersection between surfaces is a curve: " << curve.first << std::endl; #endif diff --git a/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h b/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h index 29577fefa43..194b9fb7a12 100644 --- a/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h +++ b/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -130,48 +129,40 @@ public: #endif // collect the curve in this list, and use sweepline at the end - std::list boundary_list; typedef std::pair Boundary_xcurve; + std::list> boundary_list; traits.construct_projected_boundary_2_object() (cur_surface, std::back_inserter(boundary_list)); - std::list::const_iterator bit; - for (bit = boundary_list.begin(); bit != boundary_list.end(); ++bit) { - const Object& obj = *bit; - Boundary_xcurve boundary_cv; - assert(assign(boundary_cv, obj)); - assign(boundary_cv, obj); - curves_col.push_back(boundary_cv.first); + for (auto bit = boundary_list.begin(); bit != boundary_list.end(); ++bit) { + const Boundary_xcurve* boundary_cv = std::get_if(&(*bit)); + assert(boundary_cv!=nullptr); + curves_col.push_back(boundary_cv->first); } // second, intersect it with all surfaces before it - Object cur_obj; for (unsigned int j = 0; j < i; ++j) { Xy_monotone_surface_3& prev_surface = surfaces[j]; - std::vector inter_objs; + std::vector> inter_objs; traits.construct_projected_intersections_2_object() (cur_surface, prev_surface, std::back_inserter(inter_objs)); // we collect all intersections and use sweep to insert them - Point_2 point; - Intersection_curve curve; for(std::size_t k=0; k(&inter_objs[k])) { #ifdef CGAL_DEBUG_ENVELOPE_TRIANGLES_TEST_3 std::cout << "intersection between surfaces is a point: " << point << std::endl; #endif //insert_vertex(result, point, pl); - points_col.push_back(point); + points_col.push_back(*point); } - else if (CGAL::assign(curve, cur_obj)) { + else if (const Intersection_curve* curve = std::get_if(&inter_objs[k])) { #ifdef CGAL_DEBUG_ENVELOPE_TRIANGLES_TEST_3 std::cout << "intersection between surfaces is a curve: " << curve.first << std::endl; #endif - curves_col.push_back(curve.first); + curves_col.push_back(curve->first); //insert(result, curve.first, pl); } else @@ -262,20 +253,17 @@ public: // foreach face in the test envelope, compute a point inside the face, // locate it in the other envelope and compare the surfaces over the 2 faces Md_point_location pl(env); - Object pl_obj; - Face_const_handle pl_fh; - Face_iterator fi = test_env.faces_begin(); bool eq, result = true; for (; fi != test_env.faces_end(); ++fi) { Face_handle fh = fi; if (!fh->is_unbounded()) { Point_2 inside_test = compute_point_inside_face(test_env, fh); - pl_obj = pl.locate(inside_test); + auto pl_obj = pl.locate(inside_test); // faces of env must contain the faces of test - bool located_in_face = assign(pl_fh, pl_obj); - assert(located_in_face); - eq = fh->is_equal_data(pl_fh->begin_data(), pl_fh->end_data()); + const Face_const_handle* pl_fh = std::get_if(&pl_obj); + assert(pl_fh!=nullptr); + eq = fh->is_equal_data((*pl_fh)->begin_data(), (*pl_fh)->end_data()); assert(eq); result &= eq; } diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h index e2909ff4dd0..b21d123ab68 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h @@ -15,14 +15,14 @@ #include #include -#include +#include namespace CGAL { // This class should go away. // It is now only used by the Filtered_kernel. // It allows to iterate over the coordinates of both a Point_2 and a Vector_2, -// using a boost::variant, as the iterator types are the same at the kernel level. +// using a std::variant, as the iterator types are the same at the kernel level. template class Cartesian_coordinate_iterator_2 @@ -31,7 +31,7 @@ class Cartesian_coordinate_iterator_2 protected: typedef typename K::Point_2 P; typedef typename K::Vector_2 V; - boost::variant var; + std::variant var; int index; typedef Cartesian_coordinate_iterator_2 Self; @@ -57,9 +57,9 @@ public: reference operator*() const { - if (const P* const* p = boost::get(&var)) + if (const P* const* p = std::get_if(&var)) return (*p)->cartesian(index); - const V* const* v = boost::get(&var); + const V* const* v = std::get_if(&var); CGAL_assertion(v != 0); return (*v)->cartesian(index); } diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h index c5a16320dc0..2dfc7bcf27d 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h @@ -15,14 +15,14 @@ #include #include -#include +#include namespace CGAL { // This class should go away. // It is now only used by the Filtered_kernel. // It allows to iterate over the coordinates of both a Point_3 and a Vector_3, -// using a boost::variant, as the iterator types are the same at the kernel level. +// using a std::variant, as the iterator types are the same at the kernel level. template class Cartesian_coordinate_iterator_3 @@ -31,7 +31,7 @@ class Cartesian_coordinate_iterator_3 protected: typedef typename K::Point_3 P; typedef typename K::Vector_3 V; - boost::variant var; + std::variant var; int index; typedef Cartesian_coordinate_iterator_3 Self; @@ -57,9 +57,9 @@ public: reference operator*() const { - if (const P* const* p = boost::get(&var)) + if (const P* const* p = std::get_if(&var)) return (*p)->cartesian(index); - const V* const* v = boost::get(&var); + const V* const* v = std::get_if(&var); CGAL_assertion(v != 0); return (*v)->cartesian(index); } diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h b/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h index c0b2e2179ca..991fe8247b5 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -31,7 +31,7 @@ class Filtered_predicate_with_state C2E c2e; C2A c2a; O1 o1; - mutable boost::optional oep; + mutable std::optional oep; AP ap; typedef typename AP::result_type Ares; diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 43d6a5ddc11..f8c7a62cdbc 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #ifdef CGAL_LAZY_KERNEL_DEBUG # include #endif @@ -1196,7 +1196,7 @@ struct Lazy_construction_optional_for_polygonal_envelope typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; typedef typename LK::E2A E2A; - typedef boost::optional result_type; + typedef std::optional result_type; CGAL_NO_UNIQUE_ADDRESS AC ac; CGAL_NO_UNIQUE_ADDRESS EC ec; @@ -1209,9 +1209,9 @@ struct Lazy_construction_optional_for_polygonal_envelope { Protect_FPU_rounding P; try { - boost::optional oap = ac(CGAL::approx(l1),CGAL::approx(l2),CGAL::approx(l3)); - if(oap == boost::none){ - return boost::none; + std::optional oap = ac(CGAL::approx(l1),CGAL::approx(l2),CGAL::approx(l3)); + if(oap == std::nullopt){ + return std::nullopt; } // Now we have to construct a rep for a lazy point with the three lazy planes. typedef Lazy_rep_optional_n LazyPointRep; @@ -1221,21 +1221,21 @@ struct Lazy_construction_optional_for_polygonal_envelope // rep = LazyPointRep(2,ap, ec, l1, l2, l3); rep.~LazyPointRep(); new (&rep) LazyPointRep(2, ap, ec, l1, l2, l3); typename LK::Point_3 lp(&rep); - return boost::make_optional(lp); + return std::make_optional(lp); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P2(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - boost::optional oep = ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); - if(oep == boost::none){ - return boost::none; + std::optional oep = ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); + if(oep == std::nullopt){ + return std::nullopt; } typedef Lazy_rep_0 LazyPointRep; const typename EK::Point_3 ep = *oep; LazyPointRep *rep = new LazyPointRep(ep); typename LK::Point_3 lp(rep); - return boost::make_optional(lp); + return std::make_optional(lp); } // for Intersect_point_3 with Plane_3 Line_3 @@ -1246,9 +1246,9 @@ struct Lazy_construction_optional_for_polygonal_envelope { Protect_FPU_rounding P; try { - boost::optional oap = ac(CGAL::approx(l1),CGAL::approx(l2)); - if(oap == boost::none){ - return boost::none; + std::optional oap = ac(CGAL::approx(l1),CGAL::approx(l2)); + if(oap == std::nullopt){ + return std::nullopt; } // Now we have to construct a rep for a lazy point with the line and the plane. typedef Lazy_rep_optional_n LazyPointRep; @@ -1258,21 +1258,21 @@ struct Lazy_construction_optional_for_polygonal_envelope // rep = LazyPointRep(2, ap, ec, l1, l2); rep.~LazyPointRep(); new (&rep) LazyPointRep(2, ap, ec, l1, l2); typename LK::Point_3 lp(&rep); - return boost::make_optional(lp); + return std::make_optional(lp); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P2(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - boost::optional oep = ec(CGAL::exact(l1), CGAL::exact(l2)); - if(oep == boost::none){ - return boost::none; + std::optional oep = ec(CGAL::exact(l1), CGAL::exact(l2)); + if(oep == std::nullopt){ + return std::nullopt; } typedef Lazy_rep_0 LazyPointRep; const typename EK::Point_3 ep = *oep; LazyPointRep *rep = new LazyPointRep(ep); typename LK::Point_3 lp(rep); - return boost::make_optional(lp); + return std::make_optional(lp); } }; @@ -1425,19 +1425,19 @@ struct Ith_for_intersection_with_variant { : i(i_) {} - template< BOOST_VARIANT_ENUM_PARAMS(typename U) > + template< typename ... U > const T2& - operator()(const boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const + operator()(const std::optional< std::variant< U ... > >& o) const { - const std::vector* ptr = (boost::get >(&(*o))); + const std::vector* ptr = (std::get_if >(&(*o))); return (*ptr)[i]; } - template< BOOST_VARIANT_ENUM_PARAMS(typename U) > + template< typename ... U > const T2& - operator()(const boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) >& o) const + operator()(const std::variant< U ... >& o) const { - const std::vector* ptr = (boost::get >(&o)); + const std::vector* ptr = (std::get_if >(&o)); return (*ptr)[i]; } }; @@ -1856,26 +1856,26 @@ template struct Variant_cast { typedef T result_type; - template + template const T& - operator()(const boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const { + operator()(const std::optional< std::variant< U ... > >& o) const { // can throw but should never because we always build it inside // a static visitor with the right type - return boost::get(*o); + return std::get(*o); } - template + template T& - operator()(boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const { + operator()(std::optional< std::variant< U ... > >& o) const { // can throw but should never because we always build it inside // a static visitor with the right type, if it throws bad_get - return boost::get(*o); + return std::get(*o); } }; template -struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { +struct Fill_lazy_variant_visitor_2 { Fill_lazy_variant_visitor_2(Result& r, Origin& o) : r(&r), o(&o) {} Result* r; Origin* o; @@ -1912,7 +1912,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { }; template -struct Fill_lazy_variant_visitor_0 : boost::static_visitor<> { +struct Fill_lazy_variant_visitor_0 { Fill_lazy_variant_visitor_0(Result& r) : r(&r) {} Result* r; @@ -1998,7 +1998,7 @@ struct Lazy_construction_variant { // the static visitor fills the result_type with the correct unwrapped type internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - boost::apply_visitor(visitor, *approx_v); + std::visit(visitor, *approx_v); return res; } catch (Uncertain_conversion_exception&) {} @@ -2014,7 +2014,7 @@ struct Lazy_construction_variant { } internal::Fill_lazy_variant_visitor_0 visitor(res); - boost::apply_visitor(visitor, *exact_v); + std::visit(visitor, *exact_v); return res; } @@ -2052,7 +2052,7 @@ struct Lazy_construction_variant { // the static visitor fills the result_type with the correct unwrapped type internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - boost::apply_visitor(visitor, *approx_v); + std::visit(visitor, *approx_v); return res; } catch (Uncertain_conversion_exception&) {} @@ -2068,7 +2068,7 @@ struct Lazy_construction_variant { } internal::Fill_lazy_variant_visitor_0< result_type, AK, LK, EK> visitor(res); - boost::apply_visitor(visitor, *exact_v); + std::visit(visitor, *exact_v); return res; } }; diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 702ded2525d..911a86debc3 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -177,7 +177,7 @@ private: // The case distinction goes as follows: // result_type == FT => NT // result_type == Object => Object - // result_type == boost::optional => OPTIONAL_ Only for Intersect_point_3_for_polyhedral_envelope which returns a handle for a singleton + // result_type == std::optional => OPTIONAL_ Only for Intersect_point_3_for_polyhedral_envelope which returns a handle for a singleton // result_type == Bbox_2 || result_type == Bbox_3 => BBOX // default => NONE // no result_type => NONE @@ -187,7 +187,7 @@ private: // specializations inside a non-namespace scope. // The default implementation does some default handling, // the special cases are filtered by partial specializations. - template + template struct Lazy_wrapper_traits : boost::mpl::eval_if< internal::Has_result_type, boost::mpl::eval_if< std::is_same< std::remove_cv_t< diff --git a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp index 041f6022a0e..dd998fce87c 100644 --- a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp +++ b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp @@ -42,7 +42,7 @@ int main() } V = nullptr; - if( !(V = boost::get >(&(*o_variant))) ){ + if( !(V = std::get_if >(&(*o_variant))) ){ std::cerr << "ERROR, something other than vector< point_2 >" << std::endl; return EXIT_FAILURE; } @@ -82,7 +82,7 @@ int main() } V = nullptr; - if( !(V = boost::get > (&(*o_variant))) ){ + if( !(V = std::get_if > (&(*o_variant))) ){ std::cerr << "ERROR" << std::endl; return EXIT_FAILURE; } diff --git a/Generalized_map/doc/Generalized_map/Generalized_map.txt b/Generalized_map/doc/Generalized_map/Generalized_map.txt index ec178eb6dc1..04c4b9c30a8 100644 --- a/Generalized_map/doc/Generalized_map/Generalized_map.txt +++ b/Generalized_map/doc/Generalized_map/Generalized_map.txt @@ -399,6 +399,8 @@ Example of \link GenericMap::insert_cell_1_in_cell_2 `insert_cell_1_in_cell_2`\e `gm.`\link GenericMap::insert_dangling_cell_1_in_cell_2 `insert_dangling_cell_1_in_cell_2(d0)`\endlink adds a 1-cell in the 2-cell containing dart `d0`, the 1-cell being attached by only one of its vertex to the 0-cell containing dart `d0`. This operation is possible if `d0` \f$ \in \f$ \link GenericMap::darts `gm.darts()`\endlink. +`gm.`\link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2(d1,d2)`\endlink adds a 1-cell between the two faces containing containing darts `d1` and `d2`, between the two 0-cells containing darts `d1` and `d2`. The 2-cells are merged in one. This operation is possible if d1\f$ \not \in \f$ \f$ \langle{}\f$\f$ \alpha_0, \alpha_1\f$\f$ \rangle{}\f$(d2) which can be tested thanks to `gm.`\link GenericMap::is_insertable_cell_1_between_two_cells_2 `is_insertable_cell_1_between_two_cells_2(d1,d2)`\endlink. + `gm.`\link GenericMap::insert_cell_2_in_cell_3 `insert_cell_2_in_cell_3(itbegin,itend)`\endlink adds a 2-cell in the 3-cell containing all the darts between `itbegin` and `itend`, along the path of 1-cells containing darts in [`itbegin`,`itend`). The 3-cell is split in two. This operation is possible if all the darts in [`itbegin`,`itend`) form a closed path inside a same 3-cell which can be tested thanks to `gm.`\link GenericMap::is_insertable_cell_2_in_cell_3 `is_insertable_cell_2_in_cell_3(itbegin,itend)`\endlink (see example on \cgalFigureRef{fig_gmap_insert_facet}). \cgalFigureBegin{fig_gmap_insert_facet,gmap_insert_facet.svg} @@ -478,6 +480,24 @@ The second line is the result after the removal operations. We retrieve the orig Example of high level operations. Left: Initial 3D generalized map after the creation of the generalized hexahedron. Middle: Generalized map obtained after the two 1-cell insertions. The two 2-cells were split in two. Right: Generalized map obtained after the 2-cell insertion. The 3-cell was split in two. \cgalFigureEnd +\subsection Generalized_mapInsertion Insert an edge between two different faces + +\anchor ssecexempleinsertiongmap + +This example shows the use of \link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2`\endlink operation. First we create a combinatorial hexahedron and a face with 4 edges. This face is inserted in the face of the hexahedron containing dart d1. We display the characteristics of the generalized map and check its validity. Then we count and display the number of 2-free darts. + +\cgalExample{Generalized_map/gmap_3_insert.cpp} + +The output is: +\verbatim +#Darts=60, #0-cells=12, #1-cells=17, #2-cells=6, #3-cells=1, #ccs=1, orientable=true, valid=1 +Number of 2-free darts: 8 +\endverbatim + +We can verify that there are 6 2-cells after the insertion since the squared face was inserted as a hole in one face of the hexahedron. We can also see that there are 8 2-free darts, which are the darts of the squared face. Since they bound an hole, there is no face filling the hole and thus 8 darts are 2-free. + +See also a similar example for Linear cell complex \ref Linear_cell_complexInsert "Insert an Edge Between Two Different Faces". + \subsection Generalized_mapA4DGeneralizedMap A 4D Generalized Map In this example, a 4-dimensional generalized map is used. Two tetrahedral cells are created and sewn by \f$ \alpha_4\f$. Then the numbers of cells of the generalized map are displayed, and its validity is checked. diff --git a/Generalized_map/doc/Generalized_map/examples.txt b/Generalized_map/doc/Generalized_map/examples.txt index c38131ac9fb..1ea597a3975 100644 --- a/Generalized_map/doc/Generalized_map/examples.txt +++ b/Generalized_map/doc/Generalized_map/examples.txt @@ -7,4 +7,5 @@ \example Generalized_map/gmap_3_with_colored_facets.cpp \example Generalized_map/gmap_3_dynamic_onmerge.cpp \example Generalized_map/gmap_3_index.cpp +\example Generalized_map/gmap_3_insert.cpp */ diff --git a/Generalized_map/examples/Generalized_map/gmap_3_insert.cpp b/Generalized_map/examples/Generalized_map/gmap_3_insert.cpp new file mode 100644 index 00000000000..56c4a5cbd2f --- /dev/null +++ b/Generalized_map/examples/Generalized_map/gmap_3_insert.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +typedef CGAL::Generalized_map<3> GMap_3; +typedef GMap_3::Dart_descriptor Dart_descriptor; + +int main() +{ + GMap_3 gm; + + // Create one combinatorial hexahedron + Dart_descriptor d1 = gm.make_combinatorial_hexahedron(); + + // Create one square face + Dart_descriptor d2=gm.make_combinatorial_polygon(4); + + assert(gm.is_insertable_cell_1_between_two_cells_2(d1,d2)); + + // Insert the square face as a hole of the face of the hexahedron containing d1 + gm.insert_cell_1_between_two_cells_2(d1, d2); + + // Display the combinatorial map characteristics. + gm.display_characteristics(std::cout)<<", valid=" + <(dh)) ++nb; } + std::cout<<"Number of 2-free darts: "<::value>=0, "set_attribute but i-attributes are disabled"); - for ( typename Dart_of_cell_range::iterator it(*this, dh); - it.cont(); ++it) + for (typename Dart_of_cell_range::iterator it(*this, dh); + it.cont(); ++it) { this->template set_dart_attribute(it, ah); } + if(ah!=null_descriptor) + // To ensure that the dart of this attribute is dh + { this->template set_dart_of_attribute(ah, dh); } } /// @return a Attributes_range (range through all the @@ -3512,7 +3515,9 @@ namespace CGAL { bool is_insertable_cell_1_in_cell_2(Dart_const_descriptor adart1, Dart_const_descriptor adart2) { - if ( adart1==adart2 || adart1==this->template alpha<0>(adart2) ) + if (adart2==null_descriptor) return true; + if (adart1==adart2 || adart1==this->template alpha<0>(adart2) || + adart1==null_descriptor || this->template is_free<1>(adart2)) return false; for ( CGAL::GMap_dart_const_iterator_of_orbit it(*this,adart1); it.cont(); ++it ) @@ -3525,29 +3530,104 @@ namespace CGAL { /** Insert an edge in a 2-cell between two given darts. * @param adart1 a first dart of the facet (!=null_descriptor && !=null_dart_descriptor). * @param adart2 a second dart of the facet. If null_descriptor insert a dangling edge. + * @param update_attributes a boolean to update the enabled attributes * @return a dart of the new edge, and not incident to the * same vertex than adart1. */ Dart_descriptor insert_cell_1_in_cell_2(Dart_descriptor adart1, - Dart_descriptor adart2, - bool update_attributes=true, - typename Attribute_descriptor<0>::type - ah=null_descriptor) + Dart_descriptor adart2, + typename Attribute_descriptor<0>:: + type ah=null_descriptor, + bool update_attributes=true) { - if ( adart2!=null_descriptor) - { - CGAL_assertion(is_insertable_cell_1_in_cell_2(adart1, adart2)); - } + CGAL_assertion(is_insertable_cell_1_in_cell_2(adart1, adart2)); + return generic_insert_cell_1(adart1, adart2, false, update_attributes, ah); + } + /** Test if an edge can be inserted between two different 2-cells + * between two given darts. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @return true iff an edge can be inserted between adart1 and adart2. + */ + bool is_insertable_cell_1_between_two_cells_2(Dart_const_descriptor adart1, + Dart_const_descriptor adart2) const + { + if (adart1==adart2 || adart1==null_descriptor || adart2==null_descriptor) + { return false; } + for ( CGAL::GMap_dart_const_iterator_of_orbit it(*this,adart1); + it.cont(); ++it ) + { + if ( it==adart2 ) return false; + } + for(unsigned int d=3; d<=dimension; ++d) + { if(is_free(adart1, d)!=is_free(adart2, d)) { return false; }} + + return true; + } + + /** Insert an edge between two different 2-cells, between two given darts. + * @param adart1 a first dart of the first facet (!=null_descriptor && !=null_dart_descriptor). + * @param adart2 a second dart of the second facet (!=null_descriptor && !=null_dart_descriptor). + * @param update_attributes a boolean to update the enabled attributes + * @return a dart of the new edge, and not incident to the + * same vertex than adart1. + */ + Dart_descriptor insert_cell_1_between_two_cells_2(Dart_descriptor adart1, + Dart_descriptor adart2, + bool update_attributes=true) + { + CGAL_assertion(is_insertable_cell_1_between_two_cells_2(adart1, adart2)); + return generic_insert_cell_1(adart1, adart2, true, update_attributes); + } + + /** Insert an edge between two given darts. If the two darts belong to the same facet, call + * insert_cell_1_in_cell_2, otherwise call insert_cell_1_between_two_cells_2. + * @param adart1 a first dart (!=null_descriptor && !=null_dart_descriptor). + * @param adart2 a second dart. + * @param update_attributes a boolean to update the enabled attributes + * @return a dart of the new edge, and not incident to the + * same vertex than adart1. + */ + Dart_descriptor insert_cell_1(Dart_descriptor adart1, + Dart_descriptor adart2, + bool update_attributes=true, + typename Attribute_descriptor<0>::type + ah=null_descriptor) + { + CGAL_assertion(adart1!=null_descriptor); + if(is_insertable_cell_1_in_cell_2(adart1, adart2)) + { return insert_cell_1_in_cell_2(adart1, adart2, update_attributes, ah); } + return insert_cell_1_between_two_cells_2(adart1, adart2, update_attributes); + } + + /** Generic method to insert a 1-cell, either in a 2-cell (cf. insert_cell_1_in_cell_2) + * or between two different 2-cells (cf. insert_cell_1_between_two_cells_2). + * Indeed the code is the same, except for the group/degroup attribute. + * merge is true if adart1 and adart2 belongs to two different facets; in this case + * the two facets should be merged (they are now linked by the new edge); + * merge is false it adart1 and adart2 belongs to the same facet; in this case + * the facet is split in two. + * Internal method not supposed to be called by users. + */ + Dart_descriptor generic_insert_cell_1(Dart_descriptor adart1, + Dart_descriptor adart2, + bool merge, + bool update_attributes=true, + typename Attribute_descriptor<0>::type + ah=null_descriptor) + { /* CGAL::GMap_dart_iterator_basic_of_involution will contain all * alpha_i except alpha_0, alpha_1 and alpha_2, i.e. this is * */ + Dart_descriptor dart2_a1=null_descriptor; + if(adart2!=null_descriptor) { dart2_a1=alpha<1>(adart2); } + size_type m1=get_new_mark(); CGAL::GMap_dart_iterator_basic_of_involution it1(*this, adart1, m1); - size_type m2=get_new_mark(); - CGAL::GMap_dart_iterator_basic_of_involution it2(*this, adart2, m2); + CGAL::GMap_dart_iterator_basic_of_involution it2(*this, dart2_a1, m2); Dart_descriptor d1=null_descriptor; Dart_descriptor d2=null_descriptor; @@ -3565,13 +3645,13 @@ namespace CGAL { if (!isfree1) { - d3 = create_dart(); - d4 = create_dart(); - this->template basic_link_alpha<2>(d1, d3); - this->template basic_link_alpha<2>(d2, d4); + d3 = create_dart(); + d4 = create_dart(); + this->template basic_link_alpha<2>(d1, d3); + this->template basic_link_alpha<2>(d2, d4); } - for ( unsigned int dim=3; dim<=dimension; ++dim) + for (unsigned int dim=3; dim<=dimension; ++dim) { if ( !is_free(it1, dim) && is_marked(alpha(it1, dim), treated) ) @@ -3598,7 +3678,7 @@ namespace CGAL { } this->template link_alpha<1>(it1, d1); - if ( adart2!=null_descriptor ) + if (adart2!=null_descriptor) { CGAL_assertion (it2.cont()); this->template link_alpha<1>(it2, d2); @@ -3626,9 +3706,25 @@ namespace CGAL { if (are_attributes_automatically_managed() && update_attributes) { - if ( !this->template is_free<2>(d1) && d2!=null_descriptor ) - CGAL::internal::GMap_degroup_attribute_functor_run:: - run(*this, d1, this->template alpha<2>(d1)); + if(merge) + { // Here we group all enabled attributes starting from 2 to dimension + Helper::template Foreach_enabled_attributes + , 2>:: + run(*this, adart1, adart2); + // And we need to group also alpha_i(adart1) and alpha_i(adart2) for all + // enabled attributes starting from 3 dimension. Indeed when two i-cells + // are grouped for adart1 and adart2, this group also all alpha_j two by two + // except for alpha_i. + Helper::template Foreach_enabled_attributes + , 3>::run(*this, adart1, adart2); + + } + else // Here we degroup 2-attributes + { + if (!this->template is_free<2>(d1) && d2!=null_descriptor) + { CGAL::internal::GMap_degroup_attribute_functor_run:: + run(*this, d1, this->template alpha<2>(d1)); } + } } negate_mark(m1); @@ -3673,7 +3769,8 @@ namespace CGAL { typename Attribute_descriptor<0>:: type ah=null_descriptor, bool update_attributes=true ) - { return insert_cell_1_in_cell_2(adart1, null_descriptor, update_attributes, ah); } + { return insert_cell_1_in_cell_2(adart1, null_descriptor, ah, + update_attributes); } /** Test if a 2-cell can be inserted onto a given 3-cell along * a path of edges. diff --git a/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h b/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h index 4b3c17816e4..4d4a98cfdbe 100644 --- a/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h +++ b/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h @@ -132,7 +132,8 @@ struct GMap_group_attribute_functor_run { static void run(GMap& amap, typename GMap::Dart_descriptor adart1, - typename GMap::Dart_descriptor adart2) + typename GMap::Dart_descriptor adart2, + bool dart1_deleted=true) { static_assert( i<=GMap::dimension ); static_assert( i!=j ); @@ -145,7 +146,13 @@ struct GMap_group_attribute_functor_run a2=amap.template attribute(adart2); // If the two attributes are equal, nothing to do. - if ( a1 == a2 ) return; + if ( a1 == a2 ) + { + if(a1!=GMap::null_descriptor && dart1_deleted && + amap.template dart_of_attribute(a1)==adart1) + { amap.template set_dart_of_attribute(a1, adart2); } + return; + } typename GMap::Dart_descriptor toSet = amap.null_descriptor; @@ -162,15 +169,18 @@ struct GMap_group_attribute_functor_run } } amap.template set_attribute(toSet, a1); + if(dart1_deleted && toSet==adart1) + { amap.template set_dart_of_attribute(a1, adart2); } } }; // Specialization for void attributes. template struct GMap_group_attribute_functor_run { - static void run( GMap&, - typename GMap::Dart_descriptor, - typename GMap::Dart_descriptor ) + static void run(GMap&, + typename GMap::Dart_descriptor, + typename GMap::Dart_descriptor, + bool=true) {} }; // Specialization for i=j. Do nothing as j is the dimension to not consider. @@ -179,7 +189,8 @@ struct GMap_group_attribute_functor_run { static void run(GMap&, typename GMap::Dart_descriptor, - typename GMap::Dart_descriptor) + typename GMap::Dart_descriptor, + bool=true) {} }; // ************************************************************************ diff --git a/Generalized_map/include/CGAL/Generalized_map_operations.h b/Generalized_map/include/CGAL/Generalized_map_operations.h index 0ebec7a7c5c..4c65af865db 100644 --- a/Generalized_map/include/CGAL/Generalized_map_operations.h +++ b/Generalized_map/include/CGAL/Generalized_map_operations.h @@ -91,8 +91,9 @@ namespace CGAL it.cont(); ++it ) { to_erase.push_back(it); - if ( !amap.template is_free(it) && dg1==amap.null_descriptor ) - { dg1=it; dg2=amap.template alpha(it); } + if (dg1==amap.null_descriptor && !amap.template is_free(it) && + !amap.template is_free(amap.template alpha(it))) + { dg1=it; dg2=amap.template alpha(it); } amap.mark(it, mark); ++res; } @@ -102,7 +103,7 @@ namespace CGAL // We group the two (i+1)-cells incident if they exist. if ( dg1!=amap.null_descriptor ) CGAL::internal::GMap_group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be deleted } // During the operation, we store in modified_darts the darts modified @@ -136,6 +137,9 @@ namespace CGAL modified_darts.push_back(d2); amap.mark(d2, mark_modified_darts); } + + internal::Set_dart_of_attribute_if_marked:: + run(amap, d1, mark); } } } @@ -320,7 +324,7 @@ namespace CGAL // We group the two (i-1)-cells incident if they exist. if ( dg1!=amap.null_descriptor ) CGAL::internal::GMap_group_attribute_functor_run:: - run(amap, dg1, dg2); + run(amap, dg1, dg2, true); // true because dg1 will be deleted } // During the operation, we store in modified_darts the darts modified diff --git a/Generalized_map/test/Generalized_map/GMap_test_insertions.h b/Generalized_map/test/Generalized_map/GMap_test_insertions.h index b239bad84c1..1a3f67aabc3 100644 --- a/Generalized_map/test/Generalized_map/GMap_test_insertions.h +++ b/Generalized_map/test/Generalized_map/GMap_test_insertions.h @@ -149,7 +149,7 @@ bool test_edge_insertion(GMAP& gmap) trace_test_begin(); d1 = gmap.make_combinatorial_polygon(4); - gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1,0)); + gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1)); if ( !check_number_of_cells_3(gmap, 4, 5, 2, 1, 1) ) return false; gmap.clear(); @@ -158,7 +158,7 @@ bool test_edge_insertion(GMAP& gmap) d1 = gmap.make_combinatorial_polygon(4); d2 = gmap.make_combinatorial_polygon(4); gmap.template sew<3>(d1, d2); - gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1,0)); + gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1)); if ( !check_number_of_cells_3(gmap, 4, 5, 2, 2, 1) ) return false; gmap.clear(); @@ -167,18 +167,11 @@ bool test_edge_insertion(GMAP& gmap) d1 = gmap.make_combinatorial_polygon(4); d2 = gmap.make_combinatorial_polygon(4); gmap.template sew<2>(d1, d2); - gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1,0)); + gmap.insert_cell_1_in_cell_2(d1, gmap.alpha(d1,0,1)); if ( !check_number_of_cells_3(gmap, 6, 8, 3, 1, 1) ) return false; gmap.clear(); - trace_test_begin(); - d1 = gmap.create_dart(); - gmap.insert_dangling_cell_1_in_cell_2(d1); - if ( !check_number_of_cells_3(gmap, 2, 2, 1, 1, 1) ) - return false; - gmap.clear(); - trace_test_begin(); d1 = gmap.make_edge(); gmap.template sew<1>(d1, gmap.alpha(d1, 0)); diff --git a/Generalized_map/test/Generalized_map/gmap_test_split_attribute.cpp b/Generalized_map/test/Generalized_map/gmap_test_split_attribute.cpp index 51e5618ce9c..6dd17ee0a84 100644 --- a/Generalized_map/test/Generalized_map/gmap_test_split_attribute.cpp +++ b/Generalized_map/test/Generalized_map/gmap_test_split_attribute.cpp @@ -54,7 +54,7 @@ bool test(const std::string& s) for(std::size_t i=0; i(dd)); + newd=m.insert_cell_1_in_cell_2(dd, m.template alpha<0,1>(dd)); if(m.template attribute<2>(newd)==GMap::null_descriptor) { std::cout<<"ERROR1: "< class ArcsGraphicsItem : public GraphicsItem { - std::vector& arcs, &intersections; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef std::variant, Circular_arc_2, Line_arc_2 > Inter_variant; + typedef std::variant Arc_variant; + + std::vector& arcs; + std::vector& intersections; public: - ArcsGraphicsItem(std::vector& arcs_, std::vector& intersections_); + ArcsGraphicsItem(std::vector& arcs_, std::vector& intersections_); void modelChanged(); @@ -68,7 +72,7 @@ protected: template -ArcsGraphicsItem::ArcsGraphicsItem(std::vector& arcs_, std::vector& intersections_) +ArcsGraphicsItem::ArcsGraphicsItem(std::vector& arcs_, std::vector& intersections_) : arcs(arcs_), intersections(intersections_), painterostream(nullptr) { setIntersectionsPen(QPen(::Qt::red, 3.)); @@ -97,33 +101,29 @@ ArcsGraphicsItem::paint(QPainter *painter, painter->setPen(this->inputPen()); painterostream = PainterOstream(painter); - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + for(typename std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ Circular_arc_2 ca; Line_arc_2 la; - if(assign(ca, *it)){ - painterostream << ca; - } else if(assign(la, *it)){ - painterostream << la; + if(auto ca = std::get_if(&(*it))){ + painterostream << *ca; + } else if(auto la = std::get_if(&(*it))){ + painterostream << *la; } } painter->setPen(this->intersectionsPen()); painterostream = PainterOstream(painter); - for(std::vector::iterator it = intersections.begin(); it != intersections.end(); ++it){ - std::pair cap_ui; - Circular_arc_2 ca; - Line_arc_2 la; - - if(assign(cap_ui, *it)){ + for(typename std::vector::iterator it = intersections.begin(); it != intersections.end(); ++it){ + if(auto cap_ui = std::get_if>(&*it)){ QTransform matrix = painter->worldTransform(); painter->resetTransform(); - painter->drawPoint(matrix.map(convert(cap_ui.first))); + painter->drawPoint(matrix.map(convert(cap_ui->first))); painter->setWorldTransform(matrix); - }if(assign(ca, *it)){ - painterostream << ca; - } else if(assign(la, *it)){ - painterostream << la; + }if(auto ca = std::get_if(&(*it))){ + painterostream << *ca; + } else if(auto la = std::get_if(&(*it))){ + painterostream << *la; } } } @@ -135,22 +135,22 @@ ArcsGraphicsItem::updateBoundingBox() bounding_rect = QRectF(0,0,100, 100); Bbox_2 bb; bool initialized = false; - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + for(typename std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ Circular_arc_2 ca; Line_arc_2 la; - if(assign(ca, *it)){ + if(auto ca = std::get_if(&(*it))){ if(initialized){ - bb = bb + ca.supporting_circle().bbox(); + bb = bb + ca->supporting_circle().bbox(); } else { initialized = true; - bb = ca.supporting_circle().bbox(); + bb = ca->supporting_circle().bbox(); } - } else if(assign(la, *it)){ + } else if(auto la = std::get_if(&(*it))){ if(initialized){ - bb = bb + la.bbox(); + bb = bb + la->bbox(); } else { initialized = true; - bb = la.bbox(); + bb = la->bbox(); } } } diff --git a/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp b/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp index 4fa766fb87c..e593af52c14 100644 --- a/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp +++ b/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include // Qt headers @@ -38,12 +37,15 @@ typedef CircularKernel::Segment_2 Segment_2; typedef CircularKernel::Line_arc_2 Line_arc_2; typedef CircularKernel::Circular_arc_2 Circular_arc_2; typedef CircularKernel::Circular_arc_point_2 Circular_arc_point_2; - +typedef std::variant Arc_variant; +typedef std::variant, + Circular_arc_2, Line_arc_2 > Inter_variant; typedef CGAL::Qt::ArcsGraphicsItem ArcsGraphicsItem; -typedef std::vector ArcContainer; +typedef std::vector ArcContainer; +typedef std::vector ArcIntersection; class MainWindow : public CGAL::Qt::DemosMainWindow, @@ -53,7 +55,7 @@ class MainWindow : private: ArcContainer arcs; - ArcContainer intersections; + ArcIntersection intersections; QGraphicsScene scene; ArcsGraphicsItem * agi; @@ -68,7 +70,7 @@ public Q_SLOTS: virtual void open(QString); - void processInput(CGAL::Object o); + void processInput(Arc_variant o); void on_actionInsertCircularArc_toggled(bool checked); @@ -107,8 +109,8 @@ MainWindow::MainWindow() // the signal/slot mechanism cai = new CGAL::Qt::GraphicsViewCircularArcInput(this, &scene); - QObject::connect(cai, SIGNAL(generate(CGAL::Object)), - this, SLOT(processInput(CGAL::Object))); + QObject::connect(cai, SIGNAL(generate(Arc_variant)), + this, SLOT(processInput(Arc_variant))); // Manual handling of actions // @@ -146,33 +148,33 @@ MainWindow::MainWindow() void -MainWindow::processInput(CGAL::Object o) +MainWindow::processInput(Arc_variant o) { - Circular_arc_2 ca; - Line_arc_2 la; + const Circular_arc_2* ca = nullptr; + const Line_arc_2* la = nullptr; bool is_circular = false; - if(assign(ca, o)){ + if( (ca = std::get_if(&o)) ){ is_circular = true; - } else if(! assign(la, o)){ + } else if(! (la = std::get_if(&o))){ std::cerr << "unknown object" << std::endl; return; } - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ Circular_arc_2 vca; Line_arc_2 vla; - if(assign(vca, *it)){ + if(auto vca = std::get_if(&(*it))){ if(is_circular){ - CGAL::intersection(ca, vca, std::back_inserter(intersections)); + CGAL::intersection(*ca, *vca, std::back_inserter(intersections)); } else { - CGAL::intersection(la, vca, std::back_inserter(intersections)); + CGAL::intersection(*la, *vca, std::back_inserter(intersections)); } - } else if(assign(vla, *it)){ + } else if(auto vla = std::get_if(&(*it))){ if(is_circular){ - CGAL::intersection(ca, vla, std::back_inserter(intersections)); + CGAL::intersection(*ca, *vla, std::back_inserter(intersections)); } else { - CGAL::intersection(la, vla, std::back_inserter(intersections)); + CGAL::intersection(*la, *vla, std::back_inserter(intersections)); } } } @@ -241,32 +243,30 @@ MainWindow::open(QString fileName) { Line_arc_2 la(Segment_2(multi_points[0], multi_points[1])); - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ - Circular_arc_2 vca; - Line_arc_2 vla; - if(assign(vca, *it)){ - CGAL::intersection(la, vca, std::back_inserter(intersections)); - } else if(assign(vla, *it)){ - CGAL::intersection(la, vla, std::back_inserter(intersections)); + for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + if(auto vca = std::get_if(&(*it))){ + CGAL::intersection(la, *vca, std::back_inserter(intersections)); + } else if(auto vla = std::get_if(&(*it))){ + CGAL::intersection(la, *vla, std::back_inserter(intersections)); } } - arcs.push_back(make_object(la)); + arcs.push_back(la); } else if(multi_points.size() == 3) { Circular_arc_2 ca(multi_points[0], multi_points[1], multi_points[2]); - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ Circular_arc_2 vca; Line_arc_2 vla; - if(assign(vca, *it)){ - CGAL::intersection(ca, vca, std::back_inserter(intersections)); - } else if(assign(vla, *it)){ - CGAL::intersection(ca, vla, std::back_inserter(intersections)); + if(auto vca = std::get_if(&(*it))){ + CGAL::intersection(ca, *vca, std::back_inserter(intersections)); + } else if(auto vla = std::get_if(&(*it))){ + CGAL::intersection(ca, *vla, std::back_inserter(intersections)); } } - arcs.push_back(make_object(ca)); + arcs.push_back(ca); } else if(multi_points.size()>0) { @@ -285,16 +285,14 @@ MainWindow::open(QString fileName) Point_2 q(x,y); Line_arc_2 la(Segment_2(p,q)); - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ - Circular_arc_2 vca; - Line_arc_2 vla; - if(assign(vca, *it)){ - CGAL::intersection(la, vca, std::back_inserter(intersections)); - } else if(assign(vla, *it)){ - CGAL::intersection(la, vla, std::back_inserter(intersections)); + for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + if(auto vca = std::get_if(&(*it))){ + CGAL::intersection(la, *vca, std::back_inserter(intersections)); + } else if(auto vla = std::get_if(&(*it))){ + CGAL::intersection(la, *vla, std::back_inserter(intersections)); } } - arcs.push_back(make_object(la)); + arcs.push_back(la); } else if(c == 'c'){ ifs >> x >> y; Point_2 p(x,y); @@ -303,16 +301,16 @@ MainWindow::open(QString fileName) ifs >> x >> y; Point_2 r(x,y); Circular_arc_2 ca(p,q,r); - for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ + for(std::vector::iterator it = arcs.begin(); it != arcs.end(); ++it){ Circular_arc_2 vca; Line_arc_2 vla; - if(assign(vca, *it)){ - CGAL::intersection(ca, vca, std::back_inserter(intersections)); - } else if(assign(vla, *it)){ - CGAL::intersection(ca, vla, std::back_inserter(intersections)); + if(auto vca = std::get_if(&(*it))){ + CGAL::intersection(ca, *vca, std::back_inserter(intersections)); + } else if(auto vla = std::get_if(&(*it))){ + CGAL::intersection(ca, *vla, std::back_inserter(intersections)); } } - arcs.push_back(make_object(ca)); + arcs.push_back(ca); } } } diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h b/GraphicsView/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h index 49be2350b4d..e7d9b163a4c 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h @@ -270,7 +270,7 @@ public: // The sites have the same x/y coordinate. if (s_x == CGAL::ZERO || s_y == CGAL::ZERO) { - *o++ = CGAL::make_object(Intersection_curve(CGAL::bisector(s1, s2), 1)); + *o++ = Intersection_curve(CGAL::bisector(s1, s2), 1); return o; } @@ -300,7 +300,7 @@ public: } // We construct the diagonal line either way. - *o++ = CGAL::make_object(Intersection_curve(Segment_2(p1, p2), 1)); + *o++ = Intersection_curve(Segment_2(p1, p2), 1); // Now construct vertical rays. Two or four rays. If it is only two rays, // then the multiplicity of all the curves is 1. @@ -309,14 +309,14 @@ public: if (s_d != CGAL::POSITIVE) { // horizontal rectangle or square = vertical rays. - *o++ = CGAL::make_object(Intersection_curve(Ray_2(*top, Direction_2(0, 1)), mult)); - *o++ = CGAL::make_object(Intersection_curve(Ray_2(*bottom, Direction_2(0, -1)), mult)); + *o++ = Intersection_curve(Ray_2(*top, Direction_2(0, 1)), mult); + *o++ = Intersection_curve(Ray_2(*bottom, Direction_2(0, -1)), mult); } if (s_d != CGAL::NEGATIVE) { // vertical rectangle or square = horizontal rays. - *o++ = CGAL::make_object(Intersection_curve(Ray_2(*right, Direction_2(1, 0)), mult)); - *o++ = CGAL::make_object(Intersection_curve(Ray_2(*left, Direction_2(-1, 0)), mult)); + *o++ = Intersection_curve(Ray_2(*right, Direction_2(1, 0)), mult); + *o++ = Intersection_curve(Ray_2(*left, Direction_2(-1, 0)), mult); } return o; diff --git a/GraphicsView/demo/Polygon/Polygon_2.cpp b/GraphicsView/demo/Polygon/Polygon_2.cpp index 9463c2e979b..67c16d0b3dc 100644 --- a/GraphicsView/demo/Polygon/Polygon_2.cpp +++ b/GraphicsView/demo/Polygon/Polygon_2.cpp @@ -1,5 +1,4 @@ #include -#include // CGAL headers #include #include @@ -42,9 +41,9 @@ typedef CGAL::Polygon_with_holes_2 > Polygon_with_holes_2 typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr SsPtr ; -typedef boost::shared_ptr PolygonPtr ; +typedef std::shared_ptr PolygonPtr ; typedef std::vector PolygonPtr_vector ; diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index 0950301c127..cd505d53540 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -194,7 +194,7 @@ This method is automatically called once, before the first call to paintGL(). Overload init() instead of this method to modify viewer specific OpenGL state. -If a 4.3 context could not be set, a ES 2.0 context will be used instead. +If a 4.3 context could not be set, an ES 2.0 context will be used instead. \see `isOpenGL_4_3()` */ CGAL_INLINE_FUNCTION diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h index 73eea197640..e561bd30b69 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h @@ -80,12 +80,12 @@ public: PainterOstream& operator<<(const Hyperbolic_segment_2& s) { - if(const Euclidean_segment_2* seg = boost::get(&s)) { + if(const Euclidean_segment_2* seg = std::get_if(&s)) { CGAL::Qt::PainterOstream::operator << (*seg); return *this; } - const Circular_arc_2& arc = boost::get(s); + const Circular_arc_2& arc = std::get(s); if(arc.squared_radius() > 100) { Euclidean_segment_2 seg(arc.source(), arc.target()); diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstreamCK.h b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstreamCK.h index 8f434a5a41f..f634789193c 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstreamCK.h +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstreamCK.h @@ -44,12 +44,12 @@ namespace Qt { PainterOstream& operator <<(const Hyperbolic_segment_2& s) { - if(const Line_arc* seg = boost::get(&s)) { + if(const Line_arc* seg = std::get_if(&s)) { operator << (*seg); return *this; } - const Circular_arc& arc = boost::get(s); + const Circular_arc& arc = std::get(s); if(arc.squared_radius() > 10) { diff --git a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h index 19e4c668351..4d2b45ca343 100644 --- a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -208,7 +208,7 @@ public: /// @{ /*! Inserts the point `p` in the triangulation. - If the point `p` coincides with a existing vertex, then the vertex is returned + If the point `p` coincides with an existing vertex, then the vertex is returned and the triangulation is not modified. The optional parameter `start` is used to initialize the location of `p`. */ diff --git a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h index 8913899a271..3dcd277ab47 100644 --- a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h +++ b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h @@ -35,7 +35,7 @@ public: typedef typename K::Circular_arc_point_2 Hyperbolic_Voronoi_point_2; typedef typename K::Circular_arc_2 Circular_arc_2; typedef typename K::Line_arc_2 Line_arc_2; - typedef boost::variant Hyperbolic_segment_2; typedef typename K::Triangle_2 Hyperbolic_triangle_2; /// @} diff --git a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h index 8eab67ea083..c1131a1e1ef 100644 --- a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h +++ b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h @@ -35,7 +35,7 @@ public: typedef Hyperbolic_point_2 Hyperbolic_Voronoi_point_2; typedef unspecified_type Circular_arc_2; typedef typename K::Segment_2 Euclidean_segment_2; - typedef boost::variant< Circular_arc_2, + typedef std::variant< Circular_arc_2, Euclidean_segment_2 > Hyperbolic_segment_2; typedef typename K::Triangle_2 Hyperbolic_triangle_2; /// @} diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h index 538991692ba..d95bfe27fba 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -880,7 +880,7 @@ public: Face_handle locate(const Point& query, Locate_type& lt, int &li, Face_handle hint = Face_handle()) const { - // Perform an Euclidean location first and get close to the hyperbolic face containing the query point + // Perform a Euclidean location first and get close to the hyperbolic face containing the query point typename Base::Locate_type blt; Face_handle fh = Base::locate(query, blt, li, hint); @@ -901,7 +901,7 @@ public: CGAL_assertion(!is_infinite(fh)); - // This case corresponds to when the point is located on an Euclidean edge. + // This case corresponds to when the point is located on a Euclidean edge. if(lt == EDGE) { // Here because the call to `side_of_hyperbolic_triangle` might change `li` diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h index da42c7429f9..ee95f6c0f85 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -69,9 +69,9 @@ namespace internal { Euclidean_line_2* l; Circle_2* c; - if(Circle_2* c_pq = boost::get(&bis_pq)) + if(Circle_2* c_pq = std::get_if(&bis_pq)) { - if(Circle_2* c_qr = boost::get(&bis_qr)) + if(Circle_2* c_qr = std::get_if(&bis_qr)) { typedef typename CK2_Intersection_traits::type Intersection_result; std::vector< Intersection_result > inters; @@ -90,14 +90,14 @@ namespace internal { } // here bis_qr is a line - l = boost::get(&bis_qr); + l = std::get_if(&bis_qr); c = c_pq; } else { // here bis_pq is a line, and bis_qr is necessarily a circle - l = boost::get(&bis_pq); - c = boost::get(&bis_qr); + l = std::get_if(&bis_pq); + c = std::get_if(&bis_qr); } typedef typename CK2_Intersection_traits::type Intersection_result; @@ -157,7 +157,7 @@ namespace internal { } Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c = boost::get(&bis_pq); + Circle_2* c = std::get_if(&bis_pq); if(_gt.less_y_2_object()(po, c->center())) return Circular_arc_2(*c, l_inf, true, l_inf, false); @@ -200,7 +200,7 @@ namespace internal { Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c_pq = boost::get(&bis_pq); + Circle_2* c_pq = std::get_if(&bis_pq); if(_gt.compare_distance_2_object()(po, p, q) == POSITIVE) { @@ -251,7 +251,7 @@ namespace internal { } Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c_pq = boost::get(&bis_pq); + Circle_2* c_pq = std::get_if(&bis_pq); Hyperbolic_point_2 approx_a(to_double(a.x()),to_double(a.y())); @@ -311,14 +311,14 @@ public: typedef typename R::Point_2 Hyperbolic_point_2; typedef typename R::Circle_2 Circle_2; typedef typename R::Line_2 Euclidean_line_2; - typedef boost::variant Euclidean_circle_or_line_2; + typedef std::variant Euclidean_circle_or_line_2; typedef typename R::Circular_arc_2 Circular_arc_2; typedef typename R::Line_arc_2 Line_arc_2; typedef typename R::Circular_arc_point_2 Circular_arc_point_2; typedef Circular_arc_point_2 Hyperbolic_Voronoi_point_2; typedef typename R::Segment_2 Euclidean_segment_2; // only used internally here - typedef boost::variant Hyperbolic_segment_2; + typedef std::variant Hyperbolic_segment_2; typedef typename R::Triangle_2 Hyperbolic_triangle_2; diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h index 801ee71d993..0c0829309b7 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -187,9 +187,9 @@ public: Hyperbolic_point_2 operator()(Hyperbolic_segment_2 s1, Hyperbolic_segment_2 s2) { - if(Circular_arc_2* c1 = boost::get(&s1)) + if(Circular_arc_2* c1 = std::get_if(&s1)) { - if(Circular_arc_2* c2 = boost::get(&s2)) + if(Circular_arc_2* c2 = std::get_if(&s2)) { std::pair res = operator()(c1->supporting_circle(), c2->supporting_circle()); Hyperbolic_point_2 p1 = res.first; @@ -202,7 +202,7 @@ public: } else { - Euclidean_segment_2* ell2 = boost::get(&s2); + Euclidean_segment_2* ell2 = std::get_if(&s2); std::pair res = operator()(c1->supporting_circle(), ell2->supporting_line()); Hyperbolic_point_2 p1 = res.first; @@ -216,8 +216,8 @@ public: } else { - Euclidean_segment_2* ell1 = boost::get(&s1); - if(Circular_arc_2* c2 = boost::get(&s2)) + Euclidean_segment_2* ell1 = std::get_if(&s1); + if(Circular_arc_2* c2 = std::get_if(&s2)) { std::pair res = operator()(ell1->supporting_line(), c2->supporting_circle()); @@ -231,7 +231,7 @@ public: } else { - Euclidean_segment_2* ell2 = boost::get(&s2); + Euclidean_segment_2* ell2 = std::get_if(&s2); Hyperbolic_point_2 p1 = operator()(ell1->supporting_line(), ell2->supporting_line()); CGAL_assertion(p1.x()*p1.x() + p1.y()*p1.y() < FT(1)); return p1; @@ -279,9 +279,9 @@ public: Euclidean_line_2* l; Circle_2* c; - if(Circle_2* c_pq = boost::get(&bis_pq)) + if(Circle_2* c_pq = std::get_if(&bis_pq)) { - if(Circle_2* c_qr = boost::get(&bis_qr)) + if(Circle_2* c_qr = std::get_if(&bis_qr)) { std::pair inters = ci(*c_pq, *c_qr); @@ -291,14 +291,14 @@ public: return inters.second; } - l = boost::get(&bis_qr); + l = std::get_if(&bis_qr); c = c_pq; } else { // here bis_pq is a line - l = boost::get(&bis_pq); - c = boost::get(&bis_qr); + l = std::get_if(&bis_pq); + c = std::get_if(&bis_qr); } std::pair inters = ci(*c, *l); @@ -348,7 +348,7 @@ public: } Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c = boost::get(&bis_pq); + Circle_2* c = std::get_if(&bis_pq); std::pair inters = ci(*c, l_inf); if(_gt.orientation_2_object()(c->center(), inters.first, inters.second) == POSITIVE) @@ -388,7 +388,7 @@ public: } Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c_pq = boost::get(&bis_pq); + Circle_2* c_pq = std::get_if(&bis_pq); if(_gt.compare_distance_2_object()(po, p, q) == POSITIVE) { // then p is inside the supporting circle @@ -430,7 +430,7 @@ public: } Euclidean_circle_or_line_2 bis_pq = cclsb(p, q); - Circle_2* c_pq = boost::get(&bis_pq); + Circle_2* c_pq = std::get_if(&bis_pq); std::pair inters = ci(*c_pq, l_inf); Hyperbolic_point_2 approx_pinf = inters.first; @@ -468,10 +468,10 @@ public: typedef Hyperbolic_point_2 Hyperbolic_Voronoi_point_2; typedef typename Kernel::Circle_2 Circle_2; typedef typename Kernel::Line_2 Euclidean_line_2; - typedef boost::variant Euclidean_circle_or_line_2; + typedef std::variant Euclidean_circle_or_line_2; typedef internal::HDT_2_Circular_arc_2 Circular_arc_2; typedef typename Kernel::Segment_2 Euclidean_segment_2; // only used internally here - typedef boost::variant Hyperbolic_segment_2; + typedef std::variant Hyperbolic_segment_2; typedef typename Kernel::Triangle_2 Hyperbolic_triangle_2; diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index a0e667f0328..8409e1022ad 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -10,6 +10,30 @@ Release date: October 2023 - **Breaking change**: C++17 is now required - Support for Visual `C++` 14.0 (Visual studio 2015) is dropped. +- **Breaking change**: The usage of `boost::shared_ptr` has been replaced by `std::shared_ptr`. Packages affected are 2D Straight Line Skeleton and Shape Detection. +- **Breaking change**: The usage of `boost::optional` has been replaced by `std::optional`. Packages affected are 2D Straight Line Skeleton, 3D Fast Intersection and Distance Computation (AABB Tree), and the Kernel intersection. +- **Breaking change**: The usage of `boost::variant` has been replaced by `std::variant`. Packages affected are 2D Arrangements, and the Kernel intersection. + +#### 2D Arrangements + +- **Breaking change**: The type of the result of point location queries changed to + `std::variant`. The support for the old macro `CGAL_ARR_POINT_LOCATION_VERSION` + has been removed. + +#### Envelopes of Surfaces in 3D +- ** Breaking change**: Construct_projected_boundary_2 in `EnvelopeTraits_3` is now using `std::variant` instead of `Object` + +### [Combinatorial Maps](https://doc.cgal.org/6.0/Manual/packages.html#PkgCombinatorialMaps) and [Generalized Maps](https://doc.cgal.org/6.0/Manual/packages.html#PkgGeneralizedMaps) + +- Added the function `insert_cell_1_between_two_cells_2()` to the `GenericMap` concept, which enables users to insert an edge between two different faces in order to create faces with holes. + +### [3D Mesh Generation](https://doc.cgal.org/6.0/Manual/packages.html#PkgMesh3) + +- **Breaking change**: Removed the concept `TriangleAccessor`, the template parameter `TriangleAccessor`, as well + as the class `Triangle_accessor`. They were no longer used for several releases. + +- Removed the class templates `Gray_image_mesh_domain_3`, `Implicit_mesh_domain_3`, and `Labeled_image_mesh_domain_3` + which are deprecated since CGAL-4.13. ### [2D Arrangements](https://doc.cgal.org/6.0/Manual/packages.html#PkgArrangementOnSurface2) - Fixed a bug in the zone construction code applied to arrangements of geodesic arcs on a sphere, diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 355bde0dd6d..1d51bbbdac5 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -15,7 +15,7 @@ # .. variable:: CGAL_DISABLE_GMP # # If set, the `GMP` library will not be used. If -# :variable:`WITH_LEDA` is not used either, a efficient exact +# :variable:`WITH_LEDA` is not used either, an efficient exact # number types are used by CGAL kernels for exact computation. # # .. variable:: WITH_LEDA diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 4e808b39eee..23ec7180e34 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -84,7 +84,7 @@ function(tbb_extract_real_library library real_library) set(_elf_magic "7f454c46") file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) if(_hex_data STREQUAL _elf_magic) - #we have opened a elf binary so this is what + #we have opened an elf binary so this is what #we should link to set(${real_library} "${library}" PARENT_SCOPE) return() diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index c7062d61cae..c31b233091e 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -112,6 +112,7 @@ #include #include +#include //----------------------------------------------------------------------// // platform specific workaround flags (CGAL_CFG_...) diff --git a/Installation/include/CGAL/version_checker.h b/Installation/include/CGAL/version_checker.h new file mode 100644 index 00000000000..785f8be1712 --- /dev/null +++ b/Installation/include/CGAL/version_checker.h @@ -0,0 +1,53 @@ +// Copyright (c) 2023 GeometryFactory. +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : - + +#ifndef CGAL_VERSION_CHECKER_H +#define CGAL_VERSION_CHECKER_H + +#include + +// All files including this header are meant to work with a given version of CGAL +// When using forked headers, set the following macro to the version of CGAL +// you want to use. + +//// Set the 3 following macros to the version of CGAL you want to use +//#define CGAL_COMPATIBLE_VERSION_MAJOR 6 +//#define CGAL_COMPATIBLE_VERSION_MINOR 0 +//#define CGAL_COMPATIBLE_VERSION_PATCH 0 + +// Set the following macros to 1 to get a warning/an error +// when using a possibly incompatible version of CGAL +#define CGAL_VERSION_CHECKER_ERROR 0 +#define CGAL_VERSION_CHECKER_WARNING 0 + +#define CGAL_COMPATIBLE_VERSION_STR CGAL_STR(CGAL_COMPATIBLE_VERSION_MAJOR) "." \ + CGAL_STR(CGAL_COMPATIBLE_VERSION_MINOR) "." \ + CGAL_STR(CGAL_COMPATIBLE_VERSION_PATCH) + + +// Check that the version of CGAL used is the one expected +#if CGAL_COMPATIBLE_VERSION_MAJOR != CGAL_VERSION_MAJOR \ + || CGAL_COMPATIBLE_VERSION_MINOR != CGAL_VERSION_MINOR \ + || CGAL_COMPATIBLE_VERSION_PATCH != CGAL_VERSION_PATCH + + #if CGAL_VERSION_CHECKER_WARNING || CGAL_VERSION_CHECKER_ERROR + #pragma message("These headers are meant to be used with CGAL " CGAL_COMPATIBLE_VERSION_STR " only."\ + " You are using CGAL version: " CGAL_STR(CGAL_VERSION) ".") + + #ifdef CGAL_VERSION_CHECKER_ERROR + #error "Incompatible version of CGAL" + #endif + + #endif + +#endif + +#endif // CGAL_VERSION_CHECKER_H diff --git a/Interpolation/include/CGAL/sibson_gradient_fitting.h b/Interpolation/include/CGAL/sibson_gradient_fitting.h index 074ca037afb..f08600a4603 100644 --- a/Interpolation/include/CGAL/sibson_gradient_fitting.h +++ b/Interpolation/include/CGAL/sibson_gradient_fitting.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -229,7 +229,7 @@ sibson_gradient_fitting_nn_2(const Dt& dt, // of the value functor is 'DT::Point' or 'DT::Vertex_handle' std::enable_if_t< std::is_constructible< - std::function, + std::function, ValueFunctor >::value>* = nullptr) { @@ -255,7 +255,7 @@ sibson_gradient_fitting_nn_2(const Dt& dt, const Traits& traits, std::enable_if_t< std::is_constructible< - std::function, + std::function, ValueFunctor >::value>* = nullptr) { @@ -299,7 +299,7 @@ sibson_gradient_fitting_rn_2(const Rt& rt, // of the value functor is 'Rt::Point' (weighted point) or 'Rt::Vertex_handle' std::enable_if_t< std::is_constructible< - std::function, + std::function, ValueFunctor >::value>* = nullptr) { @@ -325,7 +325,7 @@ sibson_gradient_fitting_rn_2(const Rt& rt, const Traits& traits, std::enable_if_t< std::is_constructible< - std::function, + std::function, ValueFunctor >::value>* = nullptr) { diff --git a/Intersections_2/benchmark/Intersections_2/variant_any_object.cpp b/Intersections_2/benchmark/Intersections_2/variant_any_object.cpp index 11416d859b7..7fa07b4760a 100644 --- a/Intersections_2/benchmark/Intersections_2/variant_any_object.cpp +++ b/Intersections_2/benchmark/Intersections_2/variant_any_object.cpp @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -26,8 +26,8 @@ struct Intersection_traits; template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::variant variant_type; + typedef typename std::optional< variant_type > result_type; }; @@ -53,8 +53,8 @@ OutputIterator intersect_do_iterator(const typename K::Segment_2 &seg1, template -boost::optional< - boost::variant +std::optional< + std::variant > intersection_variant(const typename K::Segment_2 &seg1, const typename K::Segment_2 &seg2, @@ -62,8 +62,8 @@ intersection_variant(const typename K::Segment_2 &seg1, { typedef CGAL::internal::Segment_2_Segment_2_pair is_t; - typedef boost::variant Variant; - typedef boost::optional OptVariant; + typedef std::variant Variant; + typedef std::optional OptVariant; is_t ispair(&seg1, &seg2); switch (ispair.intersection_type()) { @@ -78,7 +78,7 @@ intersection_variant(const typename K::Segment_2 &seg1, } template -boost::any intersection_any(const typename K::Segment_2 &seg1, +std::any intersection_any(const typename K::Segment_2 &seg1, const typename K::Segment_2 &seg2, const K&) { @@ -88,11 +88,11 @@ boost::any intersection_any(const typename K::Segment_2 &seg1, switch (ispair.intersection_type()) { case is_t::NO_INTERSECTION: default: - return boost::any(); + return std::any(); case is_t::POINT: - return boost::any(ispair.intersection_point()); + return std::any(ispair.intersection_point()); case is_t::SEGMENT: - return boost::any(ispair.intersection_segment()); + return std::any(ispair.intersection_segment()); } } @@ -122,7 +122,7 @@ protected: std::vector* s; }; -struct Visitor : public boost::static_visitor<>, Vec_holder +struct Visitor { Visitor(std::vector* p, std::vector* s) : Vec_holder(p, s) { } @@ -141,7 +141,7 @@ struct Variant_f { void operator()(const Segment& s1, const Segment& s2) { result_type obj = intersection_variant(s1, s2, K()); if(obj) { - boost::apply_visitor(v, *obj); + std::visit(v, *obj); } } }; @@ -165,10 +165,10 @@ struct Any_f : Vec_holder { Vec_holder(p, s) { } void operator()(const Segment& s1, const Segment& s2) { - boost::any obj = intersection_any(s1, s2, K()); - if (const Point * point = boost::any_cast(&obj)) { + std::any obj = intersection_any(s1, s2, K()); + if (const Point * point = std::any_cast(&obj)) { p->push_back(*point); - } else if (const Segment * segment = boost::any_cast(&obj)) { + } else if (const Segment * segment = std::any_cast(&obj)) { s->push_back(*segment); } } @@ -224,7 +224,7 @@ std::tuple intersect_each_variant_overload(const Vector& segs) { std::function( [&ret](const Point& p) { (void)p; ++(std::get<0>(ret)); }))); - boost::apply_visitor(v, *obj); + std::visit(v, *obj); } else { ++(std::get<2>(ret)); } diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 67dc7512581..09daf0479ac 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -18,24 +18,24 @@ #include #include -#include +#include #include #define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2) \ template \ struct Intersection_traits { \ - typedef typename boost::variant \ + typedef typename std::variant \ variant_type; \ - typedef typename boost::optional< variant_type > result_type; \ + typedef typename std::optional< variant_type > result_type; \ }; #define CGAL_INTERSECTION_TRAITS_3(A, B, R1, R2, R3) \ template \ struct Intersection_traits { \ - typedef typename boost::variant variant_type; \ - typedef typename boost::optional< variant_type > result_type; \ + typedef typename std::optional< variant_type > result_type; \ }; #define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \ @@ -118,16 +118,16 @@ const T* intersect_get(const CGAL::Object& o) { return CGAL::object_cast(&o); } -template +template inline -const T* intersect_get(const boost::optional< boost::variant >& v) { - return boost::get(&*v); +const T* intersect_get(const std::optional< std::variant >& v) { + return std::get_if(&*v); } -template +template inline -const T* intersect_get(const boost::variant & v) { - return boost::get(&v); +const T* intersect_get(const std::variant & v) { + return std::get_if(&v); } template diff --git a/Intersections_2/include/CGAL/Intersection_traits_2.h b/Intersections_2/include/CGAL/Intersection_traits_2.h index 921405c27f9..bf43d9a079a 100644 --- a/Intersections_2/include/CGAL/Intersection_traits_2.h +++ b/Intersections_2/include/CGAL/Intersection_traits_2.h @@ -16,8 +16,8 @@ #include #include -#include -#include +#include +#include #include namespace CGAL { @@ -49,9 +49,9 @@ CGAL_INTERSECTION_TRAITS_2(Ray_2, Triangle_2, Point_2, Segment_2) template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_2, typename K::Segment_2, + std::variant< typename K::Point_2, typename K::Segment_2, typename K::Triangle_2, typename std::vector< typename K::Point_2 > > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; @@ -69,37 +69,37 @@ CGAL_INTERSECTION_TRAITS_2(Ray_2, Iso_rectangle_2, Point_2, Segment_2) // Variants of one for backwards compatibility template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; // Point_2 is special template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; template struct Intersection_traits { - typedef typename boost::variant > variant_type; - typedef typename boost::optional < variant_type > result_type; + typedef typename std::optional < variant_type > result_type; }; template @@ -118,14 +118,14 @@ struct Intersection_traits { template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; template struct Intersection_traits { - typedef typename boost::variant variant_type; - typedef boost::optional result_type; + typedef typename std::variant variant_type; + typedef std::optional result_type; }; } // namespace CGAL diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Bbox_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Bbox_2.h index 9b75f968c2e..2ebd27332ad 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Bbox_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Bbox_2.h @@ -25,13 +25,13 @@ do_intersect(const CGAL::Bbox_2& c, return CGAL::do_overlap(c, bbox); } -typename boost::optional< typename boost::variant > +typename std::optional< typename std::variant > inline intersection(const CGAL::Bbox_2& a, const CGAL::Bbox_2& b) { - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; + typedef typename std::variant variant_type; + typedef typename std::optional result_type; if(!do_intersect(a, b)) return result_type(); diff --git a/Intersections_2/test/Intersections_2/test_intersections_2.cpp b/Intersections_2/test/Intersections_2/test_intersections_2.cpp index dad2d129c15..c86e9191539 100644 --- a/Intersections_2/test/Intersections_2/test_intersections_2.cpp +++ b/Intersections_2/test/Intersections_2/test_intersections_2.cpp @@ -490,7 +490,7 @@ struct Test std::set ds; auto test = [&ds](S s1, S s2) { - P i = boost::get

(*CGAL::intersection(s1,s2)); + P i = std::get

(*CGAL::intersection(s1,s2)); ds.insert(CGAL::to_double(i.x())); ds.insert(CGAL::to_double(i.y())); assert(ds.size()==2); }; diff --git a/Intersections_3/include/CGAL/Intersection_traits_3.h b/Intersections_3/include/CGAL/Intersection_traits_3.h index 85287e8c044..2d2b8ca64ff 100644 --- a/Intersections_3/include/CGAL/Intersection_traits_3.h +++ b/Intersections_3/include/CGAL/Intersection_traits_3.h @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include @@ -84,9 +84,9 @@ CGAL_INTERSECTION_TRAITS_3(Sphere_3, Sphere_3, Point_3, Circle_3, Sphere_3) template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, typename std::vector< typename K::Point_3 > > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; @@ -108,8 +108,8 @@ CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Ray_3, Point_3, Segment_3) template struct Intersection_traits { typedef typename - boost::variant< typename K::Iso_cuboid_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Iso_cuboid_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; @@ -118,8 +118,8 @@ struct Intersection_traits struct Intersection_traits { typedef typename - boost::variant< typename K::Segment_3, typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Segment_3, typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; template @@ -148,23 +148,23 @@ struct Intersection_traits : template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Bbox_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; @@ -172,8 +172,8 @@ struct Intersection_traits { template struct Intersection_traits { typedef typename - boost::variant< typename K::Iso_cuboid_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Iso_cuboid_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; template @@ -184,204 +184,204 @@ struct Intersection_traits template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Iso_cuboid_3 Plane_3, variant of 4 template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; // Iso_cuboid_3 Triangle_3, variant of 4 template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; // Bbox_3 Plane_3, variant of 4 template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; // Bbox_3 Triangle_3, variant of 4 template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3, typename K::Segment_3, + std::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Line_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Line_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Ray_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Ray_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Segment_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Segment_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Plane_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Plane_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Triangle_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Triangle_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Tetrahedron_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Tetrahedron_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Point_3 Sphere_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; // Sphere_3 Point_3, variant of one template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 > variant_type; - typedef typename boost::optional< variant_type > result_type; + std::variant< typename K::Point_3 > variant_type; + typedef typename std::optional< variant_type > result_type; }; //Tetrahedron_3 Plane_3, variant of 4 @@ -389,9 +389,9 @@ template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 , typename K::Segment_3, + std::variant< typename K::Point_3 , typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; //Plane_3 Tetrahedron_3, variant of 4 @@ -399,9 +399,9 @@ template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 , typename K::Segment_3, + std::variant< typename K::Point_3 , typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; //Triangle_3 Tetrahedron_3, variant of 4 @@ -409,9 +409,9 @@ template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 , typename K::Segment_3, + std::variant< typename K::Point_3 , typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; // Tetrahedron_3 Triangle_3, variant of 4 @@ -419,9 +419,9 @@ template struct Intersection_traits { typedef typename - boost::variant< typename K::Point_3 , typename K::Segment_3, + std::variant< typename K::Point_3 , typename K::Segment_3, typename K::Triangle_3, std::vector > variant_type; - typedef typename boost::optional< variant_type > result_type; + typedef typename std::optional< variant_type > result_type; }; diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h index bb244628c5a..c3303e93e80 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h @@ -24,8 +24,8 @@ #include -#include -#include +#include +#include #include @@ -39,13 +39,13 @@ do_intersect(const CGAL::Bbox_3& c, return CGAL::do_overlap(c, bbox); } -typename boost::optional< typename boost::variant< Bbox_3> > +typename std::optional< typename std::variant< Bbox_3> > inline intersection(const CGAL::Bbox_3& a, const CGAL::Bbox_3& b) { - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; + typedef typename std::variant variant_type; + typedef typename std::optional result_type; if(!do_intersect(a,b)) return result_type(); diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h index ec3806b41f7..5689ce58935 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace CGAL { @@ -36,7 +36,7 @@ CGAL_INTERSECTION_FUNCTION(Line_3, Plane_3, 3) template inline -boost::optional +std::optional intersection_point_for_polyhedral_envelope(const Plane_3& plane, const Line_3& line) { @@ -45,7 +45,7 @@ intersection_point_for_polyhedral_envelope(const Plane_3& plane, template inline -boost::optional +std::optional intersection_point_for_polyhedral_envelope(const Line_3& line, const Plane_3& plane) { diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h index 3030089906c..9d7351039ff 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h @@ -52,7 +52,7 @@ intersection(const Plane_3& plane1, template inline -boost::optional +std::optional intersection_point_for_polyhedral_envelope(const Plane_3& p0, const Plane_3& p1, const Plane_3& p2) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_intersection.h index a82d17dd759..1ec423af9c9 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_intersection.h @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include namespace CGAL { namespace Intersections { @@ -34,7 +34,7 @@ namespace internal { // But it must be a template function since the original kernel must be // taken into account. template -typename boost::optional< boost::variant > +typename std::optional< std::variant > intersection_bl(const Bbox_3& box, double lpx, double lpy, double lpz, double ldx, double ldy, double ldz, @@ -45,7 +45,7 @@ intersection_bl(const Bbox_3& box, typedef typename K::Vector_3 Vector_3; typedef typename K::Segment_3 Segment_3; - typedef typename boost::optional > result_type; + typedef typename std::optional > result_type; double seg_min = 0.0, seg_max = 1.0; // first on x value diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_intersection.h index b052243ff0c..7349337fc84 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_intersection.h @@ -180,7 +180,7 @@ intersection(const typename K::Iso_cuboid_3& cub, } if (all_in || all_out) - return boost::none; + return std::nullopt; if (start_id == -1) return { result_type(corners[solo_id]) }; diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_intersection.h index ccdba585679..2c834588f6b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_intersection.h @@ -67,7 +67,7 @@ void clip_poly_halfspace( SP_type inter = k.intersect_3_object()(seg, pl); if(inter) { - Point* p_inter = boost::get(&*inter); + Point* p_inter = std::get_if(&*inter); if(p_inter && !(k.equal_3_object()(*p_inter, p1)) && !(k.equal_3_object()(*p_inter, p2))) @@ -90,7 +90,7 @@ void clip_poly_halfspace( SP_type inter = typename K::Intersect_3()(seg, pl); if(inter) { - Point* p_inter = boost::get(&*inter); + Point* p_inter = std::get_if(&*inter); if(p_inter && !(k.equal_3_object()(*p_inter, p1)) && !(k.equal_3_object()(*p_inter, p2))) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_intersection.h index d14c119b56e..737205703e3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_intersection.h @@ -24,7 +24,7 @@ namespace Intersections { namespace internal { template -boost::optional +std::optional intersection_point(const typename K::Plane_3& plane, const typename K::Line_3& line, const K& /*k*/) @@ -41,9 +41,9 @@ intersection_point(const typename K::Plane_3& plane, RT den = plane.a()*line_dir.dx() + plane.b()*line_dir.dy() + plane.c()*line_dir.dz(); if(den == 0) - return boost::none; + return std::nullopt; - return boost::make_optional(Point_3(den*line_pt.hx()-num*line_dir.dx(), + return std::make_optional(Point_3(den*line_pt.hx()-num*line_dir.dx(), den*line_pt.hy()-num*line_dir.dy(), den*line_pt.hz()-num*line_dir.dz(), wmult_hw((K*)0, den, line_pt))); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h index be6ca11f069..b0cc8f3ec22 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_intersection.h @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include namespace CGAL { namespace Intersections { @@ -27,7 +27,7 @@ namespace internal { // triple plane intersection template -boost::optional +std::optional intersection_point(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const typename K::Plane_3& plane3, @@ -56,7 +56,7 @@ intersection_point(const typename K::Plane_3& plane1, const FT den = minor_0*m22 - minor_1*m12 + minor_2*m02; // determinant of M if(is_zero(den)){ - return boost::none; + return std::nullopt; } const FT num3 = minor_0*b2 - minor_1*b1 + minor_2*b0; // determinant of M with M[x:2] swapped with [b0,b1,b2] @@ -70,17 +70,17 @@ intersection_point(const typename K::Plane_3& plane1, const FT num1 = - minor_3*m21 + minor_4*m11 - minor_5*m01; // determinant of M with M[x:0] swapped with [b0,b1,b2] const FT num2 = minor_3*m20 - minor_4*m10 + minor_5*m00; // determinant of M with M[x:1] swapped with [b0,b1,b2] - return boost::make_optional(typename K::Point_3(num1/den, num2/den, num3/den)); + return std::make_optional(typename K::Point_3(num1/den, num2/den, num3/den)); } template -boost::optional > +std::optional > intersection(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const typename K::Plane_3& plane3, const K& k) { - typedef typename boost::optional > result_type; diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Tetrahedron_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Tetrahedron_3_intersection.h index 37e092956d7..0a1afefb0ea 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Tetrahedron_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Tetrahedron_3_intersection.h @@ -164,7 +164,7 @@ intersection(const typename K::Tetrahedron_3& tet, } if (all_in || all_out) - return boost::none; + return std::nullopt; if (start_id == -1) return { result_type(corners[solo_id]) }; diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_intersection.h index 35983013bba..5eeb8d85c8e 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_intersection.h @@ -396,7 +396,7 @@ intersection_coplanar(const typename K::Triangle_3& t, template inline -typename boost::optional +typename std::optional t3r3_intersection_aux(const typename K::Triangle_3& t, const typename K::Ray_3& r, const K& k) @@ -410,7 +410,7 @@ t3r3_intersection_aux(const typename K::Triangle_3& t, return *p; } - return boost::optional(); + return std::optional(); } template @@ -455,7 +455,7 @@ intersection(const typename K::Triangle_3& t, if ( orientation(p,q,a,b) != POSITIVE && orientation(p,q,b,c) != POSITIVE && orientation(p,q,c,a) != POSITIVE ) { - boost::optional op = t3r3_intersection_aux(t,r,k); + std::optional op = t3r3_intersection_aux(t,r,k); if(op) return intersection_return(*op); else return intersection_return(); } @@ -476,7 +476,7 @@ intersection(const typename K::Triangle_3& t, if ( orientation(q,p,a,b) != POSITIVE && orientation(q,p,b,c) != POSITIVE && orientation(q,p,c,a) != POSITIVE ) { - boost::optional op = t3r3_intersection_aux(t,r,k); + std::optional op = t3r3_intersection_aux(t,r,k); if(op) return intersection_return(*op); else return intersection_return(); } @@ -502,7 +502,7 @@ intersection(const typename K::Triangle_3& t, && orientation(q,p,b,c) != POSITIVE && orientation(q,p,c,a) != POSITIVE ) { - boost::optional op = t3r3_intersection_aux(t,r,k); + std::optional op = t3r3_intersection_aux(t,r,k); if(op) return intersection_return(*op); else return intersection_return(); } @@ -515,7 +515,7 @@ intersection(const typename K::Triangle_3& t, && orientation(p,q,b,c) != POSITIVE && orientation(p,q,c,a) != POSITIVE ) { - boost::optional op = t3r3_intersection_aux(t,r,k); + std::optional op = t3r3_intersection_aux(t,r,k); if(op) return intersection_return(*op); else return intersection_return(); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_intersection.h index 9bf2ed97ac7..c231137fd7d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_intersection.h @@ -76,8 +76,6 @@ intersection_collinear_segments(const typename K::Segment_3& s1, template struct L_p_visitor - : public boost::static_visitor< - typename Intersection_traits::result_type> { typedef typename Intersection_traits::result_type result_type; @@ -117,7 +115,7 @@ intersection(const typename K::Segment_3& s1, v = internal::intersection(s1.supporting_line(), s2.supporting_line(), k); if(v) - return apply_visitor(L_p_visitor(s1, s2) , *v); + return std::visit(L_p_visitor(s1, s2) , *v); return intersection_return(); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Triangle_3_intersection.h index 49bc573489e..e3668392be0 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Triangle_3_intersection.h @@ -148,7 +148,7 @@ intersection(const typename K::Tetrahedron_3& tet, supporting_planes.swap(current_sp); if (res.empty()) - return boost::none; + return std::nullopt; } switch(res.size()) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index b55ccf02acb..42182e01636 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -207,7 +207,7 @@ intersection(const typename K::Triangle_3& t1, return intersection_return(); } - return boost::apply_visitor(Triangle_Line_visitor(), *inter1, *inter2); + return std::visit(Triangle_Line_visitor(), *inter1, *inter2); } return intersection_return(); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h b/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h index 1dc059a20f1..4aba04c9e1a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h @@ -68,7 +68,7 @@ struct Tetrahedron_lines_intersection_3_base if(do_intersect(o, triangle)) { tr_seg[i] = typename K::Intersect_3()(o, triangle); - if(boost::get(&*tr_seg[i]) != nullptr) + if(std::get_if(&*tr_seg[i]) != nullptr) { res_id = i; break; @@ -91,7 +91,7 @@ struct Tetrahedron_lines_intersection_3_base { if(tr_seg[i]) { - if(const typename K::Point_3* p = boost::get(&*tr_seg[i])) + if(const typename K::Point_3* p = std::get_if(&*tr_seg[i])) { if(res_points.empty()) { diff --git a/Intersections_3/test/Intersections_3/intersection_test_helper.h b/Intersections_3/test/Intersections_3/intersection_test_helper.h index a38e2bad55f..167e18661fc 100644 --- a/Intersections_3/test/Intersections_3/intersection_test_helper.h +++ b/Intersections_3/test/Intersections_3/intersection_test_helper.h @@ -309,10 +309,8 @@ public: template bool compare_to_other_variant(const T& t) const { - if(ov->type() == typeid(T)) + if(auto* r = std::get_if(&*ov)) { - auto* r = boost::get(&*ov); // ov is an optional - assert(r); return (t == *r); } @@ -363,7 +361,7 @@ public: assert(ires12 && ires34); Variant_visitor vis(ires12); - boost::apply_visitor(vis, *ires34); + std::visit(vis, *ires34); assert(vis.equal); } } diff --git a/Intersections_3/test/Intersections_3/issue_5428.cpp b/Intersections_3/test/Intersections_3/issue_5428.cpp index ba39e1bd109..ba905ed12c5 100644 --- a/Intersections_3/test/Intersections_3/issue_5428.cpp +++ b/Intersections_3/test/Intersections_3/issue_5428.cpp @@ -15,7 +15,7 @@ int main(int, char**) auto result = intersection(cub, pl); - const std::vector* res = boost::get >(&*result); + const std::vector* res = std::get_if >(&*result); for(const Point& p : *res) std::cout << p << std::endl; diff --git a/Intersections_3/test/Intersections_3/test_intersections_Iso_cuboid_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_Iso_cuboid_3.cpp index 91e91913a48..e5ef0e49284 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_Iso_cuboid_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_Iso_cuboid_3.cpp @@ -208,7 +208,7 @@ public: // face auto res = CGAL::intersection(cub, Pl(p(1,1,1), p(1,2,1), p(1,2,2))); - const std::vector

* poly = boost::get >(&*res); + const std::vector

* poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); for(const P& pt : *poly) @@ -217,7 +217,7 @@ public: } res = CGAL::intersection(cub, Pl(p(1,1,1), p(1,2,1), p(2,2,2))); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); for(const P& pt : *poly) { @@ -227,7 +227,7 @@ public: // other edge Pl pln(p(1,1,1), p(1,2,1), P(1.5, 1, 2)); res = CGAL::intersection(cub, pln); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); for(const P& pt : *poly) { @@ -245,7 +245,7 @@ public: // random pln = Pl(0.265189, 0.902464, 0.33946, -2.47551); res = CGAL::intersection(cub, pln); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 5); for(const P& pt : *poly) { @@ -575,7 +575,7 @@ public: // face in a tr Tr tr(p(-3, -3, 1), p(3, -3, 1), P(1.5, 6, 1)); Res res = CGAL::intersection(cub, tr); - Pol* poly = boost::get >(&*res); + Pol* poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); if(this->has_exact_c) @@ -618,7 +618,7 @@ public: // tr through tr = Tr(p(2, 4, 2), P(1, 3.5, -0.5), p(1, -1, 1)); res = CGAL::intersection(cub, tr); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); if(this->has_exact_c) @@ -635,7 +635,7 @@ public: // cutting in half along diagonal (intersection included in triangle) tr = Tr(p(1, 1, 10), p(10, 10, 1), p(1, 1, 1)); res = CGAL::intersection(cub, tr); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); if(this->has_exact_c) @@ -647,7 +647,7 @@ public: // 6 points intersection tr = Tr(P(18.66, -5.4, -11.33), P(-2.41, -7.33, 19.75), P(-10.29, 20.15, -10.33)); res = CGAL::intersection(cub, tr); - poly = boost::get >(&*res); + poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 6); if(this->has_exact_c) @@ -659,7 +659,7 @@ public: // triangle clipping a cuboid corner tr = Tr(P(1.02, 1.33, 0.62), P(1.95, 2.54, 0.95), P(0.79, 2.36, 1.92)); res = CGAL::intersection(cub, tr); - Tr* tr_res = boost::get(&*res); + Tr* tr_res = std::get_if(&*res); assert(tr_res != nullptr); if(this->has_exact_c) { diff --git a/Intersections_3/test/Intersections_3/test_intersections_Plane_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_Plane_3.cpp index fc32a571b4c..265435329e5 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_Plane_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_Plane_3.cpp @@ -286,7 +286,7 @@ public: // Don't have the right values to test further. auto res = CGAL::intersection(tet, pln); - const std::vector

* poly = boost::get >(&*res); + const std::vector

* poly = std::get_if >(&*res); assert(poly != nullptr); assert(poly->size() == 4); } diff --git a/Intersections_3/test/Intersections_3/test_intersections_Tetrahedron_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_Tetrahedron_3.cpp index 6f45f6200e6..f6b40f5e778 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_Tetrahedron_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_Tetrahedron_3.cpp @@ -226,7 +226,7 @@ public: Tr tr(p(-2,2,0), p(2,2,0), P(0.25,0.25,0)); auto res = CGAL::intersection(tet, tr); - const Poly* poly = boost::get(&*res); + const Poly* poly = std::get_if(&*res); assert(poly != nullptr); assert(poly->size() == 4); for(const P& pt : *poly) { @@ -235,7 +235,7 @@ public: tr = Tr(P(0.45, 0.20, 0.1), P(0.1, 0.20, 0.5), P(-0.5, 0.25, -0.5)); res = CGAL::intersection(tet, tr); - const Poly* inter = boost::get(&*res); + const Poly* inter = std::get_if(&*res); assert(inter != nullptr); assert(inter->size() == 5); for(const P& pt : *inter) { @@ -287,22 +287,22 @@ public: auto res = CGAL::intersection(tet, tr); std::vector

points; - if(const P* pt = boost::get

(&*res)) + if(const P* pt = std::get_if

(&*res)) { points.push_back(*pt); } - else if(const S* s = boost::get(&*res)) + else if(const S* s = std::get_if(&*res)) { points.push_back(s->source()); points.push_back(s->target()); } - else if(const Tr* itr = boost::get(&*res)) + else if(const Tr* itr = std::get_if(&*res)) { points.push_back(itr->operator[](0)); points.push_back(itr->operator[](1)); points.push_back(itr->operator[](2)); } - else if(const Poly* poly = boost::get(&*res)) + else if(const Poly* poly = std::get_if(&*res)) { points = *poly; @@ -322,8 +322,8 @@ public: Tr tri(P(0.191630, -0.331630, -0.370000), P(-0.124185, -0.385815, -0.185000), P(-0.0700000, -0.0700000, 0.00000)); Tet tet(P(0, -1, 0), P(-1, 0, 0), P(0, 0, 0), P(0, 0, -1)); auto res = intersection(tri, tet); - assert(res != boost::none); - const std::vector

*vps = boost::get>(&*res); + assert(res != std::nullopt); + const std::vector

*vps = std::get_if>(&*res); assert(vps!=nullptr); } diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h index ab57d5cfb67..fec8c6c80a1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h @@ -81,7 +81,7 @@ typedef Line_3 Line_2; A construction object. Provides the operator : -`boost::optional< boost::variant > operator()(Segment_2 s1, Segment_2 s2);` +`std::optional< std::variant > operator()(Segment_2 s1, Segment_2 s2);` which returns a 3D object whose projection on the xy-plane is the intersection of the projections of `s1` and `s2`. If non empty, the returned object is either a segment or a point. diff --git a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h index f235beb0e79..85554368984 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h @@ -102,7 +102,7 @@ intersection(const SphericalType1 &obj1, const SphericalType2 &obj2, /*! Copies in the output iterator the intersection elements between the three objects. `intersections` iterates on -elements of type `boost::variant< Circle_3, Plane_3, Sphere_3, std::pair< Circular_arc_point_3, unsigned > >`, in lexicographic order +elements of type `std::variant< Circle_3, Plane_3, Sphere_3, std::pair< Circular_arc_point_3, unsigned > >`, in lexicographic order when this ordering is defined on the computed objects where `Type1`, `Type2` and `Type3` diff --git a/Kernel_23/doc/Kernel_23/CGAL/intersections.h b/Kernel_23/doc/Kernel_23/CGAL/intersections.h index 1b6c85341a3..160bb35d7eb 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/intersections.h @@ -103,7 +103,7 @@ The following tables give the possible values for `Type1` and `Type2`. The return type of intersecting two objects of the types `Type1` and `Type2` can be specified through the placeholder type specifier `auto`. It is equivalent to -`boost::optional< boost::variant< T... > >`, the last column in the table providing +`std::optional< std::variant< T... > >`, the last column in the table providing the template parameter pack.

@@ -193,7 +193,7 @@ the template parameter pack.
Additional overloads are provided for the type `Point_2` combined with any other type with the result type being -`boost::optional< boost::variant< Point_2 > >`. +`std::optional< std::variant< Point_2 > >`. Overloads are also provided for the type `Bbox_2`, for all intersections existing with the type `Iso_rectangle_2`. Note that the return type for `Bbox_2` - `Bbox_2` is `Bbox_2` and not `Iso_rectangle_2`. @@ -202,7 +202,7 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ The return type of intersecting two objects of the types `Type1` and `Type2` can be specified through the placeholder type specifier `auto`. It is equivalent to -`boost::optional< boost::variant< T... > >`, the last column in the table providing +`std::optional< std::variant< T... > >`, the last column in the table providing the template parameter pack.
@@ -351,7 +351,7 @@ the template parameter pack.
Additional overloads are provided for the type `Point_3` combined with any other type with the result type being -`boost::optional< boost::variant< Point_3 > >`. Overloads are also provided for the type `Bbox_3`, for all +`std::optional< std::variant< Point_3 > >`. Overloads are also provided for the type `Bbox_3`, for all intersections existing with the type `Iso_cuboid_3`. Note that the return type for `Bbox_3` - `Bbox_3` is `Bbox_3` and not `Iso_cuboid_3`. @@ -363,18 +363,18 @@ The following examples demonstrate the most common use of In the first two examples we intersect a segment and a line. The result type can be specified through the placeholder type specifier `auto`, -but you must anyway know that the result type is a `boost::optional >`, +but you must anyway know that the result type is a `std::optional >`, in order to unpack the point or segment. -`boost::optional` comes in -as there might be no intersection. `boost::variant` comes in +`std::optional` comes in +as there might be no intersection. `std::variant` comes in as, if there is an intersection, it is either a point or a segment. -As explained in the boost manual pages for `boost::variant`, there are two ways to access the variants. The first examples uses `boost::get`. +As explained in the boost manual pages for `std::variant`, there are two ways to access the variants. The first examples uses `boost::get`. \cgalExample{Kernel_23/intersection_get.cpp} -The second example uses `boost::apply_visitor`. +The second example uses `std::visit`. \cgalExample{Kernel_23/intersection_visitor.cpp} diff --git a/Kernel_23/doc/Kernel_23/Kernel_23.txt b/Kernel_23/doc/Kernel_23/Kernel_23.txt index 51eeea986db..0919077d3ab 100644 --- a/Kernel_23/doc/Kernel_23/Kernel_23.txt +++ b/Kernel_23/doc/Kernel_23/Kernel_23.txt @@ -495,7 +495,7 @@ especially integer types and rationals. Some functions, for example \link intersection_linear_grp `intersection()`\endlink, can return different types of objects. To achieve this in a type-safe way \cgal uses -return values of type `boost::optional< boost::variant< T... > >` where `T...` is a +return values of type `std::optional< std::variant< T... > >` where `T...` is a list of all possible resulting geometric objects. The exact result type of an intersection can be specified through the placeholder type specifier `auto`. @@ -521,10 +521,10 @@ std::cin >> segment_1 >> segment_2; auto v = intersection(segment_1, segment_2); if (v) { /* not empty */ - if (const Point_2 *p = boost::get(&*v) ) { + if (const Point_2 *p = std::get_if(&*v) ) { /* do something with *p */ } else { - const Segment_2 *s = boost::get(&*v); + const Segment_2 *s = std::get_if(&*v); /* do something with *s */ } } else { diff --git a/Kernel_23/examples/Kernel_23/MyKernel.cpp b/Kernel_23/examples/Kernel_23/MyKernel.cpp index 13eec454b3d..834a22629b8 100644 --- a/Kernel_23/examples/Kernel_23/MyKernel.cpp +++ b/Kernel_23/examples/Kernel_23/MyKernel.cpp @@ -56,7 +56,7 @@ int main() K::Intersect_2 intersection; - const auto intersect = intersection(s1, s2); + /* const auto intersect = */intersection(s1, s2); K::Construct_cartesian_const_iterator_2 construct_it; K::Cartesian_const_iterator_2 cit = construct_it(a); diff --git a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp index ebd4343d304..6d13c05bce1 100644 --- a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp +++ b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp @@ -30,7 +30,7 @@ int main(){ // As we are sure that there IS an intersection // and that the intersection IS a point // we do not have to check for this, or put it in a try/catch - const EK::Point_3& exact_pt = boost::get(*inter); + const EK::Point_3& exact_pt = std::get(*inter); EK_to_IK to_inexact; diff --git a/Kernel_23/examples/Kernel_23/intersection_get.cpp b/Kernel_23/examples/Kernel_23/intersection_get.cpp index ff2332a153c..b245edd4a56 100644 --- a/Kernel_23/examples/Kernel_23/intersection_get.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_get.cpp @@ -14,10 +14,10 @@ int main() const auto result = intersection(seg, lin); if (result) { - if (const Segment_2* s = boost::get(&*result)) { + if (const Segment_2* s = std::get_if(&*result)) { std::cout << *s << std::endl; } else { - const Point_2* p = boost::get(&*result); + const Point_2* p = std::get_if(&*result); std::cout << *p << std::endl; } } diff --git a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp index ffe5c09c7d8..61d0dbba7e2 100644 --- a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp @@ -28,7 +28,7 @@ int main() const auto result = intersection(seg, lin); if (result) { - boost::apply_visitor(Intersection_visitor(), *result); + std::visit(Intersection_visitor(), *result); } else { // no intersection } diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index 6b3ce37ed85..bdb2785889e 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -51,8 +51,8 @@ struct Type_mapper_impl, K1, K2 > { }; template < typename T, typename K1, typename K2 > -struct Type_mapper_impl, K1, K2 > { - typedef boost::optional< typename Type_mapper_impl::type > type; +struct Type_mapper_impl, K1, K2 > { + typedef std::optional< typename Type_mapper_impl::type > type; }; @@ -63,9 +63,9 @@ struct Type_mapper_impl, K1, K2 > { #define CGAL_VARIANT_TYPEMAP(z, n, d) \ template< typename K1, typename K2, BOOST_PP_ENUM_PARAMS(n, class T) > \ -struct Type_mapper_impl, K1, K2> { \ +struct Type_mapper_impl, K1, K2> { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_TYPEDEFS, T) \ - typedef boost::variant type; \ + typedef std::variant type; \ }; BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) @@ -73,16 +73,6 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) #undef CGAL_TYPEMAP_TYPEDEFS #undef CGAL_VARIANT_TYPEMAP -// CODE_TAG -//template -//struct Type_mapper_impl, K1, K2 > { -// typedef typename boost::make_variant_over< -// typename boost::mpl::transform< -// typename boost::variant::types, -// Type_mapper_impl >::type -// >::type type; -//}; - // Then we specialize for all kernel objects. // More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501 #define CGAL_Kernel_obj(X) \ diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index b4c7216b11b..66c3555e45f 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1764,8 +1764,8 @@ namespace CommonKernelFunctors { Line l2 = construct_line(l21, l22); const auto res = typename K::Intersect_3()(l1,l2); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -2172,8 +2172,8 @@ namespace CommonKernelFunctors { Line line = construct_line( l1, l2 ); const auto res = typename K::Intersect_3()(plane,line); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -2185,8 +2185,8 @@ namespace CommonKernelFunctors { Line line = construct_line( l1, l2 ); const auto res = typename K::Intersect_3()(plane,line); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -3417,7 +3417,7 @@ namespace CommonKernelFunctors { const Plane_3& plane = circ.supporting_plane(); const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting plane"); - const Point_3* p = boost::get(&*optional); + const Point_3* p = std::get_if(&*optional); CGAL_kernel_assertion_msg(p != 0, "the segment intersection with the plane is not a point"); return squared_distance(circ.center(), *p) < circ.squared_radius(); } @@ -3622,7 +3622,7 @@ namespace CommonKernelFunctors { operator()(const T1& t1, const T2& t2) const { return Intersections::internal::intersection(t1, t2, K() ); } - boost::optional > + std::optional > operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const { return Intersections::internal::intersection(pl1, pl2, pl3, K() ); } }; @@ -3639,7 +3639,7 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Line_3 Line_3; typedef typename K::Plane_3 Plane_3; - typedef typename boost::optional result_type; + typedef typename std::optional result_type; result_type operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3) const diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h index 9f9896ac7eb..dd4e24005a4 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h @@ -428,10 +428,10 @@ public: - boost::optional< boost::variant > + std::optional< std::variant > operator()(const Segment_3& s1, const Segment_3& s2) const { - typedef boost::variant variant_type; + typedef std::variant variant_type; Point_2 s1_source = project(s1.source()); Point_2 s1_target = project(s1.target()); @@ -447,10 +447,10 @@ public: auto o = intersection(s1_2,s2_2); if(! o){ - return boost::none; + return std::nullopt; } - if(const Segment_2* si = boost::get(&*o)){ + if(const Segment_2* si = std::get_if(&*o)){ FT src[3],tgt[3]; //the third coordinate is the midpoint between the points on s1 and s2 FT z1 = s1.source()[dim] + ( alpha(si->source(), s1_source, s1_target) * ( s1.target()[dim] - s1.source()[dim] )); @@ -468,11 +468,11 @@ public: src[Projector::y_index] = si->source().y(); tgt[Projector::x_index] = si->target().x(); tgt[Projector::y_index] = si->target().y(); - return boost::make_optional(variant_type(Segment_3( Point_3(src[0],src[1],src[2]),Point_3(tgt[0],tgt[1],tgt[2]) ) ) ); + return std::make_optional(variant_type(Segment_3( Point_3(src[0],src[1],src[2]),Point_3(tgt[0],tgt[1],tgt[2]) ) ) ); } - const Point_2* pi = boost::get(&*o); + const Point_2* pi = std::get_if(&*o); FT coords[3]; //compute the third coordinate of the projected intersection point onto 3D segments FT z1 = s1.source()[dim] + ( alpha(*pi, s1_source, s1_target) * ( s1.target()[dim] - s1.source()[dim] )); @@ -484,7 +484,7 @@ public: Point_3 res(coords[0],coords[1],coords[2]); CGAL_assertion(x(res)==pi->x() && y(res)==pi->y()); - return boost::make_optional(variant_type(res)); + return std::make_optional(variant_type(res)); } }; diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h index 42c3bc31859..089fe5ba6cb 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h @@ -182,12 +182,12 @@ public: CGAL_TIME_PROFILER("Construct Projected_intersect_3") } - boost::optional > + std::optional > operator()(const Segment& s1, const Segment& s2) { CGAL_PROFILER("Projected_intersect_3::operator()") CGAL_TIME_PROFILER("Projected_intersect_3::operator()") - typedef boost::variant variant_type; + typedef std::variant variant_type; const Vector_3 u1 = cross_product(s1.to_vector(), normal); if(u1 == NULL_VECTOR) return K().intersect_3_object()(s1.supporting_line(), s2); @@ -204,9 +204,9 @@ public: #ifdef CGAL_T2_PTB_3_DEBUG std::cerr << "planes_intersection is empty\n"; #endif - return boost::none; + return std::nullopt; } - if(const Line* line = boost::get(&*planes_intersection)) + if(const Line* line = std::get_if(&*planes_intersection)) { // check if the intersection line intersects both segments by // checking if a point on the intersection line is between @@ -222,7 +222,7 @@ public: #ifdef CGAL_T2_PTB_3_DEBUG std::cerr << "intersection not inside\n"; #endif - return boost::none; + return std::nullopt; } else { @@ -233,14 +233,14 @@ public: cross_product(s1.to_vector(), s2.to_vector()))); if(! inter){ - return boost::none; + return std::nullopt; } - if(const Point* point = boost::get(&*inter)){ - return boost::make_optional(variant_type(*point)); + if(const Point* point = std::get_if(&*inter)){ + return std::make_optional(variant_type(*point)); } } } - if(boost::get(&*planes_intersection)) + if(std::get_if(&*planes_intersection)) { #ifdef CGAL_T2_PTB_3_DEBUG std::cerr << "coplanar supporting lines\n"; @@ -255,50 +255,50 @@ public: bool src1_in_s2 = is_inside_segment(s2, s1.source()); bool tgt1_in_s2 = is_inside_segment(s2, s1.target()); - if (src1_in_s2 && tgt1_in_s2) return boost::make_optional(variant_type(s1)); - if (src2_in_s1 && tgt2_in_s1) return boost::make_optional(variant_type(s2)); + if (src1_in_s2 && tgt1_in_s2) return std::make_optional(variant_type(s1)); + if (src2_in_s1 && tgt2_in_s1) return std::make_optional(variant_type(s2)); if (src1_in_s2) { if (src2_in_s1) { if (cross_product(normal, Vector_3(s1.source(), s2.source())) != NULL_VECTOR) - return boost::make_optional(variant_type(Segment(s1.source(), s2.source()))); + return std::make_optional(variant_type(Segment(s1.source(), s2.source()))); else - return boost::make_optional(variant_type((s1.source()))); + return std::make_optional(variant_type((s1.source()))); } if (tgt2_in_s1) { if (cross_product(normal, Vector_3(s1.source(), s2.target())) != NULL_VECTOR) - return boost::make_optional(variant_type(Segment(s1.source(), s2.target()))); + return std::make_optional(variant_type(Segment(s1.source(), s2.target()))); else - return boost::make_optional(variant_type(s1.source())); + return std::make_optional(variant_type(s1.source())); } // should never get here with a Kernel with exact constructions - return boost::make_optional(variant_type(s1.source())); + return std::make_optional(variant_type(s1.source())); } if (tgt1_in_s2) { if (src2_in_s1) { if (cross_product(normal, Vector_3(s1.target(), s2.source())) != NULL_VECTOR) - return boost::make_optional(variant_type(Segment(s1.target(), s2.source()))); + return std::make_optional(variant_type(Segment(s1.target(), s2.source()))); else - return boost::make_optional(variant_type(s1.target())); + return std::make_optional(variant_type(s1.target())); } if (tgt2_in_s1) { if (cross_product(normal, Vector_3(s1.target(), s2.target())) != NULL_VECTOR) - return boost::make_optional(variant_type(Segment(s1.target(), s2.target()))); + return std::make_optional(variant_type(Segment(s1.target(), s2.target()))); else - return boost::make_optional(variant_type(s1.target())); + return std::make_optional(variant_type(s1.target())); } // should never get here with a Kernel with exact constructions - return boost::make_optional(variant_type(s1.target())); + return std::make_optional(variant_type(s1.target())); } - return boost::none; + return std::nullopt; } - return boost::none; + return std::nullopt; } }; // end class Projected_intersect_3 diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h index 4d2b09ac3b2..2e9aab53fba 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h @@ -1,9 +1,9 @@ #include #include -#include +#include template -bool is_intersection_empty(const boost::optional& t) +bool is_intersection_empty(const std::optional& t) { return bool(t); } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_depth.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_depth.h index 313d448c871..b3e519f2979 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_depth.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_depth.h @@ -14,7 +14,7 @@ _test_depth(const R& ) Point_3 m = CGAL::midpoint(p,q); auto result = CGAL::intersection(s0, s1); - const Point_3* ip = boost::get(&*result); + const Point_3* ip = std::get_if(&*result); assert(CGAL::depth(p) == 0); assert(CGAL::depth(q) == 0); diff --git a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h index 1ac4f08cf2d..769b4a3d0a2 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h @@ -36,7 +36,7 @@ The following table gives the possible values for `Type1` and `Type2`. The return type of intersecting two objects of the types `Type1` and `Type2` can be specified through the placeholder type specifier `auto`. It is equivalent to -`boost::optional< boost::variant< T... > >`, the last column in the table providing +`std::optional< std::variant< T... > >`, the last column in the table providing the template parameter pack. @@ -147,7 +147,7 @@ void foo(Segment_d seg, Line_d lin) { // use auto auto result = intersection(seg, lin); - if(result) { boost::apply_visitor(Intersection_visitor(), *result); } + if(result) { std::visit(Intersection_visitor(), *result); } else { // no intersection } } @@ -155,8 +155,8 @@ void foo(Segment_d seg, Line_d lin) \sa `do_intersect` \sa `Kernel_d::Intersect_d` -\sa `boost::optional` -\sa `boost::variant` +\sa `std::optional` +\sa `std::variant` */ decltype(auto) diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index fcfbfe0afec..ab2154269a8 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -477,7 +477,7 @@ Intersections on kernel objects currently cover only those objects that are part of flats (`R::Segment_d`, `R::Ray_d`, `R::Line_d`, and `R::Hyperplane_d`). For any pair of objects \f$ o1\f$, \f$ o2\f$ of these types the operation `intersection(o1,o2)` -returns a `boost::optional< boost::variant< T... > >` +returns a `std::optional< std::variant< T... > >` where `T...` is a list of all possible resulting geometric objects. The return type of intersecting two objects of the types `Type1` and `Type2` can be @@ -501,10 +501,10 @@ std::cin >> s1 >> s2; auto v = intersection(s1, s2); if (v) { // not empty - if (const Point *p = boost::get(&*v) ) { + if (const Point *p = std::get_if(&*v) ) { // do something with *p } else { - const Segment *s = boost::get(&*v) ) { + const Segment *s = std::get_if(&*v) ) { // do something with *s } } else { diff --git a/Kernel_d/include/CGAL/Kernel_d/function_objects.h b/Kernel_d/include/CGAL/Kernel_d/function_objects.h index 221c3c7bbdb..0a20e339cf0 100644 --- a/Kernel_d/include/CGAL/Kernel_d/function_objects.h +++ b/Kernel_d/include/CGAL/Kernel_d/function_objects.h @@ -76,22 +76,22 @@ public: template struct result - { typedef boost::optional< boost::variant< Point_d, Line_d > > type; }; + { typedef std::optional< std::variant< Point_d, Line_d > > type; }; template struct result - { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; + { typedef std::optional< std::variant< Point_d, Segment_d > > type; }; template struct result : result { }; template struct result - { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; + { typedef std::optional< std::variant< Point_d, Segment_d > > type; }; template struct result - { typedef boost::optional< boost::variant< Point_d, Ray_d > > type; }; + { typedef std::optional< std::variant< Point_d, Ray_d > > type; }; template struct result : result @@ -99,7 +99,7 @@ public: template struct result - { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; + { typedef std::optional< std::variant< Point_d, Segment_d > > type; }; template struct result : result @@ -107,25 +107,25 @@ public: template struct result - { typedef boost::optional< boost::variant< Point_d, Segment_d, Ray_d > > type; }; + { typedef std::optional< std::variant< Point_d, Segment_d, Ray_d > > type; }; template struct result - { typedef boost::optional< boost::variant< Point_d, Line_d > > type; }; + { typedef std::optional< std::variant< Point_d, Line_d > > type; }; template struct result : result { }; template struct result - { typedef boost::optional< boost::variant< Point_d, Ray_d > > type; }; + { typedef std::optional< std::variant< Point_d, Ray_d > > type; }; template struct result : result { }; template struct result - { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; + { typedef std::optional< std::variant< Point_d, Segment_d > > type; }; template struct result : result { }; diff --git a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt index 6eae9275a75..0cb7753c302 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt @@ -76,7 +76,7 @@ The class `Linear_cell_complex_min_items` is a model of `LinearCellComplexIte \section Linear_cell_complexOperations Operations -Several operations defined in the combinatorial maps or generalized maps package can be used on a linear cell complex. This is the case for all the iteration operations that do not modify the model (see example in Section \ref ssec3Dlcc "A 3D Linear Cell Complex"). This is also the case for all the operations that do not create new 0-cells: `sew`, `unsew`, \link GenericMap::remove_cell `remove_cell`\endlink, \link GenericMap::insert_cell_1_in_cell_2 `insert_cell_1_in_cell_2`\endlink or \link GenericMap::insert_cell_2_in_cell_3 `insert_cell_2_in_cell_3`\endlink. Indeed, all these operations update non `void` attributes, and thus update vertex attributes of a linear cell complex. Note that some existing 0-attributes can be duplicated by the `unsew` method, but these 0-attributes are not new but copies of existing old 0-attributes. +Several operations defined in the combinatorial maps or generalized maps package can be used on a linear cell complex. This is the case for all the iteration operations that do not modify the model (see example in Section \ref ssec3Dlcc "A 3D Linear Cell Complex"). This is also the case for all the operations that do not create new 0-cells: `sew`, `unsew`, \link GenericMap::remove_cell `remove_cell`\endlink, \link GenericMap::insert_cell_1_in_cell_2 `insert_cell_1_in_cell_2`\endlink, \link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2`\endlink or \link GenericMap::insert_cell_2_in_cell_3 `insert_cell_2_in_cell_3`\endlink. Indeed, all these operations update non `void` attributes, and thus update vertex attributes of a linear cell complex. Note that some existing 0-attributes can be duplicated by the `unsew` method, but these 0-attributes are not new but copies of existing old 0-attributes. However, operations that create a new 0-cell can not be directly used since the new 0-cell would not be associated with a vertex attribute. Indeed, it is not possible for these operations to automatically decide which point to create. These operations are: \link GenericMap::insert_cell_0_in_cell_1 `insert_cell_0_in_cell_1`\endlink, \link GenericMap::insert_cell_0_in_cell_2 `insert_cell_0_in_cell_2`\endlink, \link GenericMap::insert_dangling_cell_1_in_cell_2 `insert_dangling_cell_1_in_cell_2`\endlink, plus all the creation operations. For these operations, new versions are proposed taking some points as additional parameters. Lastly, some new operations are defined, which use the geometry (see sections \ref ssecconstructionsop "Construction Operations" and \ref ssecmodifop "Modification Operations"). @@ -278,6 +278,15 @@ The following example shows the incremental builder. \cgalExample{Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp} +\subsection Linear_cell_complexInsert Insert an Edge Between Two Different Faces + +The following example shows the use of \link GenericMap::insert_cell_1_between_two_cells_2 `insert_cell_1_between_two_cells_2`\endlink operation that inserts an edge between two different faces, thus creating an hole in the first face. + +\cgalExample{Linear_cell_complex/linear_cell_complex_3_insert.cpp} + +\cgalFigureBegin{fig_lcc_insert,lcc_insert_example.png} +Result of the run of the linear_cell_complex_3_insert program. A window shows the 3D cube where one face has a hole. +\cgalFigureEnd \section Linear_cell_complexDesign Design and Implementation History diff --git a/Linear_cell_complex/doc/Linear_cell_complex/examples.txt b/Linear_cell_complex/doc/Linear_cell_complex/examples.txt index 4f178f666d1..def1f1a28fe 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/examples.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/examples.txt @@ -5,4 +5,5 @@ \example Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp \example Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp \example Linear_cell_complex/draw_linear_cell_complex.cpp +\example Linear_cell_complex/linear_cell_complex_3_insert.cpp */ diff --git a/Linear_cell_complex/doc/Linear_cell_complex/fig/lcc_insert_example.png b/Linear_cell_complex/doc/Linear_cell_complex/fig/lcc_insert_example.png new file mode 100644 index 00000000000..959598345aa Binary files /dev/null and b/Linear_cell_complex/doc/Linear_cell_complex/fig/lcc_insert_example.png differ diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index d0ed1c3a028..871ba893bfd 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -17,11 +17,12 @@ create_single_source_cgal_program("gmap_linear_cell_complex_3.cpp") create_single_source_cgal_program("linear_cell_complex_3.cpp") create_single_source_cgal_program( "linear_cell_complex_3_attributes_management.cpp") +create_single_source_cgal_program("linear_cell_complex_3_incremental_builder.cpp") +create_single_source_cgal_program("linear_cell_complex_3_insert.cpp") create_single_source_cgal_program("linear_cell_complex_3_operations.cpp") create_single_source_cgal_program( "linear_cell_complex_3_with_colored_vertices.cpp") create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp") -create_single_source_cgal_program("linear_cell_complex_3_incremental_builder.cpp") create_single_source_cgal_program("linear_cell_complex_4.cpp") create_single_source_cgal_program("plane_graph_to_lcc_2.cpp") create_single_source_cgal_program("voronoi_2.cpp") @@ -31,4 +32,5 @@ create_single_source_cgal_program("draw_linear_cell_complex.cpp") if(CGAL_Qt5_FOUND) target_link_libraries(draw_linear_cell_complex PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(linear_cell_complex_3_incremental_builder PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(linear_cell_complex_3_insert PUBLIC CGAL::CGAL_Basic_viewer) endif() diff --git a/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_insert.cpp b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_insert.cpp new file mode 100644 index 00000000000..686ca8ce03a --- /dev/null +++ b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_insert.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC1; +typedef CGAL::Linear_cell_complex_for_generalized_map<3> LCC2; + +template +void test() +{ + LCC lcc; + using Point=typename LCC::Point; + + typename LCC::Dart_descriptor d1= + lcc.make_hexahedron(Point(0,0,0), Point(5,0,0), + Point(5,5,0), Point(0,5,0), + Point(0,5,4), Point(0,0,4), + Point(5,0,4), Point(5,5,4)); + typename LCC::Dart_descriptor d2= + lcc.make_quadrangle(Point(5,2,2), Point(5,1,2), + Point(5,1,1), Point(5,2,1)); + + lcc.insert_cell_1_between_two_cells_2 + (lcc.template opposite<2>(lcc.next(lcc.next(d1))), + lcc.next(lcc.next(d2))); + + CGAL::draw(lcc); +} + +int main() +{ + test(); + test(); + return EXIT_SUCCESS; +} diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.cpp index 28195f35354..89f981f53d1 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.cpp @@ -32,7 +32,8 @@ struct Myattrib : public CGAL::Cell_attribute_with_point struct MonInfo { - MonInfo(int i=0) : mnb(i==0?rand():i), ptr(reinterpret_cast(this)) + MonInfo(long long int i=0) : mnb(i==0?rand():static_cast(i)), + ptr(reinterpret_cast(this)) {} bool operator==(const MonInfo& info) const diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h index 55e93de1f2b..b76bbf1d7e6 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h @@ -45,20 +45,103 @@ void trace_display_msg(const char* msg) #endif } -template -struct Alpha1 +template::type::Info> +struct SetInfoIfNonVoid { - static typename LCC::Dart_descriptor run(LCC&, typename LCC::Dart_descriptor dh) - { return dh; } + static void run(Map& map, + typename Map::template Attribute_descriptor::type attr, + long long int nb) + { + map.template info_of_attribute(attr)= + typename Map::template Attribute_type::type::Info(nb); + } }; -template -struct Alpha1 +template +struct SetInfoIfNonVoid { - static typename LCC::Dart_descriptor run(LCC& lcc, typename LCC::Dart_descriptor dh) - { return lcc.template alpha<1>(dh); } + static void run(Map&, typename Map::template Attribute_descriptor::type, + long long int) + {} }; +template::type> +struct CreateAttributes +{ + static void run(Map& map) + { + long long int nb=0; + for(typename Map::Dart_range::iterator it=map.darts().begin(), + itend=map.darts().end(); it!=itend; ++it) + { + if ( map.template attribute(it)==map.null_descriptor ) + { + map.template set_attribute(it, map.template create_attribute()); + SetInfoIfNonVoid::run(map, map.template attribute(it), ++nb); + } + } + } +}; + +template +struct CreateAttributes +{ + static void run(Map& amap) + { + long long int nb=0; + for ( typename Map::template Attribute_range<0>::type::iterator + it=amap.template attributes<0>().begin(), + itend=amap.template attributes<0>().end(); it!=itend; ++it ) + SetInfoIfNonVoid::run(amap, it, ++nb); + } +}; + +template +struct CreateAttributes +{ + static void run(Map&) + {} +}; + +template +struct CreateAttributes +{ + static void run(Map&) + {} +}; + +template +struct InitDartInfo +{ + static void run(Map& map) + { + long long int nb=0; + for(typename Map::Dart_range::iterator it=map.darts().begin(), + itend=map.darts().end(); it!=itend; ++it) + { + nb=CGAL::get_default_random().get_int(0,20000); + map.info(it)=Info(nb); + } + } +}; + +template +struct InitDartInfo +{ + static void run(Map&) + {} +}; + +template +void create_attributes_2(Map& map) +{ + CreateAttributes::run(map); + CreateAttributes::run(map); + CreateAttributes::run(map); + InitDartInfo::run(map); +} + // Test orientation specialized below only for CMap. For GMap return true. template struct Test_change_orientation_LCC_2 diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.cpp index c1d6eb4cdfe..6e04cbb07a3 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.cpp @@ -32,7 +32,8 @@ struct Myattrib : public CGAL::Cell_attribute_with_point struct MonInfo { - MonInfo(int i=0) : mnb(i==0?rand():i), ptr(reinterpret_cast(this)) + MonInfo(long long int i=0) : mnb(i==0?rand():static_cast(i)), + ptr(reinterpret_cast(this)) {} bool operator==(const MonInfo& info) const diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h index 7235848f2e8..1f696a41811 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h @@ -20,7 +20,6 @@ #include "Linear_cell_complex_2_test.h" #include #include - template bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe, unsigned int nbf, unsigned int nbvol, @@ -63,6 +62,13 @@ bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe, return true; } +template +void create_attributes_3(Map& map) +{ + create_attributes_2(map); + CreateAttributes::run(map); +} + template typename LCC::Dart_descriptor make_loop(LCC& lcc, const typename LCC::Point& p1) { @@ -96,6 +102,7 @@ bool test_LCC_3() Dart_descriptor dh1=lcc.make_segment(Point(0,0,0),Point(1,0,0), true); Dart_descriptor dh2=lcc.make_segment(Point(2,0,0),Point(2,1,0), true); Dart_descriptor dh3=lcc.make_segment(Point(2,2,0),Point(3,1,0), true); + create_attributes_3(lcc); if ( !check_number_of_cells_3(lcc, 6, 3, 6, 3, 3) ) return false; @@ -320,6 +327,7 @@ bool test_LCC_3() dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); lcc.template sew<3>(dh1, dh2); + create_attributes_3(lcc); dh2 = lcc.previous(dh1); dh3 = lcc.next(dh1); lcc.template contract_cell<1>(dh1); @@ -341,6 +349,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); dh2 = lcc.next(dh2); @@ -373,6 +382,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); dh2 = lcc.next(dh2); @@ -405,6 +415,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); dh3 = lcc.make_triangle(Point(5,5,4),Point(7,5,4),Point(6,6,4)); @@ -445,6 +456,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); dh3 = lcc.make_triangle(Point(5,5,4),Point(7,5,4),Point(6,6,4)); @@ -483,6 +495,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_tetrahedron(Point(9, 9, 0),Point(9, 0, 9), Point(0, 9, 9),Point(0, 0, 0)); + create_attributes_3(lcc); typename LCC::Vector v=CGAL::compute_normal_of_cell_0(lcc, dh1); if (v!=typename LCC::Vector(-9,-9,9)) { @@ -496,7 +509,7 @@ bool test_LCC_3() dh1 = lcc. make_hexahedron(Point(0,0,0),Point(1,0,0),Point(1,2,0),Point(0,2,0), Point(0,3,4),Point(0,0,4),Point(6,0,4),Point(6,3,4)); - + create_attributes_3(lcc); v=CGAL::compute_normal_of_cell_2(lcc, lcc.template opposite<2>(lcc.previous(dh1))); if (v!=typename LCC::Vector(0,0,1)) @@ -529,6 +542,7 @@ bool test_LCC_3() make_hexahedron(Point(0,3,0),Point(1,3,0),Point(1,4,0),Point(0,4,0), Point(0,4,1),Point(0,3,1),Point(1,3,1),Point(1,4,1)); dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))); + create_attributes_3(lcc); lcc.template sew<3>(dh1,dh2); lcc.template contract_cell<1>(lcc.previous(dh1)); @@ -560,12 +574,14 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_loop(lcc, Point(0,0,0)); + create_attributes_3(lcc); lcc.template contract_cell<2>(dh1); if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) return false; trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true); + create_attributes_3(lcc); lcc.template sew<1>(lcc.template opposite<2>(dh1), lcc.other_orientation(lcc.template opposite<2>(dh1))); lcc.template contract_cell<2>(dh1); @@ -575,6 +591,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0),true); + create_attributes_3(lcc); lcc.template sew<1>(dh1, lcc.other_orientation(dh1)); lcc.template sew<1>(lcc.template opposite<2>(dh1), lcc.other_orientation(lcc.template opposite<2>(dh1))); @@ -586,6 +603,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0)); dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); lcc.template contract_cell<2>(dh1); if ( !check_number_of_cells_3(lcc, 2, 2, 1, 1, 1) ) @@ -600,6 +618,7 @@ bool test_LCC_3() dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); dh3 = lcc.make_triangle(Point(5,3,3),Point(7,3,3),Point(6,0,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); lcc.template sew<2>(lcc.next(dh2), dh3); @@ -615,6 +634,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.create_dart(Point(0,0,0)); + create_attributes_3(lcc); lcc.template sew<3>(dh1, lcc.create_dart(Point(1,0,0))); lcc.template contract_cell<2>(dh1); if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) @@ -623,6 +643,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_loop(lcc, Point(0,0,0)); dh2 = make_loop(lcc, Point(0,0,1)); + create_attributes_3(lcc); lcc.template sew<3>(dh1, dh2); lcc.template contract_cell<2>(dh1); if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) @@ -630,6 +651,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true); + create_attributes_3(lcc); lcc.template sew<3>(dh1, lcc.make_segment(Point(0,0,1),Point(1,0,1), true)); lcc.template sew<3>(lcc.template opposite<2>(dh1), lcc.template opposite<2>(lcc.template opposite<3>(dh1))); @@ -640,8 +662,10 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true); + create_attributes_3(lcc); lcc.template sew<1>(dh1, lcc.other_orientation(dh1)); dh2 = lcc.make_segment(Point(0,0,1),Point(1,0,1), true); + create_attributes_3(lcc); lcc.template sew<1>(dh2, lcc.other_orientation(dh2)); lcc.template sew<3>(dh1, dh2); lcc.template contract_cell<2>(dh1); @@ -651,10 +675,12 @@ bool test_LCC_3() trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true); + create_attributes_3(lcc); lcc.template sew<1>(dh1, lcc.other_orientation(dh1)); lcc.template sew<1>(lcc.template opposite<2>(dh1), lcc.other_orientation(lcc.template opposite<2>(dh1))); dh2 = lcc.make_segment(Point(0,0,1),Point(1,0,1), true); + create_attributes_3(lcc); lcc.template sew<1>(dh2, lcc.other_orientation(dh2)); lcc.template sew<1>(lcc.template opposite<2>(dh2), lcc.other_orientation(lcc.template opposite<2>(dh2))); @@ -669,6 +695,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0)); dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); lcc.template sew<3>(dh1, make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1))); @@ -686,6 +713,7 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0)); dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); lcc.template sew<3>(dh1, make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1))); @@ -706,6 +734,7 @@ bool test_LCC_3() dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3)); dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3)); dh3 = lcc.make_triangle(Point(5,3,3),Point(7,3,3),Point(6,0,3)); + create_attributes_3(lcc); lcc.template sew<2>(dh1, dh2); lcc.template sew<2>(lcc.next(dh2), dh3); lcc.template sew<3>(dh1, lcc.make_triangle(Point(5,5,4),Point(7,5,4), @@ -737,18 +766,21 @@ bool test_LCC_3() trace_test_begin(); dh1 = make_loop(lcc, Point(0,0,0)); + create_attributes_3(lcc); lcc.template contract_cell<3>(dh1); if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) return false; trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0)); + create_attributes_3(lcc); lcc.template contract_cell<3>(dh1); if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) return false; trace_test_begin(); dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true); + create_attributes_3(lcc); lcc.template sew<1>(dh1, lcc.other_orientation(dh1)); lcc.template sew<1>(lcc.template opposite<2>(dh1), lcc.other_orientation(lcc.template opposite<2>(dh1))); @@ -764,6 +796,7 @@ bool test_LCC_3() dh2 = lcc. make_hexahedron(Point(0,3,0),Point(1,3,0),Point(1,4,0),Point(0,4,0), Point(0,4,1),Point(0,3,1),Point(1,3,1),Point(1,4,1)); + create_attributes_3(lcc); dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))); lcc.template sew<3>(dh1,dh2); @@ -813,6 +846,7 @@ bool test_LCC_3() dh3 = lcc. make_hexahedron(Point(0,6,0),Point(1,6,0),Point(1,7,0),Point(0,7,0), Point(0,7,1),Point(0,6,1),Point(1,6,1),Point(1,7,1)); + create_attributes_3(lcc); dh3 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh3)))); lcc.template sew<3>(dh2,dh3); dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))); @@ -861,6 +895,12 @@ bool test_LCC_3() Point(1,2,0),Point(0,2,0), Point(0,3,4),Point(0,0,4), Point(6,0,4),Point(6,3,4)); + + dh2=lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1)); + if ( !check_number_of_cells_3(lcc, 8, 13, 7, 1, 1) ) + return false; + lcc.template remove_cell<1>(dh2); + dh2 = lcc. make_hexahedron(Point(0,0,4),Point(1,0,4), Point(1,2,4),Point(0,2,4), @@ -871,16 +911,24 @@ bool test_LCC_3() Point(6,2,4),Point(5,2,4), Point(5,3,8),Point(5,0,8), Point(11,0,8),Point(11,3,8)); - lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))))); - lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), lcc.template opposite<2>(lcc.previous(dh3))); + create_attributes_3(lcc); + lcc.template sew<3>(dh1,lcc.template opposite<2> + (lcc.next(lcc.next(lcc.template opposite<2>(dh2))))); + lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), + lcc.template opposite<2>(lcc.previous(dh3))); lcc.template close<3>(); if ( !check_number_of_cells_3(lcc, 16, 28, 16, 4, 1) ) return false; - lcc.insert_cell_1_in_cell_2(lcc.next(dh1), Alpha1::run(lcc, lcc.previous(dh1))); + lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1)); + if ( !check_number_of_cells_3(lcc, 16, 29, 17, 4, 1) ) + return false; + dh2=lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh1)))); - lcc.insert_cell_1_in_cell_2(dh2, Alpha1::run(lcc, lcc.next(lcc.next(dh2)))); + lcc.insert_cell_1_in_cell_2(dh2, lcc.next(lcc.next(dh2))); + if ( !check_number_of_cells_3(lcc, 16, 30, 18, 4, 1) ) + return false; std::vector path; path.push_back(lcc.next(dh1)); @@ -891,6 +939,51 @@ bool test_LCC_3() if ( !check_number_of_cells_3(lcc, 16, 30, 19, 5, 1) ) return false; + // Test insertion between two different 2-cells + trace_test_begin(); + lcc.clear(); + dh1 = lcc. + make_hexahedron(Point(0,0,0),Point(1,0,0), + Point(1,2,0),Point(0,2,0), + Point(0,3,4),Point(0,0,4), + Point(6,0,4),Point(6,3,4)); + dh2 = lcc. + make_hexahedron(Point(0,0,4),Point(1,0,4), + Point(1,2,4),Point(0,2,4), + Point(0,3,8),Point(0,0,8), + Point(6,0,8),Point(6,3,8)); + create_attributes_3(lcc); + lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))))); + + lcc.insert_cell_1_between_two_cells_2(lcc.template opposite<2>(dh1), + lcc.template opposite<2>(lcc.next(dh1))); + if ( !check_number_of_cells_3(lcc, 12, 21, 10, 2, 1) ) + return false; + + trace_test_begin(); + lcc.clear(); + dh1=lcc.make_hexahedron(Point(0,0,0), Point(5,0,0), + Point(5,5,0), Point(0,5,0), + Point(0,5,4), Point(0,0,4), + Point(5,0,4), Point(5,5,4)); + dh2=lcc.make_hexahedron(Point(5,0,0), Point(10,0,0), + Point(10,5,0), Point(5,5,0), + Point(5,5,4), Point(5,0,4), + Point(10,0,4), Point(10,5,4)); + dh3=lcc.make_quadrangle(Point(5,2,2), Point(5,1,2), + Point(5,1,1), Point(5,2,1)); + lcc.template sew<3>(lcc.template opposite<2>(lcc.next(lcc.next(dh1))), + lcc.other_orientation(lcc.template opposite<2>(dh2))); + lcc.template sew<3>(dh3, lcc.make_combinatorial_polygon(4)); + create_attributes_3(lcc); + + // Create an hole in the face between the two cubes + lcc.insert_cell_1_between_two_cells_2(lcc.template opposite<2>(lcc.next(lcc.next(dh1))), + lcc.next(lcc.next(dh3))); + + if (!check_number_of_cells_3(lcc, 16, 25, 11, 2, 1) ) + return false; + // Construction from Polyhedron_3 { trace_test_begin(); diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.cpp index 737e6b965ba..b4d88213275 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.cpp @@ -35,7 +35,8 @@ struct Myattrib : public CGAL::Cell_attribute_with_point struct MonInfo { - MonInfo(int i=0) : mnb(i==0?rand():i), ptr(reinterpret_cast(this)) + MonInfo(long long int i=0) : mnb(i==0?rand():static_cast(i)), + ptr(reinterpret_cast(this)) {} bool operator==(const MonInfo& info) const diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h index 1606dbdaffa..edc8b0f6d40 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h @@ -377,9 +377,9 @@ bool test_LCC_4() if ( !check_number_of_cells_4(lcc, 16, 28, 16, 4, 2, 1) ) return false; - lcc.insert_cell_1_in_cell_2(lcc.next(dh1), Alpha1::run(lcc, lcc.previous(dh1))); + lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1)); dh2=lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh1)))); - lcc.insert_cell_1_in_cell_2(dh2, Alpha1::run(lcc, lcc.next(lcc.next(dh2)))); + lcc.insert_cell_1_in_cell_2(dh2, lcc.next(lcc.next(dh2))); std::vector path; path.push_back(lcc.next(dh1)); diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index e1b24ae23fa..57890430a5b 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -63,7 +63,7 @@ #include #include #include -#include +#include //#include //#include //#include @@ -139,7 +139,7 @@ #include #include #include -#include +#include #include // CGAL @@ -197,7 +197,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Mesh_3/benchmark/Mesh_3/concurrency.cpp b/Mesh_3/benchmark/Mesh_3/concurrency.cpp index 006c917b990..153f235d2b8 100644 --- a/Mesh_3/benchmark/Mesh_3/concurrency.cpp +++ b/Mesh_3/benchmark/Mesh_3/concurrency.cpp @@ -236,11 +236,10 @@ protected: #include #include +#include #include #include -#include #include -#include #include #include @@ -579,7 +578,7 @@ bool make_mesh_3D_images(const std::string &input_filename, // Domain typedef Kernel K; - typedef CGAL::Labeled_image_mesh_domain_3 Mesh_domain; + typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; // Triangulation #ifdef CGAL_CONCURRENT_MESH_3 @@ -600,7 +599,7 @@ bool make_mesh_3D_images(const std::string &input_filename, image.read(input_filename.c_str()); // Create domain - Mesh_domain domain(image); + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); std::cerr << "done." << std::endl; Mesh_parameters params; @@ -686,10 +685,10 @@ bool make_mesh_implicit(double facet_approx, { // Domain #ifdef CGAL_MESH_3_IMPLICIT_WITH_FEATURES - typedef CGAL::Implicit_mesh_domain_3 Implicit_domain; + typedef CGAL::Labeled_mesh_domain_3 Implicit_domain; typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; #else - typedef CGAL::Implicit_mesh_domain_3 Mesh_domain; + typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; #endif // Triangulation @@ -708,7 +707,11 @@ bool make_mesh_implicit(double facet_approx, // Create domain Sphere bounding_sphere(CGAL::ORIGIN, 10.0 * 10.0); - Mesh_domain domain(func, bounding_sphere/*, 1e-7*/); + + namespace p = CGAL::parameters; + Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain(p::function = func, + p::bounding_object = bounding_sphere + /*, p::relative_error_bound = 1e-7*/); #ifdef CGAL_MESH_3_IMPLICIT_WITH_FEATURES // Add 12 feature creases diff --git a/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h deleted file mode 100644 index 02428df510e..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h +++ /dev/null @@ -1,80 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -\deprecated The class template `Gray_image_mesh_domain_3` is deprecated -since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and -its static function -`Labeled_mesh_domain_3::create_gray_image_mesh_domain()`. - -The class `Gray_image_mesh_domain_3` implements a domain described by a 3D -gray image. A 3D gray image is a grid of voxels, -where each voxel is associated with a gray level value. -This class is a model of the concept `MeshDomain_3`. -The domain to be discretized is the union of voxels that lie inside a surface -described by an isolevel value, called \a isovalue. The voxels lying inside the -domain have gray level values that are larger than the isovalue. - -This class includes a member function that provides, by interpolation, -a gray level value at any query point. -An intersection between a segment and bounding -surfaces is detected when both segment endpoints are associated with gray level -values which are on both sides of the isovalue. -The intersection is then constructed by bisection. -The bisection stops when the query segment is shorter than a given error bound -`e`. This error bound is given by `e=d`\f$ \times\f$`bound` where `d` is the -length of the diagonal of the bounding box (in world coordinates) and -`bound` is the argument passed to the constructor of `Labeled_image_mesh_domain_3`. - - -\tparam Image is the type of the input image. -This parameter must be `CGAL::Image_3`. - -\tparam BGT is a geometric traits class which provides -the basic operations to implement -intersection tests and intersection computations -through a bisection method. This parameter must be instantiated -with a model of the concept `BisectionGeometricTraits_3`. - -\tparam Image_word_type is the data type encoded in the `Image` -input file - - -\cgalModels `MeshDomain_3` - -\sa `BisectionGeometricTraits_3` -\sa `CGAL::make_mesh_3()`. - -*/ -template -class Gray_image_mesh_domain_3 -{ -public: - -/// \name Creation -/// @{ - -/*! -Construction from an image. -The object to be meshed is described by the voxels that have a gray-level -value higher than the input isovalue. -@param image the input image -@param iso_value the isovalue, inside `image`, - of the surface describing the boundary of the object to be meshed. -@param value_outside the value attached to voxels outside of the domain - to be meshed. It should be lower than `iso_value` -@param error_bound is relative to the size of the image. -*/ - Gray_image_mesh_domain_3( - const Image& image, - const Image_word_type iso_value, - const Image_word_type value_outside = 0., - const BGT::FT& error_bound = BGT::FT(1e-3)); - -/// @} - -}; /* end Labeled_image_mesh_domain_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Implicit_mesh_domain_3.h deleted file mode 100644 index e2595b9d6fb..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Implicit_mesh_domain_3.h +++ /dev/null @@ -1,80 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -\deprecated The class template `Implicit_mesh_domain_3` is deprecated -since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and -its static function -`Labeled_mesh_domain_3::create_implicit_mesh_domain()`. - -The class `Implicit_mesh_domain_3` implements a domain whose bounding surface is -described -implicitly as the zero level set of a function. -The domain to be discretized is assumed to be the domain where -the function has negative values. -This class is a model of the concept `MeshDomain_3`. - - -\tparam Function provides the definition of the function. -This parameter stands for a model of the concept -`ImplicitFunction` described in the -surface mesh generation package. -The number types `Function::FT` -and `BGT::FT` are required to match. - -\tparam BGT is a geometric traits which provides the basic operations to implement -intersection tests and computations -through a bisection method. This parameter must be instantiated -with a model of the concept `BisectionGeometricTraits_3`. - -The constructor of `Implicit_mesh_domain_3` -takes as argument a bounding sphere which is required -to circumscribe the surface and to have its center inside the -domain. -This domain constructs intersection points -between -the surface and segments/rays/lines by -bisection. It needs an -`error_bound` such that the bisection process is stopped -when the query segment is smaller than the error bound. -The `error_bound` passed as argument to the domain constructor -is a relative error bound expressed as a ratio to the bounding sphere radius. - -\cgalModels `MeshDomain_3` - -\sa `BisectionGeometricTraits_3` -\sa `CGAL::make_mesh_3()`. - -*/ -template< typename Function, typename BGT > -class Implicit_mesh_domain_3 -{ -public: - -/// \name Creation -/// @{ - -/*! -`f` is the object of type `Function` that represents the implicit -surface. - -`bounding_sphere` is a bounding sphere of the implicit surface. The -value of `f` at the sphere center `c` must be -negative: \f$ f(c)<0\f$. - -`error_bound` is the relative error bound -used to compute intersection points between the implicit surface -and query segments. The -bisection is stopped when the length of the intersected -segment is less than the product of `error_bound` by the -radius of `bounding_sphere`. -*/ - Implicit_mesh_domain_3(Function f, - const BGT::Sphere_3& bounding_sphere, - const BGT::FT& error_bound = FT(1e-3)); - -/// @} - -}; /* end Implicit_mesh_domain_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Implicit_to_labeling_function_wrapper.h b/Mesh_3/doc/Mesh_3/CGAL/Implicit_to_labeling_function_wrapper.h deleted file mode 100644 index 9a5b38be16d..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Implicit_to_labeling_function_wrapper.h +++ /dev/null @@ -1,66 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -The class `Implicit_multi_domain_to_labeling_function_wrapper` is a helping class to get a function with integer values -labeling the components of a multi-domain. The multidomain is described through a set of functions {fi(p), i=1, ...n}. -Each component corresponds to a sign vector [s1, s2, ..., sn] where si is the sign of the function fi(p) at a point p of the component. -This wrapper class can be passed to `Labeled_mesh_domain_3` as first template parameter. - -\par Example -For example, the multidomain described by the three functions [f1,f2,f3] and the two sign vectors [-,-,+] and [+,-,+] - includes two components.
-The first one matches the locus of points satisfying f1(p)<0 and f2(p)<0 and f3(p)>0.
-The second one matches the locus of points satisfying f1(p)>0 and f2(p)<0 and f3(p)>0.
- -\tparam Function provides the definition of the function. -This parameter stands for a model of the concept ImplicitFunction described in the surface mesh generation package. -The number types Function::FT and BGT::FT are required to match. - -\sa `Labeled_mesh_domain_3`. - -*/ -template -class Implicit_multi_domain_to_labeling_function_wrapper -{ -public: - /// \name Types - /// @{ - //! - typedef std::vector Function_vector; - //! - typedef typename Function::Point Point_3; - /// @} - - /// \name Creation - /// @{ - /*! - * \brief Construction from a vector of implicit functions. - * \param implicit_functions the vector of implicit functions. - * - * Position vectors are built automatically so that the union of components equals the union of the functions. - */ - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions); - - /*! - * \brief Construction from a vector of implicit functions and a vector of vector of signs. - * \param implicit_functions the vector of implicit functions. - * \param position_vectors the vector of vector of signs. Each vector of positions describes a component. - * \sa `Sign` - */ - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions, - const std::vector >& position_vectors); - - /*! - * \brief Construction from a vector of implicit functions and a vector of strings. - * \param implicit_functions the vector of implicit functions. - * \param position_strings the vector of strings. The strings contained in this vector must contain '+' or '-' only. Each string (vector of positions) describes a component. - */ - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions, - const std::vector& position_strings); -/// @} - -}; /* end Implicit_multi_domain_to_labeling_function_wrapper */ - -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Labeled_image_mesh_domain_3.h deleted file mode 100644 index 9109b74f182..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Labeled_image_mesh_domain_3.h +++ /dev/null @@ -1,63 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -\deprecated The class template `Labeled_image_mesh_domain_3` is deprecated -since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and -its static function -`Labeled_mesh_domain_3::create_labeled_image_mesh_domain()`. - -The class `Labeled_image_mesh_domain_3` implements a domain described by a 3D labeled image. A 3D -labeled image is a grid of voxels, where each voxel is associated with an index -(a subdomain index) characterizing the subdomain in which the voxel lies. This -class is a model of the concept `MeshDomain_3`. The domain to be discretized -is the union of voxels that have an non-default index (different from the -default constructed value of the type `Image::Type`). - -This class includes a member function that provides, by interpolation, the index -of the subdomain in which any query point lies. An intersection between a segment and bounding -surfaces is detected when both segment endpoints are associated with different -values of subdomain indices. The intersection is then constructed by bisection. -The bisection stops when the query segment is shorter than a given error bound -`e`. This error bound is given by `e=d`\f$ \times\f$`bound` where `d` is the -length of the diagonal of the bounding box (in world coordinates) and -`bound` is the argument passed to the constructor of `Labeled_image_mesh_domain_3`. - - -\tparam Image is the type of the input image. -This parameter must be `CGAL::Image_3`. - -\tparam BGT is a geometric traits class which provides -the basic operations to implement -intersection tests and intersection computations -through a bisection method. This parameter must be instantiated -with a model of the concept `BisectionGeometricTraits_3`. - -\cgalModels `MeshDomain_3` - -An executable that uses `Labeled_image_mesh_domain_3` must be linked with -the CGAL_ImageIO library. - -\sa `BisectionGeometricTraits_3` -\sa `CGAL::make_mesh_3()`. - -*/ -template< typename Image, typename BGT > -class Labeled_image_mesh_domain_3 { -public: - -/// \name Creation -/// @{ - -/*! -Construction from an image. -The parameter `error_bound` is relative to the size of the image. -*/ - Labeled_Image_mesh_domain_3(const Image& image, - const BGT::FT& error_bound = FT(1e-3)); - -/// @} - -}; /* end Labeled_image_mesh_domain_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h index 65fa962d512..acfb0b6efd8 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h @@ -60,9 +60,9 @@ unspecified_type manifold_with_boundary(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::exude()` allows the user to trigger a call to `exude_mesh_3()` in the + * The function `parameters::exude()` enables the user to trigger a call to `exude_mesh_3()` in the * `make_mesh_3()` and `refine_mesh_3()` mesh generation functions. - * It also allows the user to pass parameters + * It also enables the user to pass parameters * to the optimization function `exude_mesh_3()` through these mesh generation functions. * * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" @@ -131,9 +131,9 @@ unspecified_type features(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::lloyd()` allows the user to trigger a call of + * The function `parameters::lloyd()` enables the user to trigger a call of * `lloyd_optimize_mesh_3()` in the mesh generation functions - * `make_mesh_3()` and `refine_mesh_3()`. It also allows the user to pass + * `make_mesh_3()` and `refine_mesh_3()`. It also enables the user to pass * parameters to the optimization function * `lloyd_optimize_mesh_3()` through these mesh generation functions. * @@ -210,7 +210,7 @@ unspecified_type lloyd(const Named_function_parameters& np = parameters::default /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::no_exude()` allows the user to tell the mesh generation functions + * The function `parameters::no_exude()` enables the user to tell the mesh generation functions * `make_mesh_3()` and `refine_mesh_3()` that no exudation must be done. * * \cgalHeading{Example} @@ -246,7 +246,7 @@ unspecified_type no_features(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::no_lloyd()` allows the user to tell the mesh generation functions + * The function `parameters::no_lloyd()` enables the user to tell the mesh generation functions * `make_mesh_3()` and `refine_mesh_3()` that no lloyd optimization must be done. * * \cgalHeading{Example} @@ -269,7 +269,7 @@ unspecified_type no_lloyd(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::no_odt()` allows the user to tell the mesh generation functions + * The function `parameters::no_odt()` enables the user to tell the mesh generation functions * `make_mesh_3()` and `refine_mesh_3()` that no ODT optimization must be done. * * \cgalHeading{Example} @@ -292,7 +292,7 @@ unspecified_type no_odt(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::no_perturb()` allows the user to tell mesh generation global functions + * The function `parameters::no_perturb()` enables the user to tell mesh generation global functions * `make_mesh_3()` and `refine_mesh_3()` that no perturbation must be done. * * \cgalHeading{Example} @@ -315,10 +315,10 @@ unspecified_type no_perturb(); /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::odt()` allows the user to trigger a call to + * The function `parameters::odt()` enables the user to trigger a call to * `CGAL::odt_optimize_mesh_3()` in * `CGAL::make_mesh_3()` and `CGAL::refine_mesh_3()` mesh optimization functions. It also - * allows the user to pass parameters to the optimization function + * enables the user to pass parameters to the optimization function * `odt_optimize_mesh_3()` through these mesh generation functions. * * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" @@ -395,10 +395,10 @@ unspecified_type odt(const Named_function_parameters& np = parameters::default_v /*! * \ingroup PkgMesh3Parameters * - * The function `parameters::perturb()` allows the user to trigger a call to + * The function `parameters::perturb()` enables the user to trigger a call to * `perturb_mesh_3()` in * `make_mesh_3()` and `refine_mesh_3()` mesh generation functions. It also - * allows the user to pass parameters + * enables the user to pass parameters * to the optimization function `perturb_mesh_3()` through these mesh generation functions. * * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_cell_criteria_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_cell_criteria_3.h deleted file mode 100644 index bdba19131c8..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_cell_criteria_3.h +++ /dev/null @@ -1,69 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3MeshClasses - -The class `Mesh_cell_criteria_3` is a model of `MeshCellCriteria_3`. It provides, -for the mesh tetrahedra, -a uniform shape criteria -and a sizing field which may be a uniform or variable field. - -\tparam Tr must be identical to the nested type -`Triangulation` of the instance used as model of -`MeshComplex_3InTriangulation_3`. - -\cgalModels `MeshCellCriteria_3` - -\sa `MeshCriteria_3` -\sa `CGAL::Mesh_criteria_3` -\sa `CGAL::make_mesh_3()` - -*/ -template< typename Tr > -class Mesh_cell_criteria_3 { -public: - -/// \name Types -/// @{ - -/*! -Numerical type -*/ -typedef Tr::FT FT; - -/// @} - -/// \name Creation -/// @{ - -/*! -* Returns an object to serve as default criteria for cells. -* @param radius_edge_bound is the upper bound for the radius-edge ratio -* of the tetrahedra. -* @param radius_bound is a uniform upper bound -* for the circumradii of the tetrahedra in the mesh. See -* section \ref introsecparam for further details. -* @param min_radius_bound is a uniform lower bound for the -* circumradii of the tetrahedra in the mesh. -* Only cells with a circumradius larger than that -* bound will be refined. -* Note that if one parameter is set to 0, then its corresponding criteria is ignored. -*/ - Mesh_cell_criteria_3(const FT& radius_edge_bound, - const FT& radius_bound, - const FT& min_radius_bound = 0.); - -/*! -Returns an object to serve as default criteria for facets. The type `SizingField` must -be a model of the concept `MeshDomainField_3`. The behavior and semantic of the arguments are the same -as above, except that the radius bound parameter is a functional instead of a constant. -*/ - template - Mesh_cell_criteria_3(const FT& radius_edge_bound, - const SizingField& radius_bound, - const FT& min_radius_bound = 0.); - -/// @} - -}; /* end Mesh_cell_criteria_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_facet_criteria_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_facet_criteria_3.h deleted file mode 100644 index bfbd79dfe39..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_facet_criteria_3.h +++ /dev/null @@ -1,82 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3MeshClasses - -The class `Mesh_facet_criteria_3` is a model of `MeshFacetCriteria_3`. -It provides a uniform bound for the shape criterion, -a uniform or variable sizing field -for the size criterion and/or -a uniform or variable distance field -for the approximation error criterion. - -\tparam Tr must be identical to the nested type -`Triangulation` of the instance used as model of -`MeshComplex_3InTriangulation_3`. - -\cgalModels `MeshFacetCriteria_3` - -\sa `CGAL::Mesh_facet_topology` -\sa `MeshCriteria_3` -\sa `MeshFacetCriteria_3` -\sa `CGAL::Mesh_criteria_3` -\sa `MeshDomainField_3` -\sa `CGAL::make_mesh_3()` - -*/ -template< typename Tr > -class Mesh_facet_criteria_3 { -public: - -/// \name Types -/// @{ - -/*! -Numerical type -*/ -typedef Tr::Geom_traits::FT FT; - -/// @} - -/// \name Creation -/// @{ - -/*! -Returns an object to serve as criteria for facets. -\param angle_bound is the lower bound for the angle in degrees of the -surface mesh facets. -\param radius_bound is a uniform upper bound -for the radius of the surface Delaunay balls. -\param distance_bound is an upper bound for the center-center distances -of the surface mesh facets. -\param topology is the set of topological constraints -which have to be verified by each surface facet. See -section \ref Mesh_3DelaunayRefinement for further details. -Note that if one parameter is set to 0, then its corresponding criteria is ignored. -\param min_radius_bound is a uniform lower bound for the radius of -the surface Delaunay balls. Only facets with a radius larger than that -bound will be refined. -*/ - Mesh_facet_criteria_3(const FT& angle_bound, - const FT& radius_bound, - const FT& distance_bound, - Mesh_facet_topology topology = FACET_VERTICES_ON_SURFACE, - const FT& min_radius_bound = 0.); - -/*! -Returns an object to serve as criteria for facets. The types `SizingField` and -`DistanceField` must -be models of the concept `MeshDomainField_3`. The behavior and semantic of the arguments are the same -as above, except that the radius and distance bound parameters are functionals instead of constants. -*/ - template - Mesh_facet_criteria_3(const FT& angle_bound, - const SizingField& radius_bound, - const DistanceField& distance_bound, - Mesh_facet_topology topology = FACET_VERTICES_ON_SURFACE, - const FT& min_radius_bound = 0.); - -/// @} - -}; /* end Mesh_facet_criteria_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_polyhedron_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_polyhedron_3.h deleted file mode 100644 index 4ec7e8481fa..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_polyhedron_3.h +++ /dev/null @@ -1,34 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -The class `Mesh_polyhedron_3` provides a customized `Polyhedron_3` type. This type uses -as `PolyhedronItems_3` a customized type which adds data to the Vertex, Face and -Halfedge class. Those data are required to use our sharp features -detection algorithm. - -\tparam IGT stands for the geometric traits associated -to the meshing process. It should be a model of the two concepts -`PolyhedronTraits_3` and `IntersectionGeometricTraits_3`. - -\sa `CGAL::Polyhedron_3` -\sa `CGAL::Polyhedral_mesh_domain_with_features_3` - -*/ -template< typename IGT > -struct Mesh_polyhedron_3 { - -/// \name Types -/// @{ - -/*! -`CGAL::Polyhedron_3` type with customized `PolyhedronItems_3` -designed to handle sharp feature detection. -*/ -typedef unspecified_type type; - -/// @} - -}; /* end Mesh_polyhedron_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h deleted file mode 100644 index cb8834e9040..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h +++ /dev/null @@ -1,57 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3MeshClasses - -The class `Mesh_triangulation_3` is a class template which provides the triangulation -type to be used for the 3D triangulation embedding the mesh. - -\tparam MD must be a model of `MeshDomain_3`. - -\tparam Gt must be a model of `MeshTriangulationTraits_3` or `Default` -and defaults to `Kernel_traits::%Kernel`. - -\tparam Concurrency_tag enables sequential versus parallel meshing and optimization algorithms. - Possible values are `Sequential_tag` (the default), `Parallel_tag`, - and `Parallel_if_available_tag`. - -\tparam Vertex_base must be a model of `MeshVertexBase_3` or `Default` -and defaults to `Mesh_vertex_base_3`. - -\tparam Cell_base must be a model of `MeshCellBase_3` or `Default` -and defaults to `Compact_mesh_cell_base_3`. - -\warning To improve the robustness of the meshing process, the input traits `Gt` - is wrapped with the traits class `Robust_weighted_circumcenter_filtered_traits_3`. - The class `Robust_weighted_circumcenter_filtered_traits_3` upgrades the functors - models of `Kernel::ConstructWeightedCircumcenter_3`, `Kernel::ComputeSquaredRadius_3`, - and `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` that are - provided by `Gt` to use exact computations when the geometric configuration - is close to degenerate (e.g. almost coplanar points).
- Users should therefore be aware that the traits class of the triangulation - will have type `Robust_weighted_circumcenter_filtered_traits_3`. - -\sa `make_mesh_3()` -\sa `Mesh_complex_3_in_triangulation_3` - -*/ -template< typename MD, typename Gt, - typename Concurrency_tag, - typename Vertex_base, - typename Cell_base > -struct Mesh_triangulation_3 { - -/// \name Types -/// @{ - -/*! -The triangulation type to be used for the 3D triangulation embedding the mesh. -This type is a wrapper around the type `CGAL::Regular_triangulation_3`, whose vertex -and cell base classes are respectively `Vertex_base` and `Cell_base`. -*/ -typedef unspecified_type type; - -/// @} - -}; /* end Mesh_triangulation_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_3.h deleted file mode 100644 index a084e25bfcf..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_3.h +++ /dev/null @@ -1,60 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -The class `Polyhedral_mesh_domain_3` implements -a domain defined by a simplicial polyhedral surface. - -The input polyhedral surface must be free of intersection. -It must include (at least) one closed connected component -that defines the boundary of the domain to be meshed. -Inside this bounding component, -the input polyhedral surface may contain -several other components (closed or not) -that will be represented in the final mesh. -This class is a model of the concept `MeshDomain_3`. - -\tparam Polyhedron stands for the type of the input polyhedral surface(s), -model of `FaceListGraph`. - -\tparam IGT stands for a geometric traits class -providing the types and functors required to implement -the intersection tests and intersection computations -for polyhedral boundary surfaces. This parameter has to be instantiated -with a model of the concept `IntersectionGeometricTraits_3`. - -\cgalModels `MeshDomain_3` - -\sa `IntersectionGeometricTraits_3` -\sa `CGAL::make_mesh_3()`. - -*/ -template< typename Polyhedron, typename IGT, typename TriangleAccessor > -class Polyhedral_mesh_domain_3 -{ -public: - -/// \name Creation -/// @{ - -/*! -Construction from a bounding polyhedral surface which must be closed, and free of intersections. -The inside of `bounding_polyhedron` will be meshed. -*/ -Polyhedral_mesh_domain_3(const Polyhedron& bounding_polyhedron); - -/*! -Construction from a polyhedral surface, and a bounding polyhedral surface,. -The first polyhedron must be entirely included inside `bounding_polyhedron`, which must be closed -and free of intersections. -Using this constructor allows to mesh a polyhedral surface which is not closed, or has holes. -The inside of `bounding_polyhedron` will be meshed. -*/ -Polyhedral_mesh_domain_3(const Polyhedron& polyhedron, - const Polyhedron& bounding_polyhedron); - -/// @} - -}; /* end Polyhedral_mesh_domain_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h deleted file mode 100644 index 8ee1140044c..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ /dev/null @@ -1,105 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -The class `Polyhedral_mesh_domain_with_features_3` implements a domain whose -boundary is a simplicial polyhedral surface. -This surface must be free of intersection. -It can either be closed, -included inside another polyhedral surface which is closed and free of intersection, -or open. In the latter case, the meshing process will only take care of the quality -of the 1D (features and boundaries) and 2D (surfaces) components of the mesh. - -It is a model of the concept `MeshDomainWithFeatures_3`. It also -provides a member function to automatically detect sharp features and boundaries from -the input polyhedral surface(s). - -\tparam IGT stands for a geometric traits class providing the types -and functors required to implement the intersection tests and intersection computations -for polyhedral boundary surfaces. This parameter has to be -instantiated with a model of the concept `IntersectionGeometricTraits_3`. - -\cgalModels `MeshDomainWithFeatures_3` - -\sa `CGAL::Mesh_domain_with_polyline_features_3` -\sa `CGAL::Polyhedral_mesh_domain_3` -\sa `CGAL::Mesh_polyhedron_3` -*/ -template< typename IGT > -class Polyhedral_mesh_domain_with_features_3 - : public CGAL::Mesh_domain_with_polyline_features_3< - CGAL::Polyhedral_mesh_domain_3< CGAL::Mesh_polyhedron_3::type, IGT> > - { -public: - -/// \name Types -/// @{ - -/*! -Numerical type. -*/ -typedef unspecified_type FT; - -/// @} - -/// \name Creation -/// @{ - -/*! -Constructs a `Polyhedral_mesh_domain_with_features_3` from a polyhedral surface of type `Polyhedron`. -The only requirement on type `Polyhedron` is that `CGAL::Mesh_polyhedron_3::%type` should -be constructible from `Polyhedron`. -No feature detection is done at this level. Note that a copy of `bounding_polyhedron` will be done. -The polyhedron `bounding_polyhedron` has to be closed and free of intersections. -Its interior of `bounding_polyhedron` will be meshed. -*/ -template -Polyhedral_mesh_domain_with_features_3(const Polyhedron& bounding_polyhedron); - - -/*! -Constructs a `Polyhedral_mesh_domain_with_features_3` from a polyhedral surface, and a bounding polyhedral surface. -`CGAL::Mesh_polyhedron_3::%type` should be constructible from `Polyhedron`. -The first polyhedron should be entirely included inside `bounding_polyhedron`, which has to be closed -and free of intersections. -Using this constructor allows to mesh a polyhedral surface which is not closed, or has holes. -The inside of `bounding_polyhedron` will be meshed. -*/ -template -Polyhedral_mesh_domain_with_features_3(const Polyhedron& polyhedron, - const Polyhedron& bounding_polyhedron); - -/*! -\deprecated Constructs a `Polyhedral_mesh_domain_with_features_3` from an off file. No feature -detection is done at this level. Users must read the file into a `Polyhedron_3` and call the -constructor above. -*/ -Polyhedral_mesh_domain_with_features_3(const std::string& filename); - -/// @} - -/// \name Operations -/// @{ - -/*! -Detects sharp features and boundaries of the internal bounding polyhedron (and the potential internal polyhedron) -and inserts them as features of the domain. `angle_bound` gives the maximum -angle (in degrees) between the two normal vectors of adjacent triangles. -For an edge of the polyhedron, if the angle between the two normal vectors of its -incident facets is bigger than the given bound, then the edge is considered as -a feature edge. -*/ -void detect_features(FT angle_bound=60); - - -/*! -Detects border edges of the bounding polyhedron and inserts them as features of the domain. -This function should be called alone only, and not before or after `detect_features()`. -*/ - void detect_borders(); - -/// @} - -}; /* end Polyhedral_mesh_domain_with_features_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Triangle_accessor_3.h b/Mesh_3/doc/Mesh_3/CGAL/Triangle_accessor_3.h deleted file mode 100644 index e72ee14e286..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Triangle_accessor_3.h +++ /dev/null @@ -1,49 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -The class `Triangle_accessor_3` is a model for the concept `TriangleAccessor_3`. It is -designed to serve as accessor for objects of type `Polyhedron_3`. - -\attention Actually, the class `Triangle_accessor_3` is a partial specialization of the class -template `template -Triangle_accessor_3`. One may give another partial -specialization of this class to handle one's own polyhedron data structure. - - -\tparam K is the geometric traits class. - -\cgalModels `TriangleAccessor_3` - -\sa `CGAL::Polyhedral_mesh_domain_3` - -*/ -template< CGAL::Polyhedron, typename K > -class Triangle_accessor_3 { -public: - -/// \name Types -/// @{ - -/*! -Triangle iterator. -*/ -typedef Polyhedron_3::Facet_const_iterator -Triangle_iterator; - -/*! -Triangle -handle. -*/ -typedef Polyhedron_3::Facet_const_handle Triangle_handle; - -/*! -Triangle type. -*/ -typedef K::Triangle_3 Triangle_3; - -/// @} - -}; /* end Triangle_accessor_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/IntersectionGeometricTraits_3.h b/Mesh_3/doc/Mesh_3/Concepts/IntersectionGeometricTraits_3.h index a1b35060f85..6f09809fae9 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/IntersectionGeometricTraits_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/IntersectionGeometricTraits_3.h @@ -12,7 +12,7 @@ and construction of intersections between segments and triangles. \cgalHasModel All models of the `Kernel` concept. \sa `BisectionGeometricTraits_3` -\sa `CGAL::Polyhedral_mesh_domain_3` +\sa `CGAL::Polyhedral_mesh_domain_3` */ class IntersectionGeometricTraits_3 { @@ -53,9 +53,9 @@ Function object that constructs the intersection between a 3D segment and a 3D triangle. Partial model of `::Kernel::Intersect_3`. Provides the operators: -- `boost::optional< boost::variant< Point_3, Segment_3 > > operator()(Segment_3 seg, Triangle_3 tr)` +- `std::optional< std::variant< Point_3, Segment_3 > > operator()(Segment_3 seg, Triangle_3 tr)` -- `boost::optional< boost::variant< Point_3, Segment_3 > > operator()(Triangle_3 tr, Segment_3 seg)` +- `std::optional< std::variant< Point_3, Segment_3 > > operator()(Triangle_3 tr, Segment_3 seg)` which computes the intersection between the triangle and the segment. */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshCellBase_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshCellBase_3.h index 028d9e70d9f..f1b619635db 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshCellBase_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshCellBase_3.h @@ -41,10 +41,10 @@ and `is_facet_visited(1)` in parallel must be safe) Moreover, the parallel algorithms require an erase counter in each cell (see below). -\cgalRefines{SimplicialMeshCellBase_3,RegularTriangulationCellBaseWithWeightedCircumcenter_3,CopyConstructible} +\cgalRefines{SimplicialMeshCellBase_3,RegularTriangulationCellBaseWithWeightedCircumcenter_3} -\cgalHasModel `CGAL::Compact_mesh_cell_base_3` -\cgalHasModel `CGAL::Mesh_cell_base_3` +\cgalHasModel `CGAL::Compact_mesh_cell_base_3` +\cgalHasModel `CGAL::Mesh_cell_base_3` \sa `CGAL::make_mesh_3()` \sa `MeshDomain_3` diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshCellCriteria_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshCellCriteria_3.h index d3b0b83f0a6..efcab46d8d6 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshCellCriteria_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshCellCriteria_3.h @@ -26,7 +26,7 @@ public: /// @{ /*! -Handle type for the cells of the +%Handle type for the cells of the triangulation. Must match the `Cell_handle` type in the triangulation type used by the mesh generation function. */ @@ -48,7 +48,7 @@ the cell is good with regard to the criteria. In addition, an object of this type must contain an object of type `Cell_quality` if it represents a bad cell. `Cell_quality` must be accessible by `operator*()`. -Note that `boost::optional` is a natural model of this concept. +Note that `std::optional` is a natural model of this concept. */ typedef unspecified_type Is_cell_bad; diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshCriteria_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshCriteria_3.h index ea4a1f33ea3..07cd4f12acd 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshCriteria_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshCriteria_3.h @@ -16,9 +16,10 @@ The concept `MeshCriteria_3` encapsulates these concepts. \sa `MeshFacetCriteria_3` \sa `MeshCellCriteria_3` +\sa `MeshCriteriaWithFeatures_3` \sa `CGAL::make_mesh_3()` \sa `CGAL::refine_mesh_3()` -\sa `MeshCriteriaWithFeatures_3` + */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainField_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainField_3.h index 644a3a46046..c90469bf835 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainField_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainField_3.h @@ -5,7 +5,7 @@ The concept `MeshDomainField_3` describes a scalar field which could be queried at any point of the space. -\cgalHasModel `CGAL::Mesh_constant_domain_field_3` +\cgalHasModel `CGAL::Mesh_constant_domain_field_3` \sa `MeshDomain_3` \sa `MeshDomainWithFeatures_3` diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h index 18e97b9a275..8e91075c581 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h @@ -17,7 +17,7 @@ between two ordered points on the same curve. \cgalRefines{MeshDomain_3} -\cgalHasModel `CGAL::Mesh_domain_with_polyline_features_3` +\cgalHasModel `CGAL::Mesh_domain_with_polyline_features_3` \cgalHasModel `CGAL::Polyhedral_mesh_domain_with_features_3` \sa `MeshDomain_3` @@ -47,7 +47,7 @@ Point type. typedef unspecified_type Point_3; /*! -Type of indices for curves (i.e. \f$ 1\f$-dimensional features) +Type of indices for curves (i.e., \f$ 1\f$-dimensional features) of the input domain. Must be a model of CopyConstructible, Assignable, DefaultConstructible and LessThanComparable. The default constructed value must be the value of an edge which @@ -56,7 +56,7 @@ does not approximate a 1-dimensional feature of the input domain. typedef unspecified_type Curve_index; /*! -Type of indices for corners (i.e.\f$ 0\f$--dimensional features) +Type of indices for corners (i.e., \f$ 0\f$--dimensional features) of the input domain. Must be a model of CopyConstructible, Assignable, DefaultConstructible and LessThanComparable. diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h index 240f9b0f1fb..16c37b7e611 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h @@ -29,7 +29,7 @@ A segment, ray or line is said to intersect properly the domain boundary if it includes points which are strictly inside and strictly outside the domain (resp. the subdomain). -\cgalHasModel `CGAL::Polyhedral_mesh_domain_3` +\cgalHasModel `CGAL::Polyhedral_mesh_domain_3` \cgalHasModel `CGAL::Labeled_mesh_domain_3` \sa `MeshVertexBase_3` @@ -138,7 +138,7 @@ A function object to query whether a point is in the input domain or not. In the positive case, it outputs the subdomain which includes the query point. Provides the operator: -`boost::optional operator()(Point_3 p)` +`std::optional operator()(Point_3 p)` */ typedef unspecified_type Is_in_domain; @@ -148,11 +148,11 @@ intersection queries between the surface patches of the domain and objects of type `Segment_3`, `Ray_3` or `Line_3`. Provides the operators: -`boost::optional operator()(Segment_3 s)` +`std::optional operator()(Segment_3 s)` -`boost::optional operator()(Ray_3 r)` +`std::optional operator()(Ray_3 r)` -`boost::optional operator()(Line_3 l)` +`std::optional operator()(Line_3 l)` The return type of the operators tell whether or not the query intersects a surface patch. In the positive case, it provides (through operator*()) the diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h index 4c044751069..50b9374fa98 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h @@ -46,7 +46,7 @@ typedef unspecified_type FT; /*! -Returns the value of the sizing field (i.e.\ the maximum edge length) at point `p`. +Returns the value of the sizing field (i.e., the maximum edge length) at point `p`. */ FT sizing_field(const Point_3& p); diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshFacetCriteria_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshFacetCriteria_3.h index 325dedeff05..f25f9a0f4f3 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshFacetCriteria_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshFacetCriteria_3.h @@ -55,7 +55,7 @@ the facet is good with regard to the criteria. In addition, an object of this type must contain an object of type `Facet_quality` if it represents a bad facet. `Facet_quality` must be accessible by -`operator*()`. Note that `boost::optional` is +`operator*()`. Note that `std::optional` is a natural model of this concept. */ typedef unspecified_type Is_facet_bad; diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshPolyline_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshPolyline_3.h index bfe6e4b8d98..b2a0fb4fa9c 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshPolyline_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshPolyline_3.h @@ -2,7 +2,7 @@ \ingroup PkgMesh3SecondaryConcepts \cgalConcept -The concept `MeshPolyline_3` implements a container of points designed to represent a polyline (i.e.\ a sequence of points). +The concept `MeshPolyline_3` implements a container of points designed to represent a polyline (i.e., a sequence of points). Types and functions provided in this concept are such as standard template library containers are natural models of this concept. diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h index 99b7a9d8270..26d3d9403dd 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h @@ -334,11 +334,11 @@ public: /*! A constructor object that must provide the function operators: - `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Plane_3 p)` + `std::optional< std::variant< T... > > operator()(Segment_3 s, Plane_3 p)` - `boost::optional< boost::variant< T... > > operator()(Ray_3 r, Iso_cuboid i)` + `std::optional< std::variant< T... > > operator()(Ray_3 r, Iso_cuboid i)` - `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Iso_cuboid i)` + `std::optional< std::variant< T... > > operator()(Segment_3 s, Iso_cuboid i)` which returns the intersection region of two geometrical objects. */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshVertexBase_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshVertexBase_3.h index 4739741b01c..a80d9c5b28f 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshVertexBase_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshVertexBase_3.h @@ -22,7 +22,7 @@ each cell (see below). \cgalRefines{SimplicialMeshVertexBase_3,RegularTriangulationVertexBase_3,SurfaceMeshVertexBase_3} -\cgalHasModel `CGAL::Mesh_vertex_base_3` +\cgalHasModel `CGAL::Mesh_vertex_base_3` \sa `CGAL::make_mesh_3()` \sa `CGAL::refine_mesh_3()` diff --git a/Mesh_3/doc/Mesh_3/Concepts/TriangleAccessor_3.h b/Mesh_3/doc/Mesh_3/Concepts/TriangleAccessor_3.h deleted file mode 100644 index 03f9ff4880a..00000000000 --- a/Mesh_3/doc/Mesh_3/Concepts/TriangleAccessor_3.h +++ /dev/null @@ -1,66 +0,0 @@ -/*! -\ingroup PkgMesh3SecondaryConcepts -\cgalConcept - -The concept `TriangleAccessor_3` represents an accessor to a triangulated polyhedral -surface, intersection free and without boundaries. - -\cgalHasModel `CGAL::Triangle_accessor_3,K>` - -\sa `CGAL::Polyhedral_mesh_domain_3` -\sa `CGAL::make_mesh_3()` - -*/ - -class TriangleAccessor_3 { -public: - -/// \name Types -/// @{ - -/*! -Triangle type. Must be a model of DefaultConstructible and -CopyConstructible. -*/ -typedef unspecified_type Triangle_3; - -/*! -Triangle iterator type. Must be a model of InputIterator. -*/ -typedef unspecified_type Triangle_iterator; - -/*! -Handle to a `Triangle_3`. Must be -constructible from `Triangle_iterator`. It may be `Triangle_Iterator` itself. -*/ -typedef unspecified_type Triangle_handle; - -/*! -Polyhedron type. -*/ -typedef unspecified_type Polyhedron; - -/// @} - -/// \name Operations -/// @{ - -/*! -Returns a `Triangle_iterator` to visit the triangles of polyhedron `p`. -*/ -Triangle_iterator triangles_begin(Polyhedron p); - -/*! -Returns the past-the-end iterator for the above iterator. -*/ -Triangle_iterator triangles_end(Polyhedron p); - -/*! -Returns a `Triangle_3` -object from handle `h`. -*/ -Triangle_3 triangle(Triangle_handle h); - -/// @} - -}; /* end TriangleAccessor_3 */ diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index af31a706c75..18c58c248e6 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -1,10 +1,22 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} +# custom options for this package + +EXTRACT_ALL = false +HIDE_UNDOC_CLASSES = true +HIDE_UNDOC_MEMBERS = true +WARN_IF_UNDOCUMENTED = false # macros to be used inside the code ALIASES += "cgalDescribePolylineType=A polyline is defined as a sequence of points, each pair of contiguous points defines a segment of the polyline. If the first and last points of the polyline are identical, the polyline is closed." INPUT += \ + ${CGAL_Mesher_level_INCLUDE_DIR}/CGAL/Mesh_optimization_return_code.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_triangulation_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_polyhedron_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_mesh_domain_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_mesh_domain_with_features_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_complex_mesh_domain_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Implicit_to_labeling_function_wrapper.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_domain_with_polyline_features_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/generate_label_weights.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Sizing_field_with_aabb_tree.h \ @@ -17,6 +29,10 @@ INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/make_mesh_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Labeled_mesh_domain_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_constant_domain_field_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_cell_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_facet_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_facet_topology.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_vertex_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_cell_base_3.h \ diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index 521e98a0e1f..abe63982656 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -296,7 +296,7 @@ also inserts a small set of auxiliary vertices that belong to the triangulation but are isolated from the complex at the end of the meshing process. These so-called \em isolated vertices belong to the triangulation but not to any cell -of the `C3T3`. They can be removed using the function `remove_isolated_vertices()`. +of the `C3T3`. They can be removed using the function `remove_isolated_vertices()` of `CGAL::Mesh_complex_3_in_triangulation_3`. \section Mesh_3_section_interface Interface @@ -494,7 +494,7 @@ protecting ball centers that are consecutive on a 1-feature. This parameter has The four additional parameters are optimization parameters. They control which optimization processes are performed -and allow the user to tune the parameters of the activated optimization processes. +and enable the user to tune the parameters of the activated optimization processes. These parameters have internal types which are not described but the library provides global functions to generate appropriate values of these types: @@ -679,7 +679,7 @@ View of 3D meshes produced from a polyhedral domain with a nested surface. The following code creates a polyhedral domain, with only one polyhedron, and no "bounding polyhedron", so the volumetric part of the domain will be empty. -This allows to remesh a surface, and is equivalent to the function `make_surface_mesh()`. +This enables to remesh a surface, and is equivalent to the function `make_surface_mesh()`. \cgalExample{Mesh_3/remesh_polyhedral_surface.cpp} @@ -725,7 +725,7 @@ to the voxels surface, causing an aliasing effect. A solution to generate a smooth and accurate output surface was described by Stalling et al in \cgalCite{stalling1998weighted}. It consists in generating a second input image, made of integer coefficients called *weights*, and use those weights to define smoother domain boundaries. -The 3D image of weights can be generated using `CGAL::Mesh_3::generate_weights()` as shown in +The 3D image of weights can be generated using `CGAL::Mesh_3::generate_label_weights()` as shown in the following example. \cgalExample{Mesh_3/mesh_3D_weighted_image.cpp} @@ -1428,6 +1428,6 @@ and Mariette Yvinec. It appeared first in the release 3.8 of \cgal. In 2013, Clément Jamin made the meshing and optimization algorithms parallel on multi-core shared-memory architectures. -\todo Add reference to paper or research report when it is available. + */ } /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/PackageDescription.txt b/Mesh_3/doc/Mesh_3/PackageDescription.txt index 553358a202b..e063c6eeee7 100644 --- a/Mesh_3/doc/Mesh_3/PackageDescription.txt +++ b/Mesh_3/doc/Mesh_3/PackageDescription.txt @@ -27,7 +27,7 @@ /// \defgroup PkgMesh3Functions Mesh Generation Functions /// \ingroup PkgMesh3Ref /// The two main functions to generate a mesh are `make_mesh_3()` and `refine_mesh_3()`. -/// The other functions allow to optimize an existing mesh. +/// The other functions enable to optimize an existing mesh. /// \defgroup PkgMesh3Parameters Parameter Functions /// \ingroup PkgMesh3Ref @@ -41,7 +41,6 @@ /*! \addtogroup PkgMesh3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Mesh Generation,PkgMesh3} \cgalPkgPicture{Mesh_3/fig/multilabel_mesher_small.jpg} \cgalPkgSummaryBegin @@ -82,34 +81,29 @@ related to the template parameters of some models of the main concepts: - `MeshVertexBase_3` - `MeshDomainField_3` - `MeshPolyline_3` -- `TriangleAccessor_3` \cgalCRPSection{Classes} -- `CGAL::Mesh_triangulation_3` -- `CGAL::Mesh_vertex_base_3` -- `CGAL::Compact_mesh_cell_base_3` -- `CGAL::Mesh_cell_base_3` +- `CGAL::Mesh_triangulation_3` +- `CGAL::Mesh_vertex_base_3` +- `CGAL::Compact_mesh_cell_base_3` +- `CGAL::Mesh_cell_base_3` - `CGAL::Mesh_criteria_3` - `CGAL::Mesh_cell_criteria_3` - `CGAL::Mesh_facet_criteria_3` - `CGAL::Mesh_edge_criteria_3` -- `CGAL::Mesh_constant_domain_field_3` +- `CGAL::Mesh_constant_domain_field_3` The following classes are models of domain concepts and their associated classes: - `CGAL::Labeled_mesh_domain_3` -- `CGAL::Polyhedral_mesh_domain_3` +- `CGAL::Polyhedral_mesh_domain_3` - `CGAL::Polyhedral_mesh_domain_with_features_3` - `CGAL::Polyhedral_complex_mesh_domain_3` -- `CGAL::Mesh_domain_with_polyline_features_3` +- `CGAL::Mesh_domain_with_polyline_features_3` - `CGAL::Mesh_polyhedron_3` -- `CGAL::Triangle_accessor_3,K>` - `CGAL::Implicit_multi_domain_to_labeling_function_wrapper` -- `CGAL::Implicit_mesh_domain_3` (deprecated) -- `CGAL::Labeled_image_mesh_domain_3` (deprecated) -- `CGAL::Gray_image_mesh_domain_3` (deprecated) The following functors are available for feature detection: diff --git a/Mesh_3/doc/Mesh_3/dependencies b/Mesh_3/doc/Mesh_3/dependencies index be614f85b31..3219d3896f4 100644 --- a/Mesh_3/doc/Mesh_3/dependencies +++ b/Mesh_3/doc/Mesh_3/dependencies @@ -10,8 +10,8 @@ Triangulation_3 Periodic_3_triangulation_3 TDS_3 Polyhedron +Surface_mesh Miscellany Mesh_2 Polygon_mesh_processing SMDS_3 - diff --git a/Mesh_3/doc/Mesh_3/examples.txt b/Mesh_3/doc/Mesh_3/examples.txt index ce8dbbb1b34..d9c2eb95d71 100644 --- a/Mesh_3/doc/Mesh_3/examples.txt +++ b/Mesh_3/doc/Mesh_3/examples.txt @@ -20,9 +20,12 @@ \example Mesh_3/mesh_optimization_example.cpp \example Mesh_3/mesh_optimization_lloyd_example.cpp \example Mesh_3/mesh_polyhedral_domain.cpp +\example Mesh_3/mesh_polyhedral_domain_sm.cpp \example Mesh_3/mesh_polyhedral_complex.cpp +\example Mesh_3/mesh_polyhedral_complex_sm.cpp \example Mesh_3/remesh_polyhedral_surface.cpp \example Mesh_3/mesh_polyhedral_domain_with_features.cpp +\example Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp \example Mesh_3/mesh_polyhedral_domain_with_features_sizing.cpp \example Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp \example Mesh_3/mesh_polyhedral_domain_with_lipschitz_sizing.cpp diff --git a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp index fb528891cd1..32a612b7b1d 100644 --- a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp @@ -99,9 +99,9 @@ public: { Is_in_domain(const Hybrid_domain& domain) : r_domain_(domain) {} - boost::optional operator()(const K::Point_3& p) const + std::optional operator()(const K::Point_3& p) const { - boost::optional subdomain_index = + std::optional subdomain_index = r_domain_.implicit_domain.is_in_domain_object()(p); if(subdomain_index) return 2; else return r_domain_.polyhedron_domain.is_in_domain_object()(p); diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index d30acbcb141..1e5ee765731 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -437,7 +437,7 @@ public: // CHECKING - // the following trivial is_valid allows + // the following trivial is_valid enables // the user of derived cell base classes // to add their own purpose checking bool is_valid(bool = false, int = 0) const diff --git a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h deleted file mode 100644 index 99bc1e6b313..00000000000 --- a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2009 INRIA Sophia-Antipolis (France). -// Copyright (c) 2012 GeometryFactory Sarl (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Stephane Tayeb, Laurent Rineau -// - -#ifndef CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H -#define CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H - -#include - -#include - -#include -#include -#include -#include - -namespace CGAL { - -/** - * @class Gray_image_mesh_domain_3 - * - * - */ -template, - typename Subdomain_index = int> -class -CGAL_DEPRECATED_MSG -( "The class template `CGAL::Gray_image_mesh_domain_3` is now deprecated. " - "Use the static member function template " - "`Labeled_mesh_domain_3::create_gray_image_mesh_domain` instead.") -Gray_image_mesh_domain_3 - : public Labeled_mesh_domain_3 -{ -public: - typedef Image_word_type_ Image_word_type; - typedef Mesh_3::Image_to_labeled_function_wrapper Wrapper; - - typedef Labeled_mesh_domain_3 Base; - - typedef typename Base::Sphere_3 Sphere_3; - typedef typename Base::FT FT; - typedef BGT Geom_traits; - typedef CGAL::Bbox_3 Bbox_3; - - /// Constructor - Gray_image_mesh_domain_3(const Image& image, - const Image_word_type iso_value, - const Image_word_type value_outside = 0., - const FT& error_bound = FT(1e-3), - CGAL::Random* p_rng = nullptr) - : Base(parameters::function = Wrapper(image, - Transform(iso_value), - Transform(iso_value)(value_outside)), - parameters::bounding_object = Mesh_3::internal::compute_bounding_box(image), - parameters::relative_error_bound = error_bound, - parameters::p_rng = p_rng) - { - CGAL_assertion(Transform(iso_value)(value_outside) == 0); - } - - Gray_image_mesh_domain_3(const Image& image, - const Transform& transform, - const Image_word_type value_outside = 0., - const FT& error_bound = FT(1e-3), - CGAL::Random* p_rng = nullptr) - : Base(parameters::function = Wrapper(image, transform, transform(value_outside)), - parameters::bounding_object = Mesh_3::internal::compute_bounding_box(image), - parameters::relative_error_bound = error_bound, - parameters::p_rng = p_rng) - { - CGAL_assertion(transform(value_outside) == 0); - } - - /// Destructor - virtual ~Gray_image_mesh_domain_3() {} -}; // end class Gray_image_mesh_domain_3 - -} // end namespace CGAL - -#include - - -#endif // CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h deleted file mode 100644 index 62c9eb47b5c..00000000000 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2009 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Stéphane Tayeb -// -//****************************************************************************** -// File Description : -// class Implicit_mesh_domain_3. See class description. -//****************************************************************************** - -#ifndef CGAL_IMPLICIT_MESH_DOMAIN_3_H -#define CGAL_IMPLICIT_MESH_DOMAIN_3_H - -#include - -#include - -#include -#include -#include -#include - -namespace CGAL { - - -/** - * @class Implicit_mesh_domain_3 - * - * Implements mesh_traits for a domain defined as the negative values of - * an implicit function. - */ -template > -class -CGAL_DEPRECATED_MSG -( "The class template `CGAL::Implicit_mesh_domain_3` is now deprecated. " - "Use the static member function template " - "`Labeled_mesh_domain_3::create_implicit_image_mesh_domain` instead.") -Implicit_mesh_domain_3 - : public Labeled_mesh_domain_3 -{ -public: - /// Base type - typedef Labeled_mesh_domain_3 Base; - - /// Public types - typedef typename Base::Sphere_3 Sphere_3; - typedef typename Base::FT FT; - typedef BGT Geom_traits; - - /** - * Constructor - * @param f the function which negative values defines the domain - * @param bounding_sphere a bounding sphere of the domain - * @param error_bound the error bound relative to the sphere radius - */ - Implicit_mesh_domain_3(Function_ f, - const Sphere_3& bounding_sphere, - const FT& error_bound = FT(1e-6), - CGAL::Random* p_rng = nullptr) - : Base(parameters::function = Wrapper(f), parameters::bounding_object = bounding_sphere, parameters::relative_error_bound = error_bound, - parameters::null_subdomain_index = Null_subdomain_index(), parameters::p_rng = p_rng) {} - - /// Destructor - virtual ~Implicit_mesh_domain_3() {} - - using Base::bbox; -private: - // Disabled copy constructor & assignment operator - typedef Implicit_mesh_domain_3 Self; - Implicit_mesh_domain_3(const Self& src); - Self& operator=(const Self& src); - -}; // end class Implicit_mesh_domain_3 - - -} // end namespace CGAL - -#include - -#endif // CGAL_IMPLICIT_MESH_DOMAIN_3_H diff --git a/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h b/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h index 0be7ea4e741..7e3af3de705 100644 --- a/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h +++ b/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h @@ -140,7 +140,32 @@ private: }; // end class Implicit_to_labeling_function_wrapper + + /*! +\ingroup PkgMesh3Domains + +The class `Implicit_multi_domain_to_labeling_function_wrapper` is a helping class to get a function with integer values +labeling the components of a multidomain. The multidomain is described through a set of functions {fi(p), i=1, ...n}. +Each component corresponds to a sign vector [s1, s2, ..., sn] where si is the sign of the function fi(p) at a point p of the component. +This wrapper class can be passed to `Labeled_mesh_domain_3` as first template parameter. + +\par Example +For example, the multidomain described by the three functions [f1,f2,f3] and the two sign vectors [-,-,+] and [+,-,+] + includes two components.
+The first one matches the locus of points satisfying f1(p)<0 and f2(p)<0 and f3(p)>0.
+The second one matches the locus of points satisfying f1(p)>0 and f2(p)<0 and f3(p)>0.
+ +\tparam Function provides the definition of the function. +This parameter stands for a model of the concept `ImplicitFunction` described in the surface mesh generation package. +The number types `Function::FT` and `BGT::FT` are required to match. + +\sa `CGAL::Labeled_mesh_domain_3`. +*/ +#ifdef DOXYGEN_RUNNING +template +#else template +#endif class Implicit_multi_domain_to_labeling_function_wrapper { template @@ -159,10 +184,20 @@ class Implicit_multi_domain_to_labeling_function_wrapper }; public: - typedef int return_type; - typedef ImplicitFunction Function; - typedef typename Implicit_function_traits::Point Point_3; - typedef std::vector Function_vector; + /// \name Types + /// @{ + +#ifdef DOXYGEN_RUNNING + typedef typename Function::Point Point_3; +#else + typedef ImplicitFunction Function; + typedef typename Implicit_function_traits::Point Point_3; + typedef int return_type; +#endif + + typedef std::vector Function_vector; + + /// @} private: std::vector funcs; @@ -170,13 +205,24 @@ private: std::vector bmasks; public: - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& vf, const std::vector >& vps) - : funcs(vf), bmasks(vps.size(), Bmask(funcs.size() * 2, false)) + /// \name Creation + /// @{ + + /*! + * \brief Construction from a vector of implicit functions and a vector of vector of signs. + * + * \param implicit_functions the vector of implicit functions. + * \param position_vectors the vector of vector of signs. Each vector of positions describes a component. + * + * \sa `Sign` + */ + Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions, const std::vector >& position_vectors) + : funcs(implicit_functions), bmasks(position_vectors.size(), Bmask(funcs.size() * 2, false)) { CGAL_assertion(funcs.size() != 0); std::size_t mask_index = 0; - for (std::vector >::const_iterator mask_iter = vps.begin(), mask_end_iter = vps.end(); + for (std::vector >::const_iterator mask_iter = position_vectors.begin(), mask_end_iter = position_vectors.end(); mask_iter != mask_end_iter; ++mask_iter) { @@ -198,9 +244,15 @@ public: } std::sort(bmasks.begin(), bmasks.end()); } + /*! + * \brief Construction from a vector of implicit functions. - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& vf) - : funcs(vf) + * \param implicit_functions the vector of implicit functions. + * + * Position vectors are built automatically so that the union of components equals the union of the functions. + */ + Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions) + : funcs(implicit_functions) { CGAL_assertion(funcs.size() != 0); @@ -225,13 +277,19 @@ public: std::sort(bmasks.begin(), bmasks.end()); } - Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& vf, const std::vector& vps) - : funcs(vf), bmasks(vps.size(), Bmask(funcs.size() * 2, false)) + /*! + * \brief Construction from a vector of implicit functions and a vector of strings. + * + * \param implicit_functions the vector of implicit functions. + * \param position_strings the vector of strings. The strings contained in this vector must contain '+' or '-' only. Each string (vector of positions) describes a component. + */ + Implicit_multi_domain_to_labeling_function_wrapper (const Function_vector& implicit_functions, const std::vector& position_strings) + : funcs(implicit_functions), bmasks(position_strings.size(), Bmask(funcs.size() * 2, false)) { CGAL_assertion(funcs.size() != 0); std::size_t mask_index = 0; - for (std::vector::const_iterator mask_iter = vps.begin(), mask_end_iter = vps.end(); + for (std::vector::const_iterator mask_iter = position_strings.begin(), mask_end_iter = position_strings.end(); mask_iter != mask_end_iter; ++mask_iter) { @@ -254,6 +312,8 @@ public: std::sort(bmasks.begin(), bmasks.end()); } + /// @} + return_type operator() (const Point_3& p) const { Bmask bmask(funcs.size() * 2, false); @@ -279,9 +339,7 @@ public: } }; -} // end namespace CGAL - - +} // end namespace CGAL #if defined(BOOST_MSVC) # pragma warning(pop) diff --git a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h deleted file mode 100644 index d9bd487410a..00000000000 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2009 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Stephane Tayeb -// -//****************************************************************************** -// File Description : -// -// -//****************************************************************************** - -#ifndef CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H -#define CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H - -#include - -#include - -#include -#include -#include -#include -#include -#include - -namespace CGAL { - -/** - * @class Labeled_image_mesh_domain_3 - * - * - */ -template -class -CGAL_DEPRECATED_MSG -( "The class template `CGAL::Labeled_image_mesh_domain_3` is now deprecated. " - "Use the static member function template " - "`Labeled_mesh_domain_3::create_labeled_image_mesh_domain` instead.") -Labeled_image_mesh_domain_3 - : public Labeled_mesh_domain_3 -{ -public: - typedef Image_word_type_ Image_word_type; - typedef typename Default::Get - - >::type Wrapper; - typedef typename Default::Get::type Null; - - typedef Labeled_mesh_domain_3 Base; - - typedef typename Base::Sphere_3 Sphere_3; - typedef typename Base::FT FT; - typedef BGT Geom_traits; - typedef CGAL::Bbox_3 Bbox_3; - typedef CGAL::Identity Identity; - - /// Constructor - Labeled_image_mesh_domain_3(const Image& image, - const FT& error_bound = FT(1e-3), - Subdomain_index value_outside = 0, - Null null = Null(), - CGAL::Random* p_rng = nullptr) - : Base(parameters::function = Wrapper(image, Identity(), value_outside), - parameters::bounding_object = compute_bounding_box(image), - parameters::relative_error_bound = error_bound, - parameters::null_subdomain_index = null, - parameters::p_rng = p_rng) - {} - - Labeled_image_mesh_domain_3(const Image& image, - const FT error_bound, - CGAL::Random* p_rng) - : Base(parameters::function = Wrapper(image), - parameters::bounding_object = compute_bounding_box(image), - parameters::relative_error_bound = error_bound, - parameters::p_rng = p_rng) - {} - - /// Destructor - virtual ~Labeled_image_mesh_domain_3() {} - - using Base::bbox; - -private: - /// Returns a box enclosing image `im` - Bbox_3 compute_bounding_box(const Image& im) const - { - return Bbox_3(-im.vx()+im.tx(), - -im.vy()+im.ty(), - -im.vz()+im.tz(), - double(im.xdim()+1)*im.vx()+im.tx(), - double(im.ydim()+1)*im.vy()+im.ty(), - double(im.zdim()+1)*im.vz()+im.tz()); - } -}; // end class Labeled_image_mesh_domain_3 - - - -} // end namespace CGAL - -#include - -#endif // CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 50d211ccc1d..99f7d003957 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -47,7 +47,7 @@ #ifdef CGAL_MESH_3_VERBOSE # include #endif -#include +#include #include #include @@ -336,12 +336,14 @@ Let `p` be a Point. `CGAL::Implicit_multi_domain_to_labeling_function_wrapper` is a good candidate for this template parameter if there are several components to mesh. -The function type can be any model of the concept `Callable` compatible with the signature `Subdomain_index(const Point_3&)`: it can be a function, a function object, a lambda expression... that takes a `%Point_3` as argument, and returns a type convertible to `Subdomain_index`. +The function type can be any model of the concept `Callable` compatible with the signature +`Subdomain_index(const %Point_3&)`: it can be a function, a function object, a lambda expression... +that takes a `%Point_3` as argument, and returns a type convertible to `Subdomain_index`. \cgalModels `MeshDomain_3` -\sa `Implicit_multi_domain_to_labeling_function_wrapper` -\sa `CGAL::make_mesh_3()`. +\sa `CGAL::Implicit_multi_domain_to_labeling_function_wrapper` +\sa `CGAL::make_mesh_3()` */ template > class Labeled_mesh_domain_3 #ifndef DOXYGEN_RUNNING -: protected details::Labeled_mesh_domain_3_impl + : protected details::Labeled_mesh_domain_3_impl #endif { public: @@ -381,12 +383,12 @@ public: /// The number type (a field type) of the geometric traits class typedef typename Geom_traits::FT FT; ///@} -#else - typedef boost::optional Subdomain; +#else // DOXYGEN_RUNNING + typedef std::optional Subdomain; // Type of indexes for cells of the input complex typedef Surface_patch_index_ Surface_patch_index; - typedef boost::optional Surface_patch; + typedef std::optional Surface_patch; // Type of indexes to characterize the lowest dimensional face of the input // complex on which a vertex lie @@ -428,7 +430,7 @@ public: typedef typename BGT::FT FT; typedef BGT Geom_traits; using Impl_details::construct_pair_functor; -#endif +#endif // DOXYGEN_RUNNING /// \name Creation /// @{ @@ -451,16 +453,19 @@ public: * \cgalParamDefault{FT(1e-3)} * \cgalParamNEnd * \cgalNamedParamsEnd + * * \cgalHeading{Example} * From the example (\ref Mesh_3/mesh_implicit_domains_2.cpp): * \snippet Mesh_3/mesh_implicit_domains_2.cpp Domain creation - * */ template Labeled_mesh_domain_3(const Function& function, const Bounding_object& bounding_object, - const CGAL_NP_CLASS& np = parameters::default_values(), - typename std::enable_if>::type* = nullptr) + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , typename std::enable_if>::type* = nullptr +#endif // DOXYGEN_RUNNING + ) :Impl_details(function, bounding_object, parameters::choose_parameter(parameters::get_parameter(np, internal_np::error_bound), FT(1e-3)), @@ -496,7 +501,7 @@ public: template #if !defined(BOOST_MSVC) CGAL_DEPRECATED -#endif +#endif // BOOST_MSVC Labeled_mesh_domain_3(const Function& function, const Bounding_object& bounding_object, double error_bound, @@ -505,8 +510,8 @@ public: bounding_object, parameters::relative_error_bound(error_bound)) {} -#endif -#endif +#endif // CGAL_NO_DEPRECATED_CODE +#endif // DOXYGEN_RUNNING /// \name Creation of domains from 3D images /// @{ @@ -1115,7 +1120,7 @@ public: { const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) - if(const Segment_3* s = boost::get(&*clipped)) + if(const Segment_3* s = std::get_if(&*clipped)) return this->operator()(*s); return Surface_patch(); @@ -1148,7 +1153,7 @@ public: Intersection operator()(const Segment_3& s) const { #ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 - CGAL_precondition(r_domain_.do_intersect_surface_object()(s) != boost::none); + CGAL_precondition(r_domain_.do_intersect_surface_object()(s) != std::nullopt); #endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 return this->operator()(s.source(),s.target()); } @@ -1243,7 +1248,7 @@ public: { const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) - if(const Segment_3* s = boost::get(&*clipped)) + if(const Segment_3* s = std::get_if(&*clipped)) return this->operator()(*s); return Intersection(); @@ -1278,14 +1283,14 @@ public: * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } /* * Returns the index of the subdomain containing a vertex * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } // ----------------------------------- // Backward Compatibility diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index fa30efc12ca..6d67d3d627c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -36,10 +36,10 @@ #include #endif -#include #include #include #include +#include #ifdef CGAL_LINKED_WITH_TBB # include @@ -375,10 +375,10 @@ template class C3T3_helpers_base { protected: - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Facet Facet; @@ -447,7 +447,7 @@ template class C3T3_helpers_base { protected: - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Vertex_handle Vertex_handle; @@ -622,14 +622,14 @@ class C3T3_helpers typedef typename Base::Lock_data_structure Lock_data_structure; typedef typename C3T3::Triangulation Tr; typedef Tr Triangulation; - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::Vector_3 Vector_3; - typedef typename Gt::Plane_3 Plane_3; - typedef typename Gt::Tetrahedron_3 Tetrahedron; + typedef typename GT::Vector_3 Vector_3; + typedef typename GT::Plane_3 Plane_3; + typedef typename GT::Tetrahedron_3 Tetrahedron; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Facet Facet; @@ -640,8 +640,8 @@ class C3T3_helpers typedef typename C3T3::Subdomain_index Subdomain_index; typedef typename C3T3::Index Index; - typedef boost::optional Surface_patch; - typedef boost::optional Subdomain; + typedef std::optional Surface_patch; + typedef std::optional Subdomain; typedef std::vector Cell_vector; typedef std::set Cell_set; @@ -680,7 +680,7 @@ public: // ----------------------------------- // Public interface // ----------------------------------- - typedef boost::optional Update_mesh; + typedef std::optional Update_mesh; using Base::try_lock_point; using Base::try_lock_vertex; @@ -1115,17 +1115,17 @@ private: const bool update_c3t3, const bool update_surface_center) const { - typedef typename C3T3::Triangulation::Geom_traits Gt; - typedef typename Gt::Segment_3 Segment_3; - typedef typename Gt::Ray_3 Ray_3; - typedef typename Gt::Line_3 Line_3; + typedef typename C3T3::Triangulation::Geom_traits GT; + typedef typename GT::Segment_3 Segment_3; + typedef typename GT::Ray_3 Ray_3; + typedef typename GT::Line_3 Line_3; // Nothing to do for infinite facets if ( c3t3_.triangulation().is_infinite(facet) ) return Surface_patch(); // Functors - typename Gt::Is_degenerate_3 is_degenerate = + typename GT::Is_degenerate_3 is_degenerate = c3t3_.triangulation().geom_traits().is_degenerate_3_object(); // Get dual of facet @@ -1674,7 +1674,7 @@ private: /** * Returns the least square plane from v, using adjacent surface points */ - std::pair, Bare_point> + std::pair, Bare_point> get_least_square_surface_plane(const Vertex_handle& v, Surface_patch_index index = Surface_patch_index()) const; @@ -1683,15 +1683,15 @@ private: * @param v The vertex from which p was moved * @param p The point to project * @param index The index of the surface patch where v lies, if known. - * @return a `boost::optional` with the projected point if the projection - * was possible, or `boost::none`. + * @return a `std::optional` with the projected point if the projection + * was possible, or `std::nullopt`. * * `p` is projected using the normal of least square fitting plane * on `v` incident surface points. If `index` is specified, only * surface points that are on the same surface patch are used to compute * the fitting plane. */ - boost::optional + std::optional project_on_surface_if_possible(const Vertex_handle& v, const Bare_point& p, Surface_patch_index index = Surface_patch_index()) const; @@ -2466,7 +2466,7 @@ update_mesh_no_topo_change(const Vertex_handle& old_vertex, << " " << new_position << ")" << std::endl; #endif - typename Gt::Construct_opposite_vector_3 cov = tr_.geom_traits().construct_opposite_vector_3_object(); + typename GT::Construct_opposite_vector_3 cov = tr_.geom_traits().construct_opposite_vector_3_object(); //backup metadata std::set cells_backup; @@ -2674,7 +2674,7 @@ C3T3_helpers:: rebuild_restricted_delaunay(OutdatedCells& outdated_cells, Moving_vertices_set& moving_vertices) { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); typename OutdatedCells::iterator first_cell = outdated_cells.begin(); typename OutdatedCells::iterator last_cell = outdated_cells.end(); @@ -2774,7 +2774,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells, ++it ) { const Weighted_point& initial_position = tr_.point(*it); - boost::optional opt_new_pos = project_on_surface(*it, cp(initial_position)); + std::optional opt_new_pos = project_on_surface(*it, cp(initial_position)); if ( opt_new_pos ) { @@ -2804,9 +2804,9 @@ rebuild_restricted_delaunay(ForwardIterator first_cell, ForwardIterator last_cell, Moving_vertices_set& moving_vertices) { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object(); - typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object(); + typename GT::Equal_3 equal = tr_.geom_traits().equal_3_object(); Update_c3t3 updater(domain_,c3t3_); @@ -2886,7 +2886,7 @@ rebuild_restricted_delaunay(ForwardIterator first_cell, { Vertex_handle vh = it->first; const Weighted_point& initial_position = tr_.point(vh); - boost::optional opt_new_pos = project_on_surface(vh, cp(initial_position), it->second); + std::optional opt_new_pos = project_on_surface(vh, cp(initial_position), it->second); if ( opt_new_pos ) { @@ -2942,9 +2942,9 @@ move_point(const Vertex_handle& old_vertex, << " " << move << ")\n"; #endif - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); Cell_vector incident_cells_; incident_cells_.reserve(64); @@ -2993,9 +2993,9 @@ move_point(const Vertex_handle& old_vertex, << " " << move << ")\n"; #endif - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); Cell_vector incident_cells_; incident_cells_.reserve(64); @@ -3057,9 +3057,9 @@ move_point(const Vertex_handle& old_vertex, } //======= /Get incident cells ========== - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); const Weighted_point& position = tr_.point(old_vertex); const Weighted_point& new_position = cwp(translate(cp(position), move)); @@ -3366,14 +3366,14 @@ project_on_surface_aux(const Bare_point& p, const Bare_point& ref_point, const Vector_3& projection_vector) const { - typedef typename Gt::Segment_3 Segment_3; + typedef typename GT::Segment_3 Segment_3; // Build a segment directed as projection_direction, - typename Gt::Compute_squared_distance_3 sq_distance = tr_.geom_traits().compute_squared_distance_3_object(); - typename Gt::Compute_squared_length_3 sq_length = tr_.geom_traits().compute_squared_length_3_object(); - typename Gt::Construct_scaled_vector_3 scale = tr_.geom_traits().construct_scaled_vector_3_object(); - typename Gt::Is_degenerate_3 is_degenerate = tr_.geom_traits().is_degenerate_3_object(); - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Compute_squared_distance_3 sq_distance = tr_.geom_traits().compute_squared_distance_3_object(); + typename GT::Compute_squared_length_3 sq_length = tr_.geom_traits().compute_squared_length_3_object(); + typename GT::Construct_scaled_vector_3 scale = tr_.geom_traits().construct_scaled_vector_3_object(); + typename GT::Is_degenerate_3 is_degenerate = tr_.geom_traits().is_degenerate_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); typename MD::Construct_intersection construct_intersection = domain_.construct_intersection_object(); @@ -3419,7 +3419,7 @@ project_on_surface_aux(const Bare_point& p, template -std::pair::Plane_3>, +std::pair::Plane_3>, typename C3T3_helpers::Bare_point> C3T3_helpers:: get_least_square_surface_plane(const Vertex_handle& v, @@ -3427,7 +3427,7 @@ get_least_square_surface_plane(const Vertex_handle& v, { typedef typename C3T3::Triangulation::Triangle Triangle; - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); // Get incident facets Facet_vector facets; @@ -3466,7 +3466,7 @@ get_least_square_surface_plane(const Vertex_handle& v, // In some cases point is not a real surface point if ( triangles.empty() ) - return std::make_pair(boost::none, Bare_point(ORIGIN)); + return std::make_pair(std::nullopt, Bare_point(ORIGIN)); // Compute least square fitting plane Plane_3 plane; @@ -3492,7 +3492,7 @@ project_on_surface(const Vertex_handle& v, const Bare_point& p, Surface_patch_index index) const { - boost::optional opt_point = + std::optional opt_point = project_on_surface_if_possible(v, p, index); if(opt_point) return *opt_point; else return p; @@ -3500,7 +3500,7 @@ project_on_surface(const Vertex_handle& v, template -boost::optional::Bare_point> +std::optional::Bare_point> C3T3_helpers:: project_on_surface_if_possible(const Vertex_handle& v, const Bare_point& p, @@ -3509,15 +3509,15 @@ project_on_surface_if_possible(const Vertex_handle& v, // @todo should call below if it's available... // return domain_.project_on_surface(p); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Equal_3 equal = tr_.geom_traits().equal_3_object(); // Get plane - std::pair, Bare_point> pl_rp + std::pair, Bare_point> pl_rp = get_least_square_surface_plane(v, index); - boost::optional opt_plane = pl_rp.first; - if(!opt_plane) return boost::none; + std::optional opt_plane = pl_rp.first; + if(!opt_plane) return std::nullopt; // Project const Weighted_point& position = tr_.point(v); diff --git a/Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h b/Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h index 4e9393a01e5..3e6824d27ea 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h +++ b/Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h @@ -45,8 +45,8 @@ public: typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; int nb_weighted_points; std::vector points; @@ -59,9 +59,9 @@ public: Cell_criteria_visitor_with_balls(const Tr& tr, const Cell_handle& ch) : Base(tr, ch) { - typename Gt::Compare_weighted_squared_radius_3 compare_sq_radius = + typename GT::Compare_weighted_squared_radius_3 compare_sq_radius = tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename Gt::Squared_radius_orthogonal_sphere sq_radius_ortho_sphere = + typename GT::Squared_radius_orthogonal_sphere sq_radius_ortho_sphere = tr.geom_traits().compute_squared_radius_smallest_orthogonal_sphere_3_object(); const Weighted_point& p = tr.point(ch, 0); diff --git a/Mesh_3/include/CGAL/Mesh_3/Detect_features_in_image.h b/Mesh_3/include/CGAL/Mesh_3/Detect_features_in_image.h index 8efaf67f799..5df9393ce5d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Detect_features_in_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/Detect_features_in_image.h @@ -57,9 +57,9 @@ std::vector> detect_features_in_image_with_know_word_type(const CGAL::Image_3& image, CGAL::Image_3& weights) { - using Gt = typename CGAL::Kernel_traits

::Kernel; + using GT = typename CGAL::Kernel_traits

::Kernel; using Point_3 = P; - using Vector_3 = typename Gt::Vector_3; + using Vector_3 = typename GT::Vector_3; using Polyline_type = std::vector; using Polylines = std::vector; @@ -86,7 +86,7 @@ detect_features_in_image_with_know_word_type(const CGAL::Image_3& image, using CGAL::IMAGEIO::static_evaluate; - using Del = CGAL::Delaunay_triangulation_3; + using Del = CGAL::Delaunay_triangulation_3; using Cell_handle = typename Del::Cell_handle; using Vertex_handle = typename Del::Vertex_handle; Del triangulation; diff --git a/Mesh_3/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h b/Mesh_3/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h index ec638dd29ef..0db721cd9d9 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h +++ b/Mesh_3/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h @@ -50,8 +50,8 @@ public: typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; int wp_nb_; double radius_ortho_shpere; @@ -68,13 +68,13 @@ public: , radius_ortho_shpere(0.) , ratio(0.) { - typename Gt::Compare_weighted_squared_radius_3 compare_sq_radius = + typename GT::Compare_weighted_squared_radius_3 compare_sq_radius = tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = tr.geom_traits().compute_weight_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Squared_radius_orthogonal_sphere sq_radius_ortho_sphere = + typename GT::Squared_radius_orthogonal_sphere sq_radius_ortho_sphere = tr.geom_traits().compute_squared_radius_smallest_orthogonal_sphere_3_object(); Weighted_point wp1 = tr.point(fh.first, (fh.second+1)&3); diff --git a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h index f709f4b4f1a..74dbb09b2ca 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h @@ -44,7 +44,7 @@ template Facet_vector; typedef typename std::vector Cell_vector; - typedef typename Gt::FT FT; - typedef typename Gt::Point_2 Point_2; - typedef typename Gt::Vector_3 Vector_3; - typedef typename Gt::Tetrahedron_3 Tetrahedron_3; - typedef typename Gt::Plane_3 Plane_3; - typedef typename Gt::Aff_transformation_3 Aff_transformation_3; + typedef typename GT::FT FT; + typedef typename GT::Point_2 Point_2; + typedef typename GT::Vector_3 Vector_3; + typedef typename GT::Tetrahedron_3 Tetrahedron_3; + typedef typename GT::Plane_3 Plane_3; + typedef typename GT::Aff_transformation_3 Aff_transformation_3; public: typedef SizingField Sizing_field; @@ -261,7 +261,7 @@ private: { const Tr& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); Facet_vector incident_facets; incident_facets.reserve(64); @@ -306,8 +306,8 @@ private: const C3T3& c3t3, const Sizing_field& sizing_field) const { - typename Gt::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); + typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); + typename GT::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); const Weighted_point position = c3t3.triangulation().point(v); const Bare_point& p = cp(position); @@ -329,8 +329,8 @@ private: const C3T3& c3t3, const Sizing_field& sizing_field) const { - typename Gt::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); + typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); + typename GT::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); const Weighted_point& position = c3t3.triangulation().point(v); const Bare_point& p = cp(position); @@ -409,10 +409,10 @@ private: { CGAL_precondition(std::distance(first,last) >= 3); - typename Gt::Compute_area_3 area = c3t3.triangulation().geom_traits().compute_area_3_object(); - typename Gt::Construct_centroid_3 centroid = c3t3.triangulation().geom_traits().construct_centroid_3_object(); - typename Gt::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); + typename GT::Compute_area_3 area = c3t3.triangulation().geom_traits().compute_area_3_object(); + typename GT::Construct_centroid_3 centroid = c3t3.triangulation().geom_traits().construct_centroid_3_object(); + typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); + typename GT::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); // Vertex current position const Weighted_point& vertex_weighted_position = c3t3.triangulation().point(v); @@ -460,8 +460,8 @@ private: const Bare_point& reference_point, const C3T3& c3t3) const { - typename Gt::Construct_base_vector_3 base = c3t3.triangulation().geom_traits().construct_base_vector_3_object(); - typename Gt::Construct_orthogonal_vector_3 orthogonal_vector = c3t3.triangulation().geom_traits().construct_orthogonal_vector_3_object(); + typename GT::Construct_base_vector_3 base = c3t3.triangulation().geom_traits().construct_base_vector_3_object(); + typename GT::Construct_orthogonal_vector_3 orthogonal_vector = c3t3.triangulation().geom_traits().construct_orthogonal_vector_3_object(); Vector_3 u = base(plane, 1); u = u / CGAL::sqrt(u*u); @@ -542,12 +542,12 @@ private: const Tr& tr = c3t3.triangulation(); - typename Gt::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Construct_tetrahedron_3 tetrahedron = tr.geom_traits().construct_tetrahedron_3_object(); - typename Gt::Construct_translated_point_3 translate = tr.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); - typename Gt::Compute_volume_3 volume = tr.geom_traits().compute_volume_3_object(); + typename GT::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_tetrahedron_3 tetrahedron = tr.geom_traits().construct_tetrahedron_3_object(); + typename GT::Construct_translated_point_3 translate = tr.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); + typename GT::Compute_volume_3 volume = tr.geom_traits().compute_volume_3_object(); Cell_circulator current_cell = tr.incident_cells(edge); Cell_circulator done = current_cell; diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index 019cb18589c..0a3d73f0341 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -66,9 +66,9 @@ template class Mesh_global_optimizer_base { protected: - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Lock_data_structure Lock_data_structure; // The sizing field info is stored inside the move vector because it is computed @@ -125,9 +125,9 @@ class Mesh_global_optimizer_base { protected: - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Lock_data_structure Lock_data_structure; typedef tbb::concurrent_vector > Moves_vector; @@ -238,7 +238,7 @@ class Mesh_global_optimizer using Base::increment_frozen_points; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -247,8 +247,8 @@ class Mesh_global_optimizer typedef typename Tr::Edge Edge; typedef typename Tr::Vertex Vertex; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename std::vector Cell_vector; typedef typename std::vector Vertex_vector; @@ -378,7 +378,7 @@ private: Moves_vector_ & m_moves; bool m_do_freeze; Vertex_conc_vector & m_vertices_not_moving_any_more; - const Gt & m_gt; + const GT & m_gt; public: // Constructor @@ -387,7 +387,7 @@ private: Moves_vector_ &moves, bool do_freeze, Vertex_conc_vector &vertices_not_moving_any_more, - const Gt >) + const GT >) : m_mgo(mgo), m_sizing_field(sizing_field), m_moves(moves), @@ -409,8 +409,8 @@ private: // operator() void operator()(const Vertex_handle& oldv) const { - typename Gt::Construct_point_3 cp = m_gt.construct_point_3_object(); - typename Gt::Construct_translated_point_3 translate = m_gt.construct_translated_point_3_object(); + typename GT::Construct_point_3 cp = m_gt.construct_point_3_object(); + typename GT::Construct_translated_point_3 translate = m_gt.construct_translated_point_3_object(); Vector_3 move = m_mgo.compute_move(oldv); if ( CGAL::NULL_VECTOR != move ) @@ -449,13 +449,13 @@ private: class Compute_sizing_field_value { MGO & m_mgo; - const Gt & m_gt; + const GT & m_gt; Local_list_ & m_local_lists; public: // Constructor Compute_sizing_field_value(MGO &mgo, - const Gt >, + const GT >, Local_list_ &local_lists) : m_mgo(mgo), m_gt(gt), @@ -472,7 +472,7 @@ private: // operator() void operator()(Vertex& v) const { - typename Gt::Construct_point_3 cp = m_gt.construct_point_3_object(); + typename GT::Construct_point_3 cp = m_gt.construct_point_3_object(); Vertex_handle vh = Tr::Triangulation_data_structure::Vertex_range::s_iterator_to(v); @@ -825,8 +825,8 @@ compute_moves(Moving_vertices_set& moving_vertices) else #endif // CGAL_LINKED_WITH_TBB { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); // Get move for each moving vertex typename Moving_vertices_set::iterator vit = moving_vertices.begin(); @@ -877,10 +877,10 @@ typename Mesh_global_optimizer::Vector_3 Mesh_global_optimizer:: compute_move(const Vertex_handle& v) { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Compute_squared_length_3 sq_length = tr_.geom_traits().compute_squared_length_3_object(); - typename Gt::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Compute_squared_length_3 sq_length = tr_.geom_traits().compute_squared_length_3_object(); + typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object(); + typename GT::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object(); Cell_vector incident_cells; incident_cells.reserve(64); @@ -1059,7 +1059,7 @@ fill_sizing_field() else #endif //CGAL_LINKED_WITH_TBB { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); // Fill map with local size for(typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin(); @@ -1193,8 +1193,8 @@ typename Mesh_global_optimizer::FT Mesh_global_optimizer:: sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Compute_squared_distance_3 sq_distance = tr_.geom_traits().compute_squared_distance_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Compute_squared_distance_3 sq_distance = tr_.geom_traits().compute_squared_distance_3_object(); const Bare_point circumcenter = tr_.dual(cell); const Weighted_point& position = tr_.point(cell, cell->index(v)); diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h index e1d52d202f2..03e3262ef6b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h @@ -88,10 +88,10 @@ class Mesh_sizing_field typename Tr::Concurrency_tag> { // Types - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; @@ -169,7 +169,7 @@ fill(const std::map& value_map) { typedef typename Tr::Finite_vertices_iterator Fvi; - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); for ( Fvi vit = tr_.finite_vertices_begin(); vit != tr_.finite_vertices_end(); ++ vit ) { @@ -196,7 +196,7 @@ typename Mesh_sizing_field::FT Mesh_sizing_field:: operator()(const Bare_point& p, const Cell_handle& c) const { - typename Gt::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object(); #ifdef CGAL_MESH_3_SIZING_FIELD_INEXACT_LOCATE //use the inexact locate (much faster than locate) to get a hint @@ -239,8 +239,8 @@ typename Mesh_sizing_field::FT Mesh_sizing_field:: interpolate_on_cell_vertices(const Bare_point& p, const Cell_handle& cell) const { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); - typename Gt::Compute_volume_3 volume = tr_.geom_traits().compute_volume_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Compute_volume_3 volume = tr_.geom_traits().compute_volume_3_object(); // Interpolate value using tet vertices values const FT& va = cell->vertex(0)->meshing_info(); @@ -275,9 +275,9 @@ typename Mesh_sizing_field::FT Mesh_sizing_field:: interpolate_on_facet_vertices(const Bare_point& p, const Cell_handle& cell) const { - typename Gt::Compute_area_3 area = tr_.geom_traits().compute_area_3_object(); + typename GT::Compute_area_3 area = tr_.geom_traits().compute_area_3_object(); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); // Find infinite vertex and put it in k0 int k0 = 0; int k1 = 1; diff --git a/Mesh_3/include/CGAL/Mesh_3/Odt_move.h b/Mesh_3/include/CGAL/Mesh_3/Odt_move.h index a2cbcc78cc5..4ec48adaf2e 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Odt_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Odt_move.h @@ -34,7 +34,7 @@ template Facet_vector; typedef typename std::vector Cell_vector; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; public: typedef SizingField Sizing_field; @@ -66,8 +66,8 @@ public: // Compute move const Tr& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); Vector_3 move = CGAL::NULL_VECTOR; FT sum_volume(0); @@ -117,8 +117,8 @@ private: const Tr& tr, const Sizing_field& sizing_field) const { - typename Gt::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); - typename Gt::Compute_volume_3 volume = tr.geom_traits().compute_volume_3_object(); + typename GT::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); + typename GT::Compute_volume_3 volume = tr.geom_traits().compute_volume_3_object(); Bare_point c = centroid(tr.tetrahedron(cell)); FT s = sizing_field(c, std::make_pair(cell, true)); @@ -195,8 +195,8 @@ private: // const Tr& tr, // const Sizing_field& sizing_field) const // { -// typename Gt::Compute_area_3 area = tr.geom_traits().compute_area_3_object(); -// typename Gt::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); +// typename GT::Compute_area_3 area = tr.geom_traits().compute_area_3_object(); +// typename GT::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); // // Bare_point c = centroid(tr.triangle(facet)); // FT s = sizing_field(c, facet.first->vertex(0)); @@ -211,9 +211,9 @@ private: // const Tr& tr, // const Sizing_field& sizing_field) const // { -// typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); -// typename Gt::Construct_midpoint_3 midpoint = tr.geom_traits().construct_midpoint_3_object(); -// typename Gt::Compute_squared_distance_3 sq_distance = tr.geom_traits().compute_squared_distance_3_object(); +// typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); +// typename GT::Construct_midpoint_3 midpoint = tr.geom_traits().construct_midpoint_3_object(); +// typename GT::Compute_squared_distance_3 sq_distance = tr.geom_traits().compute_squared_distance_3_object(); // // const Weighted_point& wp1 = tr.point(cell, vertex_index_1); // const Weighted_point& wp2 = tr.point(cell, vertex_index_2); @@ -251,8 +251,8 @@ private: // // Vector_3 normal_outside(const Facet& f, const C3T3& c3t3) const // { -// typename Gt::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); -// typename Gt::Construct_normal_3 normal = c3t3.triangulation().geom_traits().construct_normal_3_object(); +// typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); +// typename GT::Construct_normal_3 normal = c3t3.triangulation().geom_traits().construct_normal_3_object(); // // const Cell_handle& cell = f.first; // const int& i = f.second; diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 0b67ab00411..9062dc1894f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -53,7 +53,7 @@ #ifndef CGAL_NO_ASSERTIONS # include // for float_prior #endif -#include +#include #include #include #include @@ -118,8 +118,8 @@ public: typedef typename Tr::Weighted_point Weighted_point; typedef typename Weighted_point::Weight Weight; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename C3T3::Cell_handle Cell_handle; typedef typename C3T3::Vertex_handle Vertex_handle; @@ -394,7 +394,7 @@ private: /// Returns the radius of the ball of vertex `v`. FT get_radius(const Vertex_handle& v) const { - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = c3t3_.triangulation().geom_traits().compute_weight_3_object(); const Weighted_point& v_wp = c3t3_.triangulation().point(v); @@ -656,7 +656,7 @@ insert_point(const Bare_point& p, const Weight& w, int dim, const Index& index, // Insert point CGAL_assertion_code(size_type nb_vertices_before = c3t3_.triangulation().number_of_vertices()); - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = c3t3_.triangulation().geom_traits().construct_weighted_point_3_object(); const Weighted_point wp = cwp(p,w*weight_modifier); @@ -726,13 +726,13 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, #endif const Tr& tr = c3t3_.triangulation(); - typename Gt::Compute_squared_distance_3 sq_distance = + typename GT::Compute_squared_distance_3 sq_distance = tr.geom_traits().compute_squared_distance_3_object(); - typename Gt::Compare_weighted_squared_radius_3 cwsr = + typename GT::Compare_weighted_squared_radius_3 cwsr = tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = tr.geom_traits().construct_weighted_point_3_object(); bool add_handle_to_unchecked = false; // add or not the new vertex to the set 'unchecked_vertices' @@ -990,7 +990,7 @@ insert_balls_on_edges() } else { - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = c3t3_.triangulation().geom_traits().construct_weighted_point_3_object(); // Even if the curve is a cycle, it can intersect other curves at @@ -1044,7 +1044,7 @@ typename Protect_edges_sizing_field::Vertex_handle Protect_edges_sizing_field:: get_vertex_corner_from_point(const Bare_point& p, const Index&) const { - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = c3t3_.triangulation().geom_traits().construct_weighted_point_3_object(); // Get vertex_handle associated to corner (dim=0) point @@ -1488,13 +1488,13 @@ bool Protect_edges_sizing_field:: do_balls_intersect(const Vertex_handle& va, const Vertex_handle& vb) const { - typename Gt::Construct_sphere_3 sphere = + typename GT::Construct_sphere_3 sphere = c3t3_.triangulation().geom_traits().construct_sphere_3_object(); - typename Gt::Do_intersect_3 do_intersect = + typename GT::Do_intersect_3 do_intersect = c3t3_.triangulation().geom_traits().do_intersect_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = c3t3_.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = c3t3_.triangulation().geom_traits().compute_weight_3_object(); const Weighted_point& wa = c3t3_.triangulation().point(va); @@ -1534,7 +1534,7 @@ change_ball_size(const Vertex_handle& v, const FT squared_size, const bool speci } // Store point data - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = c3t3_.triangulation().geom_traits().construct_point_3_object(); Index index = c3t3_.index(v); @@ -1542,7 +1542,7 @@ change_ball_size(const Vertex_handle& v, const FT squared_size, const bool speci Bare_point p = cp(c3t3_.triangulation().point(v)); // intentional copy // Remove v from the set of corners - boost::optional corner_index = boost::make_optional(false, Corner_index()); + std::optional corner_index; if ( c3t3_.is_in_complex(v) ) { corner_index = c3t3_.corner_index(v); @@ -1553,7 +1553,7 @@ change_ball_size(const Vertex_handle& v, const FT squared_size, const bool speci // Change v size c3t3_.triangulation().remove(v); - CGAL_assertion_code(typename Gt::Construct_weighted_point_3 cwp = + CGAL_assertion_code(typename GT::Construct_weighted_point_3 cwp = c3t3_.triangulation().geom_traits().construct_weighted_point_3_object();) CGAL_assertion_code(const Weighted_point wp = cwp(p,w);) CGAL_assertion_code(Tr& tr = c3t3_.triangulation()); @@ -1742,9 +1742,9 @@ is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, using CGAL::Mesh_3::internal::min_intersection_factor; CGAL_precondition(c3t3_.curve_index(v1,v2) == curve_index); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = c3t3_.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = c3t3_.triangulation().geom_traits().compute_weight_3_object(); // Get sizes diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h index c5f9155d366..44e4f82b82d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h @@ -672,7 +672,7 @@ scan_triangulation_impl() typedef typename Tr::All_cells_iterator All_cells_iterator; // WITH PARALLEL_FOR - // Copy cells into an std::vector to allow the use of tbb::parallel_for + // Copy cells into an std::vector to enable the use of tbb::parallel_for // which requires random-access. // Note that we're using all_cells_begin() instead of finite_cells_begin() // because it's faster to do the is_infinite() test in parallel. @@ -750,7 +750,7 @@ Refine_cells_3:: number_of_bad_elements_impl() { typedef typename MD::Subdomain_index Subdomain_index; - typedef boost::optional Subdomain; + typedef std::optional Subdomain; typedef typename Tr::Finite_cells_iterator Finite_cell_iterator; int count = 0; @@ -927,7 +927,7 @@ void Refine_cells_3:: treat_new_cell(const Cell_handle& cell) { - typedef boost::optional Subdomain; + typedef std::optional Subdomain; // treat cell const Subdomain subdomain = r_oracle_.is_in_domain_object()(r_tr_.dual(cell)); diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index 8322c3d8630..b4e2af50375 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include @@ -243,10 +243,10 @@ class Refine_facets_3_base typedef typename Tr::Cell_handle Cell_handle; typedef typename Triangulation_mesher_level_traits_3::Zone Zone; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::Segment_3 Segment_3; - typedef typename Gt::Ray_3 Ray_3; - typedef typename Gt::Line_3 Line_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::Segment_3 Segment_3; + typedef typename GT::Ray_3 Ray_3; + typedef typename GT::Line_3 Line_3; public: Refine_facets_3_base(Tr& tr, Complex3InTriangulation3& c3t3, @@ -397,7 +397,7 @@ protected: typedef typename MeshDomain::Surface_patch_index Surface_patch_index; typedef typename MeshDomain::Index Index; - typedef typename boost::optional< + typedef typename std::optional< std::tuple > Facet_properties; @@ -892,8 +892,8 @@ private: typedef typename Tr::Cell_handle Cell_handle; typedef typename MeshDomain::Surface_patch_index Surface_patch_index; typedef typename MeshDomain::Index Index; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::Ray_3 Ray_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::Ray_3 Ray_3; private: // Disabled copy constructor @@ -1052,7 +1052,7 @@ Refine_facets_3:: number_of_bad_elements_impl() { typedef typename MD::Subdomain_index Subdomain_index; - typedef boost::optional Subdomain; + typedef std::optional Subdomain; typedef typename Tr::Finite_facets_iterator Finite_facet_iterator; int count = 0, count_num_bad_surface_facets = 0; @@ -1148,9 +1148,9 @@ number_of_bad_elements_impl() const Subdomain mc_subdomain = this->r_oracle_.is_in_domain_object()(this->r_tr_.dual(mc)); std::cerr << "*** Is in complex? c is marked in domain: " << this->r_c3t3_.is_in_complex(c) - << " / c is really in subdomain: " << c_subdomain + << " / c is really in subdomain: " << oformat(c_subdomain) << " / mc is marked in domain: " << this->r_c3t3_.is_in_complex(mc) - << " / mc is really in subdomain: " << mc_subdomain + << " / mc is really in subdomain: " << oformat(mc_subdomain) << std::endl; @@ -1625,15 +1625,15 @@ compute_facet_properties(const Facet& facet, CGAL_assertion( r_tr_.dimension() == 3 ); // types - typedef boost::optional Surface_patch; + typedef std::optional Surface_patch; typedef typename MD::Intersection Intersection; // Functor - typename Gt::Is_degenerate_3 is_degenerate = + typename GT::Is_degenerate_3 is_degenerate = r_tr_.geom_traits().is_degenerate_3_object(); - typename Gt::Compare_xyz_3 compare_xyz = + typename GT::Compare_xyz_3 compare_xyz = r_tr_.geom_traits().compare_xyz_3_object(); - typename Gt::Construct_segment_3 construct_segment = + typename GT::Construct_segment_3 construct_segment = r_tr_.geom_traits().construct_segment_3_object(); #ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 typename MD::Do_intersect_surface do_intersect_surface = @@ -1734,7 +1734,7 @@ is_facet_encroached(const Facet& facet, const Weighted_point& point) const { typedef typename MD::Subdomain_index Subdomain_index; - typedef boost::optional Subdomain; + typedef std::optional Subdomain; if ( r_tr_.is_infinite(facet) || ! this->is_facet_on_surface(facet) ) return false; @@ -1787,13 +1787,13 @@ Refine_facets_3_base:: is_encroached_facet_refinable(Facet& facet) const { typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; - typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = + typename GT::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = r_tr_.geom_traits().compute_squared_radius_smallest_orthogonal_sphere_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = r_tr_.geom_traits().compute_weight_3_object(); - typename Gt::Compare_weighted_squared_radius_3 compare = + typename GT::Compare_weighted_squared_radius_3 compare = r_tr_.geom_traits().compare_weighted_squared_radius_3_object(); const Cell_handle& c = facet.first; diff --git a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h index 9fe82752715..ac261599db8 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h @@ -31,12 +31,12 @@ namespace CGAL { namespace Mesh_3 { -template +template class Sizing_grid_node { public: - typedef typename Gt::Point_3 Point; - typedef typename Gt::FT FT; + typedef typename GT::Point_3 Point; + typedef typename GT::FT FT; FT m_init_size; FT m_size; @@ -108,14 +108,14 @@ template class Sizing_grid { public: - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Bare_point Bare_point; - typedef typename Gt::Vector_3 Vector; - typedef Sizing_grid_node Node; + typedef typename GT::Vector_3 Vector; + typedef Sizing_grid_node Node; typedef typename std::pair Constraint; private: diff --git a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h index 9554a14cc0e..876d2079ce8 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h @@ -316,8 +316,8 @@ class Sliver_perturber_base { protected: typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename std::vector Bad_vertices_vector; typedef typename Tr::Lock_data_structure Lock_data_structure; @@ -344,8 +344,8 @@ class Sliver_perturber_base { protected: typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename tbb::concurrent_vector Bad_vertices_vector; typedef typename Tr::Lock_data_structure Lock_data_structure; @@ -436,7 +436,7 @@ class Sliver_perturber typename C3T3::Triangulation, Concurrency_tag> Base; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Cell_handle Cell_handle; typedef typename Base::Vertex_handle Vertex_handle; @@ -449,7 +449,7 @@ class Sliver_perturber typedef typename std::vector Vertex_vector; typedef typename Base::Bad_vertices_vector Bad_vertices_vector; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; // Helper typedef class C3T3_helpers C3T3_helpers; @@ -1260,7 +1260,7 @@ perturb_vertex( PVertex pv , bool *could_lock_zone ) const { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); #ifdef CGAL_CONCURRENT_MESH_3_PROFILING static Profile_branch_counter_3 bcounter( diff --git a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h index 2084e58ce33..bcf2ff2fea2 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h +++ b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h @@ -38,8 +38,8 @@ #include #include -#include +#include #include #include // std::setprecision #include // std::cerr/cout @@ -106,8 +106,8 @@ protected: typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; typedef std::vector Cell_vector; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename std::vector Bad_vertices_vector; typedef typename Tr::Lock_data_structure Lock_data_structure; @@ -196,8 +196,8 @@ protected: typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; typedef std::vector Cell_vector; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename tbb::concurrent_vector Bad_vertices_vector; typedef typename Tr::Lock_data_structure Lock_data_structure; @@ -352,9 +352,9 @@ private: // Types typedef typename Base::Queue_value_type Queue_value_type; typedef typename Base::Cell_vector Cell_vector; - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Base::FT FT; - typedef typename Gt::Tetrahedron_3 Tetrahedron_3; + typedef typename GT::Tetrahedron_3 Tetrahedron_3; typedef typename C3T3::Cells_in_complex_iterator Cell_iterator; typedef std::vector Facet_vector; @@ -497,7 +497,7 @@ private: /** * Returns the umbrella of internal_facets vector */ - boost::optional + std::optional get_umbrella(const Facet_vector& internal_facets, const Vertex_handle& v) const; @@ -1046,14 +1046,14 @@ pump_vertex(const Vertex_handle& pumped_vertex, if (could_lock_zone && *could_lock_zone == false) return false; - typename Gt::Compare_weighted_squared_radius_3 compare_sq_radius = + typename GT::Compare_weighted_squared_radius_3 compare_sq_radius = tr_.geom_traits().compare_weighted_squared_radius_3_object(); // If best_weight <= pumped_vertex weight, nothing to do const Weighted_point& pumped_vertex_wp = tr_.point(pumped_vertex); if ( compare_sq_radius(pumped_vertex_wp, - best_weight) == CGAL::LARGER ) // best_weight > v's weight { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); const Weighted_point& old_position = tr_.point(pumped_vertex); Weighted_point new_point(cp(old_position), best_weight); @@ -1116,8 +1116,8 @@ expand_prestar(const Cell_handle& cell_to_add, Pre_star& pre_star, Sliver_values& criterion_values) const { - typename Gt::Compute_weight_3 cw = tr_.geom_traits().compute_weight_3_object(); - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Compute_weight_3 cw = tr_.geom_traits().compute_weight_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); // Delete first facet of pre_star Facet start_facet = pre_star.front()->second; @@ -1333,13 +1333,13 @@ get_best_weight(const Vertex_handle& v, bool *could_lock_zone) const } // end while(... can pump...) #ifdef CGAL_MESH_3_DEBUG_SLIVERS_EXUDER - typename Gt::Compare_weighted_squared_radius_3 compare_sq_radius = + typename GT::Compare_weighted_squared_radius_3 compare_sq_radius = tr_.geom_traits().compare_weighted_squared_radius_3_object(); const Weighted_point& vwp = tr_.point(v); if ( compare_sq_radius(vwp, - best_weight) == CGAL::LARGER ) // best_weight > v's weight { - typename Gt::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object(); const Weighted_point& wpv = tr_.point(v); Weighted_point wp(cp(wpv), best_weight); check_pre_star(pre_star_copy, wp, v); @@ -1352,7 +1352,7 @@ get_best_weight(const Vertex_handle& v, bool *could_lock_zone) const template -boost::optional::Umbrella > +std::optional::Umbrella > Slivers_exuder:: get_umbrella(const Facet_vector& facets, // internal_facets of conflict zone const Vertex_handle& /* v, no longer used */) const @@ -1388,7 +1388,7 @@ get_umbrella(const Facet_vector& facets, // internal_facets of conflict zone { std::size_t count = (*uit).second.second; if(count == 2) //there will be more than 3 after insertion - return boost::none; //non-manifold configuration + return std::nullopt; //non-manifold configuration umbrella.insert(uit, std::make_pair(oe, @@ -1564,8 +1564,8 @@ update_mesh(const Weighted_point& new_point, Boundary_facets_from_outside boundary_facets_from_outside = get_boundary_facets_from_outside(boundary_facets); - boost::optional umbrella = get_umbrella(internal_facets, old_vertex); - if(umbrella == boost::none) + std::optional umbrella = get_umbrella(internal_facets, old_vertex); + if(umbrella == std::nullopt) return false; //abort pumping this vertex // Delete old cells from queue (they aren't in the triangulation anymore) diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangle_accessor_primitive.h b/Mesh_3/include/CGAL/Mesh_3/Triangle_accessor_primitive.h index a3436fbdb91..a5a13232909 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangle_accessor_primitive.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangle_accessor_primitive.h @@ -24,13 +24,13 @@ namespace CGAL { namespace Mesh_3 { -template +template class Triangle_accessor_primitive { public: typedef typename TriangleAccessor::Triangle_handle Id; - typedef typename Gt::Triangle_3 Datum; - typedef typename Gt::Point_3 Point; + typedef typename GT::Triangle_3 Datum; + typedef typename GT::Point_3 Point; Triangle_accessor_primitive(const Id& h) : handle_(h) {} @@ -55,15 +55,15 @@ private: Id handle_; }; -//template -//class Triangle_accessor_primitive,Gt>, Gt> +//template +//class Triangle_accessor_primitive,GT>, GT> //{ -// typedef class Triangle_accessor,Gt> Triangle_accessor; +// typedef class Triangle_accessor,GT> Triangle_accessor; // //public: // typedef typename Triangle_accessor::Triangle_iterator Id; -// typedef typename Gt::Triangle_3 Datum; -// typedef typename Gt::Point_3 Point; +// typedef typename GT::Triangle_3 Datum; +// typedef typename GT::Point_3 Point; // // Triangle_accessor_primitive(const Id& h) // : handle_(h) {} diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h index 6459aaeb047..db2dde5b6d3 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h @@ -43,17 +43,17 @@ namespace Mesh_3 { template class Triangulation_helpers { - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; // If `Tr` is not a triangulation that has defined Bare_point, // use Point_3 as defined in the traits class. typedef typename boost::mpl::eval_if_c< CGAL::internal::Has_nested_type_Bare_point::value, typename CGAL::internal::Bare_point_type, - boost::mpl::identity + boost::mpl::identity >::type Bare_point; // 'Point' is either a bare point or a weighted point, depending on the triangulation. @@ -190,7 +190,7 @@ no_topological_change(Tr& tr, if(std::is_same::value) return false; - typename Gt::Construct_opposite_vector_3 cov = + typename GT::Construct_opposite_vector_3 cov = tr.geom_traits().construct_opposite_vector_3_object(); bool np = true; @@ -382,7 +382,7 @@ inside_protecting_balls(const Tr& tr, const Vertex_handle v, const Bare_point& p) const { - typename Gt::Compare_weighted_squared_radius_3 cwsr = + typename GT::Compare_weighted_squared_radius_3 cwsr = tr.geom_traits().compare_weighted_squared_radius_3_object(); Vertex_handle nv = tr.nearest_power_vertex(p, v->cell()); @@ -416,8 +416,8 @@ get_sq_distance_to_closest_vertex(const Tr& tr, // There is no need to use tr.min_squared_distance() here because we are computing // distances between 'v' and a neighboring vertex within a common cell, which means // that even if we are using a periodic triangulation, the distance is correctly computed. - typename Gt::Compute_squared_distance_3 csqd = tr.geom_traits().compute_squared_distance_3_object(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Compute_squared_distance_3 csqd = tr.geom_traits().compute_squared_distance_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); Vertex_container treated_vertices; FT min_sq_dist = std::numeric_limits::infinity(); @@ -477,8 +477,8 @@ get_sq_distance_to_closest_vertex(const Tr& tr, // There is no need to use tr.min_squared_distance() here because we are computing // distances between 'v' and a neighboring vertex within a common cell, which means // that even if we are using a periodic triangulation, the distance is correctly computed. - typename Gt::Compute_squared_distance_3 csqd = tr.geom_traits().compute_squared_distance_3_object(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Compute_squared_distance_3 csqd = tr.geom_traits().compute_squared_distance_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); Vertex_container treated_vertices; FT min_sq_dist = std::numeric_limits::infinity(); @@ -524,9 +524,9 @@ Triangulation_helpers:: well_oriented(const Tr& tr, const Cell_vector& cells_tos) const { - typedef typename Tr::Geom_traits Gt; - typename Gt::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typedef typename Tr::Geom_traits GT; + typename GT::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); typename Cell_vector::const_iterator it = cells_tos.begin(); for( ; it != cells_tos.end() ; ++it) @@ -570,9 +570,9 @@ well_oriented(const Tr& tr, const Cell_vector& cells_tos, const Point_getter& pg) const { - typedef typename Tr::Geom_traits Gt; - typename Gt::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typedef typename Tr::Geom_traits GT; + typename GT::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); typename Cell_vector::const_iterator it = cells_tos.begin(); for( ; it != cells_tos.end() ; ++it) diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h index 547365f9a1e..aa607e7b088 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h @@ -43,18 +43,18 @@ template class Triangulation_sizing_field { // Types - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; - typedef Triangulation_vertex_base_with_info_3 Vbb; - typedef Regular_triangulation_vertex_base_3 Vb; - typedef Triangulation_cell_base_3 Cbb; + typedef Triangulation_vertex_base_with_info_3 Vbb; + typedef Regular_triangulation_vertex_base_3 Vb; + typedef Triangulation_cell_base_3 Cbb; typedef Regular_triangulation_cell_base_3< - Gt, Cbb, Discard_hidden_points> Cb; + GT, Cbb, Discard_hidden_points> Cb; typedef Triangulation_data_structure_3 Tds; - typedef Regular_triangulation_3 Compact_triangulation; + typedef Regular_triangulation_3 Compact_triangulation; typedef Compact_triangulation Ctr; typedef typename Tr::Vertex_handle Vertex_handle; @@ -181,8 +181,8 @@ typename Triangulation_sizing_field::FT Triangulation_sizing_field:: interpolate_on_cell_vertices(const Weighted_point& p, const CCell_handle& cell) const { - typename Gt::Construct_point_3 cp = ctr_.geom_traits().construct_point_3_object(); - typename Gt::Compute_volume_3 volume = ctr_.geom_traits().compute_volume_3_object(); + typename GT::Construct_point_3 cp = ctr_.geom_traits().construct_point_3_object(); + typename GT::Compute_volume_3 volume = ctr_.geom_traits().compute_volume_3_object(); // Interpolate value using tet vertices values const FT& va = cell->vertex(0)->info(); @@ -217,8 +217,8 @@ typename Triangulation_sizing_field::FT Triangulation_sizing_field:: interpolate_on_facet_vertices(const Weighted_point& p, const CCell_handle& cell) const { - typename Gt::Construct_point_3 cp = ctr_.geom_traits().construct_point_3_object(); - typename Gt::Compute_area_3 area = ctr_.geom_traits().compute_area_3_object(); + typename GT::Construct_point_3 cp = ctr_.geom_traits().construct_point_3_object(); + typename GT::Compute_area_3 area = ctr_.geom_traits().compute_area_3_object(); // Find infinite vertex and put it in k0 int k0 = 0; diff --git a/Mesh_3/include/CGAL/Mesh_3/Uniform_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Uniform_sizing_field.h index 273ba6b6f37..3e552737ee6 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Uniform_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Uniform_sizing_field.h @@ -27,9 +27,9 @@ namespace Mesh_3 { template class Uniform_sizing_field { - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::FT FT; + typedef typename GT::FT FT; public: // Vertices of mesh triangulation do not need to be updated diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index d2dfef196e0..ec3e5761a9a 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -96,25 +96,25 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, TransformOperator transform = CGAL::Identity()) { typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Segment Segment_3; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; - typedef typename Gt::Vector_3 Vector_3; + typedef typename GT::Vector_3 Vector_3; typedef MeshDomain Mesh_domain; Tr& tr = c3t3.triangulation(); - typename Gt::Compare_weighted_squared_radius_3 cwsr = + typename GT::Compare_weighted_squared_radius_3 cwsr = tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = tr.geom_traits().construct_weighted_point_3_object(); if(protect_features) { @@ -159,8 +159,8 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, : domain.is_in_domain_object()( seed_cell->weighted_circumcenter(tr.geom_traits())); - if ( seed_label != boost::none - && seed_cell_label != boost::none + if ( seed_label != std::nullopt + && seed_cell_label != std::nullopt && *seed_label == *seed_cell_label) continue; //this means the connected component has already been initialized diff --git a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h index 5fed977c7ef..c5a148d78fa 100644 --- a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h +++ b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h @@ -395,8 +395,8 @@ class Cell_criteria_visitor_with_features typedef Criterion_visitor Base; typedef Cell_criteria_visitor_with_features Self; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; typedef typename Tr::Weighted_point Weighted_point; @@ -414,11 +414,11 @@ public: , ratio_(0) , size_ratio_(0.5*0.5*4.) { - typename Gt::Compare_weighted_squared_radius_3 compare = + typename GT::Compare_weighted_squared_radius_3 compare = tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = tr.geom_traits().compute_weight_3_object(); - typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = + typename GT::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = tr.geom_traits().compute_squared_radius_smallest_orthogonal_sphere_3_object(); int k1 = 0; @@ -560,8 +560,8 @@ class Cell_criterion_visitor_with_radius_lower_bound typedef Cell_criteria_visitor_with_features Base; typedef Cell_criterion_visitor_with_radius_lower_bound Self; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; public: typedef typename Base::Quality Cell_quality; diff --git a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_criteria.h b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_criteria.h index 268bffcc4c1..a3564c1b946 100644 --- a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_criteria.h +++ b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_criteria.h @@ -22,7 +22,7 @@ -#include +#include #include namespace CGAL { @@ -41,7 +41,7 @@ class Abstract_criterion public: typedef FT Quality; - typedef boost::optional Is_bad; + typedef std::optional Is_bad; typedef typename Visitor_::Handle Handle; /// Destructor @@ -81,7 +81,7 @@ protected: public: typedef std::pair Quality; - typedef boost::optional Is_bad; + typedef std::optional Is_bad; // Constructor diff --git a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h index ed57357bda9..4e42d381005 100644 --- a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h +++ b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h @@ -102,14 +102,14 @@ protected: CGAL_assertion (f.first->is_facet_on_surface(f.second)); CGAL_assertion (B_ != 0); - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Gt::Compute_squared_area_3 Area; - typedef typename Gt::Compute_squared_distance_3 Distance; - typedef typename Gt::Construct_point_3 Construct_point_3; - typedef typename Gt::Construct_triangle_3 Construct_triangle_3; + typedef typename GT::Compute_squared_area_3 Area; + typedef typename GT::Compute_squared_distance_3 Distance; + typedef typename GT::Construct_point_3 Construct_point_3; + typedef typename GT::Construct_triangle_3 Construct_triangle_3; Area area = tr.geom_traits().compute_squared_area_3_object(); Distance distance = tr.geom_traits().compute_squared_distance_3_object(); @@ -127,7 +127,7 @@ protected: const FT d12 = distance(p1,p2); const FT d13 = distance(p1,p3); const FT d23 = distance(p2,p3); - const FT min_d123 = details::min_3(d12,d13,d23); + const FT min_d123 = details::min_3(d12,d13,d23); const FT aspect_ratio = 4 * triangle_area * min_d123 / (d12*d13*d23); @@ -193,11 +193,11 @@ protected: CGAL_assertion(f.first->is_facet_on_surface(f.second)); CGAL_assertion (B_ != 0); - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Bare_point Bare_point; - typename Gt::Construct_weighted_circumcenter_3 weighted_circumcenter = + typename GT::Construct_weighted_circumcenter_3 weighted_circumcenter = tr.geom_traits().construct_weighted_circumcenter_3_object(); const Weighted_point& p1 = tr.point(f.first, (f.second+1)&3); @@ -264,11 +264,11 @@ protected: { CGAL_assertion (f.first->is_facet_on_surface(f.second)); - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Bare_point Bare_point; - typename Gt::Construct_weighted_circumcenter_3 weighted_circumcenter = + typename GT::Construct_weighted_circumcenter_3 weighted_circumcenter = tr.geom_traits().construct_weighted_circumcenter_3_object(); const Weighted_point& p1 = tr.point(f.first, (f.second+1)&3); @@ -346,11 +346,11 @@ protected: { CGAL_assertion (f.first->is_facet_on_surface(f.second)); - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); const Weighted_point& wp1 = tr.point(f.first, (f.second+1)&3); const Bare_point& p1 = cp(wp1); @@ -426,11 +426,11 @@ protected: CGAL_assertion (f.first->is_facet_on_surface(f.second)); CGAL_assertion (B_ != 0); - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); const Weighted_point& wp1 = tr.point(f.first, (f.second+1)&3); const Bare_point p1 = cp(wp1); @@ -653,8 +653,8 @@ class Facet_criterion_visitor_with_features typedef Mesh_3::Criterion_visitor Base; typedef Facet_criterion_visitor_with_features Self; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; public: typedef typename Base::Quality Facet_quality; @@ -672,15 +672,15 @@ public: , angle_ratio_(0.5*0.5*4.) , size_ratio_(0.4*0.4*4.) { - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Cell_handle Cell_handle; - typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = + typename GT::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = tr.geom_traits().compute_squared_radius_smallest_orthogonal_sphere_3_object(); - typename Gt::Compute_weight_3 cw = + typename GT::Compute_weight_3 cw = tr.geom_traits().compute_weight_3_object(); - typename Gt::Compare_weighted_squared_radius_3 compare = + typename GT::Compare_weighted_squared_radius_3 compare = tr.geom_traits().compare_weighted_squared_radius_3_object(); const Cell_handle& c = fh.first; @@ -817,8 +817,8 @@ class Facet_criterion_visitor_with_radius_lower_bound typedef Facet_criterion_visitor_with_features Base; typedef Facet_criterion_visitor_with_radius_lower_bound Self; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; public: typedef typename Base::Quality Facet_quality; diff --git a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h index 1f94745c004..787b443489c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h +++ b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h @@ -29,15 +29,13 @@ #include #include -#include // for std::prev -#include - #include #include #include #include +#include namespace CGAL { namespace Mesh_3 { @@ -452,7 +450,7 @@ polylines_to_protect InterpolationFunctor interpolate, PolylineInputIterator existing_polylines_begin, PolylineInputIterator existing_polylines_end, - boost::optional scalar_interpolation_value = boost::none, + std::optional scalar_interpolation_value = std::nullopt, int prec = 10) { typedef typename DomainFunctor::result_type Domain_type; @@ -587,7 +585,7 @@ polylines_to_protect pixel[1], pixel[2]); square[ii][jj].domain = domain_fct(square[ii][jj].word); - if(scalar_interpolation_value != boost::none) { + if(scalar_interpolation_value != std::nullopt) { square[ii][jj].word = Image_word_type(square[ii][jj].word - (*scalar_interpolation_value)); @@ -736,7 +734,7 @@ case_1_2_1: square[1][0], null); Isoline_equation equation = - (scalar_interpolation_value == boost::none) ? + (scalar_interpolation_value == std::nullopt) ? Isoline_equation(1, -1, -1, 0) : Isoline_equation(v00, v10, v01, v11); insert_curve_in_graph.insert_curve(equation, @@ -746,7 +744,7 @@ case_1_2_1: p00, p10 - p00, p01 - p00); - if(scalar_interpolation_value == boost::none) { + if(scalar_interpolation_value == std::nullopt) { equation = Isoline_equation(0, -1, -1, 1); } insert_curve_in_graph.insert_curve(equation, @@ -873,7 +871,7 @@ case_1_2_1: square[1][1], null); vertex_descriptor bottom = g_manip.split(square[0][0], square[1][0], null); - if(scalar_interpolation_value == boost::none) { + if(scalar_interpolation_value == std::nullopt) { g_manip.try_add_edge(top, bottom); } else { insert_curve_in_graph.insert_curve(Isoline_equation(v00, v10, @@ -892,7 +890,7 @@ case_1_2_1: CGAL_assertion(square[1][0].domain==square[0][1].domain); CGAL_assertion(square[0][0].domain!=square[0][1].domain); - if(scalar_interpolation_value != boost::none) { + if(scalar_interpolation_value != std::nullopt) { // Compute the squared distance between the two branches of // the hyperbola. const double discrimant = double(v00) * v11 - double(v01) * v10; @@ -965,7 +963,7 @@ case_1_2_1: square[1][1], null); Isoline_equation equation = - (scalar_interpolation_value == boost::none) ? + (scalar_interpolation_value == std::nullopt) ? Isoline_equation(1, -1, 1, 1) : Isoline_equation(v00, v10, v01, v11); diff --git a/Mesh_3/include/CGAL/Mesh_3/sliver_criteria.h b/Mesh_3/include/CGAL/Mesh_3/sliver_criteria.h index 335bd89291c..6ecabd1aa90 100644 --- a/Mesh_3/include/CGAL/Mesh_3/sliver_criteria.h +++ b/Mesh_3/include/CGAL/Mesh_3/sliver_criteria.h @@ -36,9 +36,9 @@ template Base; typedef typename Base::Tetrahedron_3 Tetrahedron_3; typedef typename Base::Cell_vector Cell_vector; - typedef typename Base::Gt Gt; + typedef typename Base::GT GT; public: typedef typename Base::Cell_handle Cell_handle; @@ -163,7 +163,7 @@ class Radius_ratio_criterion { protected: typedef Sliver_criterion Base; - typedef typename Base::Gt Gt; + typedef typename Base::GT GT; typedef typename Base::Tetrahedron_3 Tetrahedron_3; typedef typename Base::Cell_vector Cell_vector; typedef Radius_ratio_criterion RR_criterion; diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index de2148d7f11..c37712db458 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -34,7 +34,7 @@ #endif #endif -#include +#include #include #include #include @@ -115,16 +115,16 @@ typename Tr::Geom_traits::FT edge_sq_length(const typename Tr::Edge& e, const Tr& tr) { - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; // There is no need to use tr.min_squared_distance() here because we are computing // distances between vertices within a common cell, which means that even // if we are using a periodic triangulation, the distance is correctly computed. - typename Gt::Compute_squared_distance_3 sq_distance = + typename GT::Compute_squared_distance_3 sq_distance = tr.geom_traits().compute_squared_distance_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); const Weighted_point& wp = tr.point(e.first, e.second); @@ -393,9 +393,9 @@ protected: typedef typename Base::Cell_handle Cell_handle; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -450,15 +450,15 @@ protected: const Tr& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = tr.geom_traits().construct_weighted_point_3_object(); - typename Gt::Compute_squared_length_3 sq_length = + typename GT::Compute_squared_length_3 sq_length = tr.geom_traits().compute_squared_length_3_object(); - typename Gt::Construct_translated_point_3 translate = + typename GT::Construct_translated_point_3 translate = tr.geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_vector_3 vector = + typename GT::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); // create a helper @@ -551,9 +551,9 @@ protected: typedef typename Base::Vertex_handle Vertex_handle; typedef typename Base::Cell_handle Cell_handle; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -653,9 +653,9 @@ private: { const Triangulation& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Construct_translated_point_3 translate = + typename GT::Construct_translated_point_3 translate = c3t3.triangulation().geom_traits().construct_translated_point_3_object(); unsigned int index = cell->index(v); @@ -727,9 +727,9 @@ protected: typedef typename Base::Cell_handle Cell_handle; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -830,7 +830,7 @@ private: CGAL_precondition(cell->has_vertex(v)); const typename C3T3::Triangulation& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); const int i = cell->index(v); @@ -878,9 +878,9 @@ protected: typedef typename Base::Cell_handle Cell_handle; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -985,9 +985,9 @@ private: // There is no need to use tr.min_squared_distance() here because we are computing // distances between vertices within a common cell, which means that even // if we are using a periodic triangulation, the distance is correctly computed. - typename Gt::Compute_squared_distance_3 sq_distance = + typename GT::Compute_squared_distance_3 sq_distance = tr.geom_traits().compute_squared_distance_3_object(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); const int i = cell->index(v); @@ -1047,9 +1047,9 @@ private: { const typename C3T3::Triangulation& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Compute_approximate_dihedral_angle_3 approx_dihedral_angle = + typename GT::Compute_approximate_dihedral_angle_3 approx_dihedral_angle = tr.geom_traits().compute_approximate_dihedral_angle_3_object(); const Weighted_point& wp1 = tr.point(cell, k1); @@ -1075,7 +1075,7 @@ private: { const typename C3T3::Triangulation& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); int k1 = (i+1)&3; int k2 = (i+2)&3; @@ -1114,9 +1114,9 @@ protected: typedef typename Base::Cell_handle Cell_handle; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; @@ -1177,7 +1177,7 @@ protected: Vector_3 random_vector_fixed_size(const C3T3& c3t3, const FT& vector_sq_size) const { - typename Gt::Compute_squared_length_3 sq_length = + typename GT::Compute_squared_length_3 sq_length = c3t3.triangulation().geom_traits().compute_squared_length_3_object(); Vector_3 rnd_vector(random_ft(),random_ft(),random_ft()); @@ -1242,9 +1242,9 @@ protected: typedef typename Base::Cell_handle Cell_handle; typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename GT::Vector_3 Vector_3; typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; @@ -1319,13 +1319,13 @@ private: { typedef Triangulation_helpers Th; - typename Gt::Construct_point_3 cp = + typename GT::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - typename Gt::Construct_weighted_point_3 cwp = + typename GT::Construct_weighted_point_3 cwp = c3t3.triangulation().geom_traits().construct_weighted_point_3_object(); - typename Gt::Construct_translated_point_3 translate = + typename GT::Construct_translated_point_3 translate = c3t3.triangulation().geom_traits().construct_translated_point_3_object(); - typename Gt::Construct_vector_3 vector = + typename GT::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); modified_vertices.clear(); diff --git a/Mesh_3/include/CGAL/Mesh_cell_base_3.h b/Mesh_3/include/CGAL/Mesh_cell_base_3.h index b52243fbbc2..33f7f5448cf 100644 --- a/Mesh_3/include/CGAL/Mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_cell_base_3.h @@ -123,15 +123,14 @@ of the concept `RegularTriangulationCellBaseWithWeightedCircumcenter_3` and defa \sa `CGAL::Compact_mesh_cell_base_3` */ -template< class GT, - class MD, - class Cb= CGAL::Regular_triangulation_cell_base_with_weighted_circumcenter_3< - GT, CGAL::Regular_triangulation_cell_base_3 > > +template > > class Mesh_cell_base_3 -: public Mesh_3::Mesh_surface_cell_base_3 #ifndef DOXYGEN_RUNNING -, public Mesh_cell_base_3_base< - typename Mesh_3::Mesh_surface_cell_base_3::Tds::Concurrency_tag> + : public Mesh_3::Mesh_surface_cell_base_3, + public Mesh_cell_base_3_base::Tds::Concurrency_tag> #endif { typedef typename GT::FT FT; @@ -161,7 +160,6 @@ public: typedef Mesh_cell_base_3 Other; }; - // Constructors Mesh_cell_base_3() : Base() , subdomain_index_() @@ -223,6 +221,9 @@ public: bool is_cache_valid() const { return sliver_cache_validity_; } void reset_cache_validity() const { sliver_cache_validity_ = false; } + /// \name I/O + ///@{ + static std::string io_signature() { @@ -231,6 +232,8 @@ public: + Get_io_signature()(); } + /// @} + #ifdef CGAL_INTRUSIVE_LIST public: Cell_handle next_intrusive() const { return next_intrusive_; } @@ -246,8 +249,9 @@ public: } #endif // CGAL_INTRUSIVE_LIST - /// For the determinism of Compact_container iterators + /// \name Determinism ///@{ + typedef Tag_true Has_timestamp; std::size_t time_stamp() const { @@ -256,6 +260,7 @@ public: void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } + ///@} private: diff --git a/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h b/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h index 7038044ec46..b8bfd6cfdcf 100644 --- a/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h @@ -27,11 +27,42 @@ namespace CGAL { -template > +/*! +\ingroup PkgMesh3MeshClasses + +The class `Mesh_cell_criteria_3` is a model of `MeshCellCriteria_3`. It provides, +for the mesh tetrahedra, +a uniform shape criterion +and a sizing field which may be a uniform or variable field. + +\tparam Tr must be identical to the nested type +`Triangulation` of the instance used as model of +`MeshComplex_3InTriangulation_3`. + +\cgalModels `MeshCellCriteria_3` + +\sa `MeshCriteria_3` +\sa `CGAL::Mesh_criteria_3` +\sa `CGAL::make_mesh_3()` +*/ +template +#endif + > class Mesh_cell_criteria_3 { public: + /// \name Types + /// @{ + + /*! + Numerical type + */ + typedef typename Tr::Geom_traits::FT FT; + + /// @} + typedef Visitor_ Visitor; typedef typename Visitor::Cell_quality Cell_quality; typedef typename Visitor::Is_cell_bad Is_cell_bad; @@ -41,16 +72,28 @@ private: typedef Mesh_3::Criteria Criteria; typedef typename Tr::Cell_handle Cell_handle; - typedef typename Tr::Geom_traits::FT FT; typedef Mesh_cell_criteria_3 Self; public: - /** - * @brief Constructor - * @param radius_edge_bound the radius-edge bound - * @param radius_bound the radius bound (tet sizing) + /// \name Creation +/// @{ + + /*! + * Returns an object to serve as default criteria for cells. + * @param radius_edge_bound is the upper bound for the radius-edge + * ratio of the tetrahedra. + * @param radius_bound is a uniform upper bound + for the circumradii of the tetrahedra in the mesh + * + * @param min_radius_bound is a uniform lower bound for the + * circumradii of the tetrahedra in the mesh. + * Only cells with a circumradius larger than that + * bound will be refined. + * + * See Section \ref introsecparam for further details. + * Note that if one parameter is set to 0, then its corresponding criterion is ignored. */ Mesh_cell_criteria_3(const FT& radius_edge_bound, const FT& radius_bound, @@ -68,13 +111,25 @@ public: // Nb: SFINAE to avoid wrong matches with built-in numerical types // as int. + + /*! + Returns an object to serve as default criteria for facets. + @tparam SizingField must be a model of the concept + `MeshDomainField_3`. + + The behavior and semantic of the arguments are the same + as above, except that the radius bound parameter is a functional + instead of a constant. + */ template - Mesh_cell_criteria_3(const FT& radius_edge_bound, - const Sizing_field& radius_bound, - const FT& min_radius_bound = 0., - std::enable_if_t< + Mesh_cell_criteria_3(const FT& radius_edge_bound + ,const Sizing_field& radius_bound + ,const FT& min_radius_bound = 0. +#ifndef DOXYGEN_RUNNING + ,std::enable_if_t< Mesh_3::Is_mesh_domain_field_3::value >* = 0 +#endif ) { if (FT(0) != min_radius_bound) @@ -86,7 +141,9 @@ public: init_radius_edge(radius_edge_bound); } - /// Destructor + /// @} + + // Destructor ~Mesh_cell_criteria_3() { } /** @@ -99,10 +156,12 @@ public: return criteria_(tr, cell); } +#ifndef DOXYGEN_RUNNING void add(Abstract_criterion* criterion) { criteria_.add(criterion); } +#endif private: void init_radius_edge(const FT& radius_edge_bound) diff --git a/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h b/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h index 68cb73899a8..46b23a408c3 100644 --- a/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h +++ b/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h @@ -37,7 +37,7 @@ namespace CGAL { * a piecewise constant field, i.e. a sizing field with a constant size on each subpart * of the domain. * -* @tparam Gt is the geometric traits class. It must match the type `Triangulation::Geom_traits`, +* @tparam GT is the geometric traits class. It must match the type `Triangulation::Geom_traits`, * where `Triangulation` is the nested type of the model of `MeshComplex_3InTriangulation_3` used * in the meshing process. * @@ -46,7 +46,7 @@ namespace CGAL { * * @cgalModels `MeshDomainField_3` */ -template +template class Mesh_constant_domain_field_3 { public: @@ -56,18 +56,19 @@ public: /*! * Numerical type. */ - typedef typename Gt::FT FT; + typedef typename GT::FT FT; /*! + * Point type. */ #ifdef DOXYGEN_RUNNING - typedef Gt::Point_3 Point_3; + typedef GT::Point_3 Point_3; #else typedef typename boost::mpl::eval_if_c< - internal::Has_nested_type_Bare_point::value, - typename internal::Bare_point_type, - boost::mpl::identity + internal::Has_nested_type_Bare_point::value, + typename internal::Bare_point_type, + boost::mpl::identity >::type Point_3; #endif @@ -107,6 +108,7 @@ public: return d_; } + /*! * Sets the size such that `operator()` for any query point * of dimension `dim` and index `index` returns `size`. diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 00aa58d54cd..b23f4e6a05a 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -37,7 +37,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -61,7 +61,7 @@ public: Polyline() {} ~Polyline() {} - /// Add a point at the end of the polyline + /// adds a point at the end of the polyline void add_point(const Point_3& p) { if( points_.empty() || p != end_point() ) { @@ -69,27 +69,27 @@ public: } } - /// Returns the starting point of the polyline + /// returns the starting point of the polyline const Point_3& start_point() const { CGAL_assertion( ! points_.empty() ); return points_.front(); } - /// Returns the ending point of the polyline + /// returns the ending point of the polyline const Point_3& end_point() const { CGAL_assertion( ! points_.empty() ); return points_.back(); } - /// Returns `true` if the polyline is not degenerated + /// returns `true` if the polyline is not degenerate bool is_valid() const { return points_.size() > 1; } - /// Returns `true` if polyline is a loop + /// returns `true` if polyline is a loop bool is_loop() const { return start_point() == end_point(); @@ -200,7 +200,7 @@ public: } - /// Returns the angle at the first point. + /// returns the angle at the first point. /// \pre The polyline must be a loop. Angle angle_at_first_point() const { CGAL_precondition(is_loop()); @@ -210,7 +210,7 @@ public: return angle(prev, first, next_p); } - /// Returns the length of the polyline + /// returns the length of the polyline FT length() const { //TODO: cache result @@ -226,7 +226,7 @@ public: return result; } - /// Returns signed geodesic distance between `p` and `q`. + /// returns the signed geodesic distance between `p` and `q`. FT signed_geodesic_distance(const Point_3& p, const Point_3& q) const { // Locate p & q on polyline @@ -258,7 +258,7 @@ public: } - /// Returns a point at geodesic distance `distance` from p along the + /// returns a point at geodesic distance `distance` from p along the /// polyline. The polyline is oriented from starting point to end point. /// The distance could be negative. Point_3 point_at(const Point_3& p, FT distance) const @@ -331,7 +331,7 @@ private: return (points_.end() - 2); } - /// Returns an iterator on the starting point of the segment of the + /// returns an iterator on the starting point of the segment of the /// polyline which contains p /// if end_point_first is true, then --end is returned instead of begin /// if p is the starting point of a loop. @@ -451,7 +451,7 @@ public: }; // end class Polyline -template +template struct Mesh_domain_segment_of_curve_primitive{ typedef typename std::iterator_traits::value_type Map_value_type; typedef typename Map_value_type::first_type Curve_id; @@ -463,7 +463,7 @@ struct Mesh_domain_segment_of_curve_primitive{ typedef typename std::iterator_traits< typename Polyline::const_iterator>::value_type Point; - typedef typename Gt::Segment_3 Datum; + typedef typename GT::Segment_3 Datum; Id id_; @@ -516,35 +516,31 @@ struct Display_incidences_to_curves_aux { /*! \ingroup PkgMesh3Domains -The class `Mesh_domain_with_polyline_features_3` is designed to allow the user +The class `Mesh_domain_with_polyline_features_3` enables the user to add some 0- and 1-dimensional features into any model of the `MeshDomain_3` concept. The 1-dimensional features are described as polylines whose endpoints are the added corners. -\tparam MeshDomain is the type -of the domain which should be extended. -It has to be a model of the `MeshDomain_3` concept. +\tparam MD is the type of the domain which is extended. It has to be a model of the `MeshDomain_3` concept. \cgalModels `MeshDomainWithFeatures_3` -\sa `MeshDomain_3` \sa `MeshPolyline_3` -\sa `CGAL::Implicit_mesh_domain_3` -\sa `CGAL::Polyhedral_mesh_domain_3` -\sa `CGAL::Labeled_image_mesh_domain_3` - +\sa `CGAL::Polyhedral_mesh_domain_3` */ -template < typename MeshDomain > +template < typename MD > class Mesh_domain_with_polyline_features_3 - : public MeshDomain + : public MD { - typedef Mesh_domain_with_polyline_features_3 Self; + typedef Mesh_domain_with_polyline_features_3 Self; + public: -/// \name Types -/// @{ - typedef typename MeshDomain::Surface_patch_index Surface_patch_index; - typedef typename MeshDomain::Subdomain_index Subdomain_index; + /// \name Types + /// @{ + + typedef typename MD::Surface_patch_index Surface_patch_index; + typedef typename MD::Subdomain_index Subdomain_index; typedef int Curve_index; typedef int Corner_index; @@ -552,50 +548,46 @@ public: typedef unspecified_type Index; #else typedef typename Mesh_3::internal::Index_generator_with_features< - typename MeshDomain::Subdomain_index, + typename MD::Subdomain_index, Surface_patch_index, Curve_index, Corner_index>::type Index; #endif typedef CGAL::Tag_true Has_features; - typedef typename MeshDomain::R::FT FT; -/// @} + typedef typename MD::R::FT FT; -#ifndef DOXYGEN_RUNNING + /// @} #ifndef CGAL_NO_DEPRECATED_CODE - typedef Curve_index Curve_segment_index; + typedef Curve_index Curve_segment_index; #endif - typedef typename MeshDomain::R Gt; - typedef Gt R; - typedef typename MeshDomain::Point_3 Point_3; -#endif // DOXYGEN_RUNNING + typedef typename MD::R GT; + typedef GT R; + typedef typename MD::Point_3 Point_3; -/// \name Creation -/// Constructors. Forwards the arguments to the constructor -/// of the base class. -/// @{ + /// \name Creation + /// @{ + // forwards the arguments to the constructor of the base class. template Mesh_domain_with_polyline_features_3(const T& ...o) - : MeshDomain(o...) + : MD(o...) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} Mesh_domain_with_polyline_features_3(const Mesh_domain_with_polyline_features_3&) = default; -/// @} + /// @} -/// \name Operations -/// @{ - - /// @cond DEVELOPERS + /// \name Operations /// @{ - /// Add a 0-dimensional feature in the domain. + /// @cond DEVELOPERS + + /// adds a 0-dimensional feature in the domain. Corner_index add_corner(const Point_3& p); /// Overload where the last parameter `out` is not `CGAL::Emptyset_iterator()`. @@ -605,8 +597,9 @@ public: IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/); /*! - Add 0-dimensional features in the domain. The value type of `InputIterator` must - be `Point_3`. + adds 0-dimensional features in the domain. + + The value type of `InputIterator` must be `Point_3`. */ template void @@ -639,11 +632,13 @@ public: add_features_with_context(InputIterator first, InputIterator end, IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/); - /// @} - /// \endcond + + /// @endcond + /*! - Add 1-dimensional features in the domain. `InputIterator` value type must - be a model of the concept `MeshPolyline_3`. + adds 1-dimensional features in the domain. + + The value type of `InputIterator` must be a model of the concept `MeshPolyline_3`. */ template void @@ -651,16 +646,17 @@ public: { add_features(first, end, CGAL::Emptyset_iterator()); } /// @cond DEVELOPERS - /// Undocumented function, kept for backward-compatibility with existing - /// code + + /// Undocumented function, kept for backward-compatibility with existing code template void add_features_with_context(InputIterator first, InputIterator end) { add_features_with_context(first, end, CGAL::Emptyset_iterator()); } + /// @endcond /*! - Add 1-dimensional features (curves) from the range `[first, end)` in the domain with their incidences + adds 1-dimensional features (curves) from the range `[first, end)` in the domain with their incidences with 2-dimensional features (patches) of the domain. \tparam InputIterator input iterator over curves @@ -693,57 +689,57 @@ public: incident_patches_indices_pmap, CGAL::Emptyset_iterator()); } -/// @} -/// \name Implementation of the concept MeshDomainWithFeatures_3 -/// The following methods implement the requirement of the concept -/// `MeshDomainWithFeatures_3`. -/// @{ + /// @} - /// Implements `MeshDomainWithFeatures_3::get_corners()`. - /// OutputIterator value type is std::pair + /// \name Implementation of the concept MeshDomainWithFeatures_3 + /// The following methods implement the requirements of the concept + /// `MeshDomainWithFeatures_3`. + /// @{ + + /// implements `MeshDomainWithFeatures_3::get_corners()`. + /// OutputIterator is `std::pair` template OutputIterator get_corners(OutputIterator out) const; - /// Implements `MeshDomainWithFeatures_3::get_curves()`. + /// implements `MeshDomainWithFeatures_3::get_curves()`. /// OutputIterator value type is std::tuple, std::pair > template OutputIterator get_curves(OutputIterator out) const; - /// Implements `MeshDomainWithFeatures_3::curve_segment_length()`. + /// implements `MeshDomainWithFeatures_3::curve_segment_length()`. FT curve_segment_length(const Point_3& p, const Point_3 q, const Curve_index& curve_index, CGAL::Orientation orientation) const; - /// Implements `MeshDomainWithFeatures_3::curve_length()`. + /// implements `MeshDomainWithFeatures_3::curve_length()`. FT curve_length(const Curve_index& curve_index) const; - /// Implements `MeshDomainWithFeatures_3::construct_point_on_curve()`. + /// implements `MeshDomainWithFeatures_3::construct_point_on_curve()`. Point_3 construct_point_on_curve(const Point_3& starting_point, const Curve_index& curve_index, FT distance) const; - /// Implements `MeshDomainWithFeatures_3::distance_sign_along_loop()`. + /// implements `MeshDomainWithFeatures_3::distance_sign_along_loop()`. CGAL::Sign distance_sign_along_loop(const Point_3& p, const Point_3& q, const Point_3& r, const Curve_index& index) const; - /// Implements `MeshDomainWithFeatures_3::distance_sign()`. + /// implements `MeshDomainWithFeatures_3::distance_sign()`. CGAL::Sign distance_sign(const Point_3& p, const Point_3& q, const Curve_index& index) const; - /// Implements `MeshDomainWithFeatures_3::is_loop()`. + /// implements `MeshDomainWithFeatures_3::is_loop()`. bool is_loop(const Curve_index& index) const; - /// Implements `MeshDomainWithFeatures_3::is_curve_segment_covered()`. + /// implements `MeshDomainWithFeatures_3::is_curve_segment_covered()`. bool is_curve_segment_covered(const Curve_index& index, CGAL::Orientation orientation, const Point_3& c1, const Point_3& c2, const FT sq_r1, const FT sq_r2) const; - /** * Returns the index to be stored in a vertex lying on the surface identified * by `index`. @@ -758,11 +754,11 @@ public: Index index_from_subdomain_index(const Subdomain_index& index) const { return Index(index); } - /// Returns an `Index` from a `Curve_index` + /// returns an `Index` from a `Curve_index` Index index_from_curve_index(const Curve_index& index) const { return Index(index); } - /// Returns an `Index` from a `Corner_index` + /// returns an `Index` from a `Corner_index` Index index_from_corner_index(const Corner_index& index) const { return Index(index); } @@ -771,22 +767,22 @@ public: * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } /** * Returns the index of the subdomain containing a vertex * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } - /// Returns a `Curve_index` from an `Index` + /// returns a `Curve_index` from an `Index` Curve_index curve_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } - /// Returns a `Corner_index` from an `Index` + /// returns a `Corner_index` from an `Index` Corner_index corner_index(const Index& index) const - { return boost::get(index); } + { return Mesh_3::internal::get_index(index); } /// @cond DEVELOPERS #ifndef CGAL_NO_DEPRECATED_CODE @@ -830,29 +826,29 @@ public: Curve_index insert_edge(InputIterator first, InputIterator end); /// @endcond -/// @} + /// @} private: void compute_corners_incidences(); - /// Returns Index associated to p (p must be the coordinates of a corner + /// returns Index associated to p (p must be the coordinates of a corner /// point) Index point_corner_index(const Point_3& p) const; private: typedef std::map Corners; - typedef Mesh_3::internal::Polyline Polyline; + typedef Mesh_3::internal::Polyline Polyline; typedef std::map Edges; typedef std::map Edges_incidences; typedef std::map > Corners_tmp_incidences; typedef std::map Corners_incidences; typedef Mesh_3::internal::Mesh_domain_segment_of_curve_primitive< - Gt, + GT, typename Edges::const_iterator> Curves_primitives; - typedef CGAL::AABB_traits AABB_curves_traits; Corners corners_; @@ -916,9 +912,11 @@ public: timer.stop(); std::cerr << " done (" << timer.time() * 1000 << " ms)" << std::endl; #endif - } // end build_curves_aabb_tree() + } // build_curves_aabb_tree() + /// @endcond -}; // end class Mesh_domain_with_polyline_features_3 + +}; // class Mesh_domain_with_polyline_features_3 @@ -1546,9 +1544,6 @@ is_curve_segment_covered(const Curve_index& index, c1, c2, sq_r1, sq_r2); } - - } //namespace CGAL - #endif // CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index 8846555dc6b..ca001d12072 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -85,6 +85,7 @@ namespace internal { } // end namespace internal } // end namespace Mesh_3 + /*! \ingroup PkgMesh3MeshClasses @@ -96,16 +97,16 @@ provides a bound for the size criterion. \sa `MeshCriteria_3` \sa `CGAL::Mesh_criteria_3` \sa `MeshDomainField_3` - */ template < typename Tr > class Mesh_edge_criteria_3 { private: typedef Mesh_edge_criteria_3 Self; - typedef typename Tr::Geom_traits Gt; + typedef typename Tr::Geom_traits GT; public: + /// \name Types /// @{ /*! @@ -121,7 +122,8 @@ public: /// \name Creation /// @{ /*! - * Returns an object to serve as criteria for edges. + * returns an object to serve as criteria for edges. + * * \param length_bound is an upper bound * for the length of the edges which are used to discretize the curves. * \param min_length_bound is a desired lower bound @@ -131,12 +133,13 @@ public: * break all the surface topology guarantees of the meshing algorithm. * It is not guaranteed to be exactly respected in the output mesh. * - * Note that if one parameter is set to 0, then its corresponding criterion is ignored. + * \note If one parameter is set to 0, then its corresponding criterion is ignored. */ Mesh_edge_criteria_3(const FT& length_bound, const FT& min_length_bound = 0) + : p_size_(new Mesh_3::internal::Sizing_field_container< - Mesh_constant_domain_field_3 , + Mesh_constant_domain_field_3 , FT, Point_3, Index>(length_bound)) @@ -145,17 +148,19 @@ public: // Nb: SFINAE to avoid wrong matches with built-in numerical types // as int. + /*! - * @tparam SizingField a model of `MeshDomainField_3` - * - * Returns an object to serve as criteria for edges. + * returns an object to serve as criteria for edges. * The behavior and semantic of the argument are the same * as above, except that the `length_bound` * parameter is a functional instead of a constant. + * + * @tparam SizingField a model of `MeshDomainField_3` */ template < typename SizingField > Mesh_edge_criteria_3 ( + const SizingField& length_bound, const FT& min_length_bound = 0 #ifndef DOXYGEN_RUNNING diff --git a/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h b/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h index bc5a9cbbb85..916e1073ac8 100644 --- a/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h @@ -27,11 +27,49 @@ namespace CGAL { -template > +/*! + \ingroup PkgMesh3MeshClasses + + The class `Mesh_facet_criteria_3` is a model of `MeshFacetCriteria_3`. + It provides a uniform bound for the shape criterion, + a uniform or variable sizing field + for the size criterion and/or + a uniform or variable distance field + for the approximation error criterion. + + \tparam Tr must be identical to the nested type + `Triangulation` of the instance used as model of + `MeshComplex_3InTriangulation_3`. + + \cgalModels `MeshFacetCriteria_3` + + \sa `MeshCriteria_3` + \sa `MeshFacetCriteria_3` + \sa `MeshDomainField_3` + \sa `CGAL::Mesh_facet_topology` + \sa `CGAL::Mesh_criteria_3` + \sa `CGAL::make_mesh_3()` + +*/ +template +#endif + > class Mesh_facet_criteria_3 { public: + + /// \name Types + /// @{ + + /*! + Numerical type + */ + typedef typename Tr::Geom_traits::FT FT; + + /// @} + typedef Visitor_ Visitor; typedef typename Visitor::Facet_quality Facet_quality; typedef typename Visitor::Is_facet_bad Is_facet_bad; @@ -41,20 +79,56 @@ private: typedef Mesh_3::Criteria Criteria; typedef typename Tr::Facet Facet; - typedef typename Tr::Geom_traits::FT FT; + typedef Mesh_facet_criteria_3 Self; public: typedef CGAL::Tag_true Has_manifold_criterion; - /** - * @brief Constructor - */ - template < typename Sizing_field, typename Sizing_field2 > + /// \name Creation + /// @{ + +#ifdef DOXYGEN_RUNNING + /*! + returns an object to serve as criteria for facets. + + \param angle_bound is the lower bound for the angles in degrees of the + surface mesh facets. + \param radius_bound is a uniform upper bound + for the radius of the surface Delaunay balls. + \param distance_bound is an upper bound for the center-center distances + of the surface mesh facets. + \param topology is the set of topological constraints + which have to be verified by each surface facet. See + section \ref Mesh_3DelaunayRefinement for further details. + \param min_radius_bound is a uniform lower bound for the radius of + the surface Delaunay balls. Only facets with a radius larger than that + bound will be refined. + + @note If one parameter is set to 0, then its corresponding + criterion is ignored. + */ Mesh_facet_criteria_3(const FT& angle_bound, - const Sizing_field & radius_bound, - const Sizing_field2& distance_bound, + const FT& radius_bound, + const FT& distance_bound, + const Mesh_facet_topology topology = FACET_VERTICES_ON_SURFACE, + const FT& min_radius_bound = 0.); + +#endif + + + /*! + Returns an object to serve as criteria for facets. The types `SizingField` and + `DistanceField` must + be models of the concept `MeshDomainField_3`. The behavior and semantic of the arguments are the same + as above, except that the radius and distance bound parameters are + functionals instead of constants. + */ + template < typename SizingField, typename DistanceField > + Mesh_facet_criteria_3(const FT& angle_bound, + const SizingField & radius_bound, + const DistanceField& distance_bound, const Mesh_facet_topology topology = FACET_VERTICES_ON_SURFACE, const FT& min_radius_bound = 0.) { @@ -65,19 +139,23 @@ public: init_aspect(angle_bound); init_radius(radius_bound, - Mesh_3::Is_mesh_domain_field_3()); + Mesh_3::Is_mesh_domain_field_3()); init_distance(distance_bound, - Mesh_3::Is_mesh_domain_field_3()); + Mesh_3::Is_mesh_domain_field_3()); init_topo(topology); } -/// Destructor + /// @} + + + // Destructor ~Mesh_facet_criteria_3() { } /** * @brief returns whether the facet `facet` is bad or not. + * * @param tr the triangulation within which `facet` lives * @param facet the facet */ diff --git a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h index 4461e5ec478..454c0c94aff 100644 --- a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h @@ -209,13 +209,45 @@ public: } // end namespace Mesh_3 +/*! +\ingroup PkgMesh3Domains -template +The class `Mesh_polyhedron_3` provides a customized `Polyhedron_3` type. This type uses +as `PolyhedronItems_3` a customized type which adds data to the `Vertex`, `Face` and +`Halfedge` classes. Those data are required to use the detection of sharp features. + +\tparam IGT stands for the geometric traits associated +to the meshing process. It must be a model of the two concepts +`PolyhedronTraits_3` and `IntersectionGeometricTraits_3`. + +\sa `CGAL::Polyhedron_3` +\sa `CGAL::Polyhedral_mesh_domain_with_features_3` + +*/ +#ifdef DOXYGEN_RUNNING +template struct Mesh_polyhedron_3 { - typedef Polyhedron_3 > type; + /// \name Types + /// @{ + + /*! + `CGAL::Polyhedron_3` type with customized `PolyhedronItems_3` designed to handle sharp feature detection. + */ + typedef unspecified_type type; + + /// @} +}; +#else +template +struct Mesh_polyhedron_3 +{ + typedef Polyhedron_3 > type; typedef type Type; }; +#endif + } // end namespace CGAL #endif // CGAL_MESH_POLYHEDRON_3_H diff --git a/Mesh_3/include/CGAL/Mesh_triangulation_3.h b/Mesh_3/include/CGAL/Mesh_triangulation_3.h index 2970dc92b58..db6db640c79 100644 --- a/Mesh_3/include/CGAL/Mesh_triangulation_3.h +++ b/Mesh_3/include/CGAL/Mesh_triangulation_3.h @@ -77,7 +77,7 @@ public: // because of Periodic_3_mesh_3: they are functions for which both triangulations // have fundamentally different implementations (usually, Periodic_3_mesh_3 // does not know the offset of a point and must brute-force check for all - // possibilities). To allow Periodic_3_mesh_3 to use Mesh_3's files, + // possibilities). To enable Periodic_3_mesh_3 to use Mesh_3's files, // each mesh triangulation implements its own version. const Bare_point& get_closest_point(const Bare_point& /*p*/, const Bare_point& q) const @@ -124,44 +124,93 @@ public: } }; -// Struct Mesh_triangulation_3 -// + +/*! +\ingroup PkgMesh3MeshClasses + +The class `Mesh_triangulation_3` is a class template which provides the triangulation +type to be used for the 3D triangulation embedding the mesh. + +\tparam MD must be a model of `MeshDomain_3`. + +\tparam GT must be a model of `MeshTriangulationTraits_3` or `Default` +and defaults to `Kernel_traits::%Kernel`. + +\tparam ConcurrencyTag enables sequential versus parallel meshing and optimization algorithms. + Possible values are `Sequential_tag` (the default), `Parallel_tag`, + and `Parallel_if_available_tag`. + +\tparam VertexBase must be a model of `MeshVertexBase_3` or `Default` +and defaults to `Mesh_vertex_base_3`. + +\tparam CellBase must be a model of `MeshCellBase_3` or `Default` +and defaults to `Compact_mesh_cell_base_3`. + +\warning To improve the robustness of the meshing process, the input traits `GT` + is wrapped with the traits class `Robust_weighted_circumcenter_filtered_traits_3`. + The class `Robust_weighted_circumcenter_filtered_traits_3` upgrades the functors + models of `Kernel::ConstructWeightedCircumcenter_3`, `Kernel::ComputeSquaredRadius_3`, + and `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` that are + provided by `GT` to use exact computations when the geometric configuration + is close to degenerate (e.g. almost coplanar points).

+ Users should therefore be aware that the traits class of the triangulation + will have type `Robust_weighted_circumcenter_filtered_traits_3`. + +\sa `make_mesh_3()` +\sa `Mesh_complex_3_in_triangulation_3` + +*/ template + class GT = Default, + class ConcurrencyTag = Sequential_tag, + class VertexBase = Default, + class CellBase = Default> struct Mesh_triangulation_3 { private: - using K = typename Default::Lazy_get >::type; + using K = typename Default::Lazy_get >::type; using Geom_traits = typename details::Mesh_geom_traits_generator::type; using Indices_tuple = Mesh_3::internal::Indices_tuple_t; using Vertex_base = typename Default::Get< - Vertex_base_, + VertexBase, Mesh_vertex_generator_3 >::type; using Cell_base = typename Default::Get< - Cell_base_, + CellBase, Compact_mesh_cell_generator_3 >::type; using Concurrency_tag = - typename Default::Get::type; + typename Default::Get::type; struct Tds : public Triangulation_data_structure_3 {}; using Triangulation = Mesh_3_regular_triangulation_3_wrapper; public: +#ifndef DOXYGEN_RUNNING using type = Triangulation; using Type = type; -}; // end struct Mesh_triangulation_3 -} // end namespace CGAL +#else + /// \name Types + /// @{ + + /*! + The triangulation type to be used for the 3D triangulation embedding the mesh. + This type is a wrapper around the type `CGAL::Regular_triangulation_3`, whose vertex + and cell base classes are respectively `VertexBase` and `CellBase`. + */ + typedef unspecified_type type; + + /// @} +#endif // DOXYGEN_RUNNING +}; + +} // end namespace CGAL #include diff --git a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h index ce6de8775be..4a975d8f70e 100644 --- a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h @@ -85,7 +85,7 @@ surface, the sub-domain indices on both sides are known. \tparam Polyhedron stands for the type of the input polyhedral surface(s), model of `FaceListGraph`. -\tparam IGT_ stands for a geometric traits class +\tparam IGT stands for a geometric traits class providing the types and functors required to implement the intersection tests and intersection computations for polyhedral boundary surfaces. This parameter has to be instantiated @@ -93,56 +93,57 @@ with a model of the concept `IntersectionGeometricTraits_3`. \cgalModels `MeshDomainWithFeatures_3` -\sa `IntersectionGeometricTraits_3` -\sa `CGAL::make_mesh_3()`. -\sa `CGAL::Mesh_domain_with_polyline_features_3` -\sa `CGAL::Polyhedral_mesh_domain_3` -\sa `CGAL::Mesh_polyhedron_3` +\sa `CGAL::make_mesh_3()` +\sa `CGAL::Mesh_domain_with_polyline_features_3` +\sa `CGAL::Polyhedral_mesh_domain_3` +\sa `CGAL::Mesh_polyhedron_3` */ +#ifdef DOXYGEN_RUNNING +template < class IGT, + class Polyhedron = typename Mesh_polyhedron_3::type> +class Polyhedral_complex_mesh_domain_3 + : public Mesh_domain_with_polyline_features_3< + Polyhedral_mesh_domain_3 > +#else template < class IGT_, class Polyhedron_ = typename Mesh_polyhedron_3::type, - class TriangleAccessor=CGAL::Default - > + class TriangleAccessor = CGAL::Default> class Polyhedral_complex_mesh_domain_3 : public Mesh_domain_with_polyline_features_3< Polyhedral_mesh_domain_3< Polyhedron_, IGT_, - CGAL::Default, - int, //Use_patch_id_tag - Tag_true > >//Use_exact_intersection_tag + TriangleAccessor, + int, // Use_patch_id_tag + Tag_true > >// Use_exact_intersection_tag +#endif { public: - /// The base class + // The base class typedef Polyhedron_ Polyhedron; typedef Mesh_domain_with_polyline_features_3< - Polyhedral_mesh_domain_3< - Polyhedron, IGT_, CGAL::Default, - int, Tag_true > > Base; - /// @cond DEVELOPERS + Polyhedral_mesh_domain_3< + Polyhedron, IGT_, TriangleAccessor, int, Tag_true > > Base; + private: - typedef IGT_ IGT; + /// @cond DEVELOPERS typedef Polyhedral_mesh_domain_3 BaseBase; typedef Polyhedral_complex_mesh_domain_3 Self; /// @endcond public: - /*! - Numerical type. - */ + // Numerical type typedef typename Base::FT FT; - /// The polyhedron type + // The polyhedron type typedef Polyhedron Polyhedron_type; - /// \name Index types - /// @{ - /// The types are `int` or types compatible with `int`. + // The types are `int` or types compatible with `int`. typedef typename Base::Corner_index Corner_index; typedef typename Base::Curve_index Curve_index; typedef typename Base::Surface_patch_index Surface_patch_index; typedef typename Base::Subdomain_index Subdomain_index; - /// @} /// @cond DEVELOPERS typedef typename Base::Ray_3 Ray_3; @@ -154,6 +155,7 @@ public: typedef typename Base::AABB_primitive AABB_primitive; typedef typename Base::AABB_primitive_id AABB_primitive_id; typedef typename Base::Surface_patch_index Patch_id; + // Backward compatibility #ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX typedef Surface_patch_index Surface_index; @@ -178,15 +180,18 @@ protected: boost::setS, // this avoids parallel edges boost::vecS, boost::undirectedS, - typename IGT::Point_3, + typename IGT_::Point_3, Set_of_indices> Featured_edges_copy_graph; /// @endcond public: - /// Constructor - /*! Constructs a domain defined by a set of polyhedral surfaces, - describing a polyhedral complex. + /// \name Creation + /// @{ + + /*! + constructs a domain defined by a set of polyhedral surfaces, describing a polyhedral complex. + @param begin first iterator on the input polyhedral surfaces @param end past the end iterator on the input polyhedral surfaces @param indices_begin first iterator on the pairs of subdomain indices @@ -206,15 +211,14 @@ public: */ template - Polyhedral_complex_mesh_domain_3 - ( InputPolyhedraIterator begin, - InputPolyhedraIterator end, - InputPairOfSubdomainIndicesIterator indices_begin, - InputPairOfSubdomainIndicesIterator indices_end + Polyhedral_complex_mesh_domain_3(InputPolyhedraIterator begin, + InputPolyhedraIterator end, + InputPairOfSubdomainIndicesIterator indices_begin, + InputPairOfSubdomainIndicesIterator indices_end #ifndef DOXYGEN_RUNNING - , CGAL::Random* p_rng = nullptr + , CGAL::Random* p_rng = nullptr #endif - ) + ) : Base(p_rng) , patch_indices(indices_begin, indices_end) , borders_detected_(false) @@ -246,7 +250,10 @@ public: this->build(); } + /// @} + /// @cond DEVELOPERS + Polyhedral_complex_mesh_domain_3 ( CGAL::Random* p_rng = nullptr @@ -258,17 +265,15 @@ public: const std::vector& polyhedra() const { return stored_polyhedra; } - /// @endcond - /// @cond DEVELOPERS /*! * construct_initial_points_object() is one of the very first functions called - * when make_mesh_3 starts + * when make_mesh_3 starts. * BEFORE make_mesh_3 starts, we have to make sure that (at least) the borders have * been detected, and the polyhedral complex internal data structures initialized * So, this function is overloaded to make sure they are (checking that - * borders_detected_ is false is enough) - * Then, call the base class function + * borders_detected_ is false is enough). + * Then, call the base class function. */ typename BaseBase::Construct_initial_points construct_initial_points_object() const { @@ -281,9 +286,13 @@ public: void detect_features(FT angle_in_degree, std::vector& p, const bool dont_protect);//if true, features will not be protected + + void detect_borders(std::vector& p, const bool dont_protect); + /// @endcond + /*! - Detects sharp features and boundaries of the polyhedral components of the complex + detects sharp features and boundaries of the polyhedral components of the complex (including potential internal polyhedra), and inserts them as features of the domain. `angle_bound` gives the maximum angle (in degrees) between the two normal vectors of adjacent triangles. @@ -295,13 +304,10 @@ public: detect_features(angle_bound, stored_polyhedra, false/*do protect*/); } - /// @cond DEVELOPERS - void detect_borders(std::vector& p, const bool dont_protect); - /// @endcond /*! - Detects border edges of the polyhedral components of the complex, + detects border edges of the polyhedral components of the complex, and inserts them as features of the domain. - This function should be called alone only, and not before or after `detect_features()`. + This function should only be called alone, and not before or after `detect_features()`. */ void detect_borders() { detect_borders(stored_polyhedra, false/*do protect*/); @@ -365,11 +371,10 @@ public: this->boundary_polyhedra_ids.push_back(poly_id); } } - /// @endcond - /// @cond DEVELOPERS template - void add_vertices_to_c3t3_on_patch_without_feature_edges(C3t3& c3t3) const { + void add_vertices_to_c3t3_on_patch_without_feature_edges(C3t3& c3t3) const + { #ifdef CGAL_MESH_3_VERBOSE std::cout << "add_vertices_to_c3t3_on_patch_without_feature_edges..."; std::cout.flush(); @@ -378,7 +383,7 @@ public: typedef typename C3t3::Triangulation Tr; typedef typename Tr::Weighted_point Weighted_point; - typedef typename IGT::Sphere_3 Sphere_3; + typedef typename IGT_::Sphere_3 Sphere_3; typedef typename Polyhedron::Vertex_const_handle Vertex_const_handle; Tr& tr = c3t3.triangulation(); @@ -519,13 +524,13 @@ public: Is_in_domain(const Polyhedral_complex_mesh_domain_3& domain) : r_domain_(domain) {} - boost::optional shoot_a_ray_1(const Ray_3 ray) const { + std::optional shoot_a_ray_1(const Ray_3 ray) const { return r_domain_.bounding_aabb_tree_ptr()-> first_intersected_primitive(ray); } #if USE_ALL_INTERSECTIONS - boost::optional shoot_a_ray_2(const Ray_3 ray) const { + std::optional shoot_a_ray_2(const Ray_3 ray) const { const Point_3& p = ray.source(); typedef typename AABB_tree:: template Intersection_and_primitive_id::Type Inter_and_prim; @@ -533,18 +538,18 @@ public: r_domain_.bounding_aabb_tree_ptr()-> all_intersections(ray, std::back_inserter(all_intersections)); if(all_intersections.empty()) - return boost::none; + return std::nullopt; else { for(const Inter_and_prim& i_p: all_intersections) { - if(boost::get( &i_p.first) == 0) return AABB_primitive_id(); + if(std::get_if( &i_p.first) == 0) return AABB_primitive_id(); } auto it = std::min_element (all_intersections.begin(), all_intersections.end(), [p](const Inter_and_prim& a, const Inter_and_prim& b) { - const Point_3& pa = boost::get(a.first); - const Point_3& pb = boost::get(b.first); + const Point_3& pa = std::get(a.first); + const Point_3& pb = std::get(b.first); return compare_distance_to_point(p, pa, pb) == CGAL::SMALLER; }); @@ -565,8 +570,8 @@ public: } // Shoot ray - typename IGT::Construct_ray_3 ray = IGT().construct_ray_3_object(); - typename IGT::Construct_vector_3 vector = IGT().construct_vector_3_object(); + typename IGT_::Construct_ray_3 ray = IGT_().construct_ray_3_object(); + typename IGT_::Construct_vector_3 vector = IGT_().construct_vector_3_object(); while(true) { Random_points_on_sphere_3 random_point(1.); @@ -575,13 +580,13 @@ public: #define USE_ALL_INTERSECTIONS 0 #if USE_ALL_INTERSECTIONS - boost::optional opt = shoot_a_ray_2(ray_shot); + std::optional opt = shoot_a_ray_2(ray_shot); #else // first_intersected_primitive - boost::optional opt = shoot_a_ray_1(ray_shot); + std::optional opt = shoot_a_ray_1(ray_shot); #endif // first_intersected_primitive // for(int i = 0; i < 20; ++i) { // const Ray_3 ray_shot2 = ray(p, vector(CGAL::ORIGIN,*random_point)); - // boost::optional opt2 = shoot_a_ray_1(ray_shot2); + // std::optional opt2 = shoot_a_ray_1(ray_shot2); // if(opt != opt2) { // if(!opt && *opt2 == 0) continue; // if(!opt2 && *opt == 0) continue; @@ -598,7 +603,7 @@ public: Surface_patch_index face_id = r_domain_.make_surface_index(*opt); const std::pair& pair = r_domain_.incident_subdomains_indices(face_id); - const typename IGT::Triangle_3 triangle = + const typename IGT_::Triangle_3 triangle = BaseBase::template Primitive_type::datum(*opt); const Point_3& a = triangle[0]; const Point_3& b = triangle[1]; @@ -723,7 +728,7 @@ detect_features(FT angle_in_degree, G_copy g_copy; typedef typename boost::graph_traits::vertex_descriptor graph_vertex_descriptor; - typedef std::map P2vmap; // TODO: replace this map by and unordered_map P2vmap p2vmap; diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 8c7e57e1dd9..450826da13f 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -36,13 +36,13 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include @@ -79,41 +79,71 @@ max_length(const Bbox_3& b) // ----------------------------------- // Geometric traits generator // ----------------------------------- -template < typename Gt, +template < typename GT, typename Use_exact_intersection_construction_tag > struct IGT_generator {}; -template < typename Gt > -struct IGT_generator +template < typename GT > +struct IGT_generator { #ifdef CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS - typedef CGAL::Mesh_3::Robust_intersection_traits_3_new type; + typedef CGAL::Mesh_3::Robust_intersection_traits_3_new type; #else // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS - typedef CGAL::Mesh_3::Robust_intersection_traits_3 type; + typedef CGAL::Mesh_3::Robust_intersection_traits_3 type; #endif // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS typedef type Type; }; -template < typename Gt > -struct IGT_generator +template < typename GT > +struct IGT_generator { - typedef Gt type; + typedef GT type; typedef type Type; }; } // end namespace details } // end namespace Mesh_3 -/** - * @class Polyhedral_mesh_domain_3 - * - * - */ -template +#else // DOXYGEN_RUNNING +template +#endif // DOXYGEN_RUNNING class Polyhedral_mesh_domain_3 { public: @@ -123,7 +153,7 @@ public: typedef Patch_id_ Patch_id; - /// Geometric object types + // Geometric object types typedef typename IGT::Point_3 Point_3; typedef typename IGT::Segment_3 Segment_3; typedef typename IGT::Ray_3 Ray_3; @@ -134,25 +164,25 @@ public: //------------------------------------------------------- // Index Types //------------------------------------------------------- - /// Type of indexes for cells of the input complex + // Type of indexes for cells of the input complex typedef int Subdomain_index; - typedef boost::optional Subdomain; + typedef std::optional Subdomain; - /// Type of indexes for surface patch of the input complex + // Type of indexes for surface patch of the input complex typedef typename boost::property_map >::type Face_patch_id_pmap; typedef typename boost::property_traits< Face_patch_id_pmap>::value_type Surface_patch_index; - typedef boost::optional Surface_patch; - /// Type of indexes to characterize the lowest dimensional face of the input - /// complex on which a vertex lie + typedef std::optional Surface_patch; + + // Type of indexes to characterize the lowest dimensional face of the input + // complex on which a vertex lie typedef typename Mesh_3::internal::Index_generator< Subdomain_index, Surface_patch_index>::type Index; typedef std::tuple Intersection; - typedef typename IGT::FT FT; // Kernel_traits compatibility @@ -197,8 +227,6 @@ public: typedef typename AABB_traits::Bounding_box Bounding_box; public: - - /// Default constructor Polyhedral_mesh_domain_3(CGAL::Random* p_rng = nullptr) : tree_() , bounding_tree_(&tree_) @@ -206,27 +234,43 @@ public: { } - /** - * @brief Constructor. Construction from a polyhedral surface - * @param polyhedron the polyhedron describing the polyhedral surface - */ - Polyhedral_mesh_domain_3(const Polyhedron& p, - CGAL::Random* p_rng = nullptr) + /// \name Creation + /// @{ + + /*! + Construction from a bounding polyhedral surface which must be closed, and free of intersections. + The inside of `bounding_polyhedron` will be meshed. + */ + Polyhedral_mesh_domain_3(const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : tree_() , bounding_tree_(&tree_) // the bounding tree is tree_ , p_rng_(p_rng) { - this->add_primitives(p); - if(! is_triangle_mesh(p)) { + this->add_primitives(bounding_polyhedron); + if(! is_triangle_mesh(bounding_polyhedron)) { std::cerr << "Your input polyhedron must be triangulated!\n"; CGAL_error_msg("Your input polyhedron must be triangulated!"); } this->build(); } + /*! + Construction from a polyhedral surface, and a bounding polyhedral surface. + The first polyhedron must be entirely included inside `bounding_polyhedron`, which must be closed + and free of intersections. + Using this constructor enables to mesh a polyhedral surface which is not closed, or has holes. + The inside of `bounding_polyhedron` will be meshed. + */ Polyhedral_mesh_domain_3(const Polyhedron& p, - const Polyhedron& bounding_polyhedron, - CGAL::Random* p_rng = nullptr) + const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : tree_() , bounding_tree_(new AABB_tree_) , p_rng_(p_rng) @@ -241,22 +285,25 @@ public: this->build(); } - /** - * Constructor. - * + /*! * Constructor from a sequence of polyhedral surfaces, and a bounding * polyhedral surface. * - * @param InputPolyhedraPtrIterator must an iterator of a sequence of - * pointers to polyhedra + * @tparam InputPolyhedraPtrIterator must be a model of + * `ForwardIterator` and value type `Polyhedron*` * - * @param bounding_polyhedron reference to the bounding surface + * @param begin iterator for a sequence of pointers to polyhedra + * @param end iterator for a sequence of pointers to polyhedra + * @param bounding_polyhedron the bounding surface */ template Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, InputPolyhedraPtrIterator end, - const Polyhedron& bounding_polyhedron, - CGAL::Random* p_rng = nullptr) + const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : p_rng_(p_rng) , delete_rng_(false) { @@ -274,20 +321,24 @@ public: this->build(); } - /** - * Constructor. - * - * Constructor from a sequence of polyhedral surfaces, without bounding - * surface. The domain will always answer false to "is_in_domain" + /*! + * Constructor from a sequence of polyhedral surfaces, without a bounding + * surface. The domain will always answer `false` to `is_in_domain()` * queries. * - * @param InputPolyhedraPtrIterator must an iterator of a sequence of - * pointers to polyhedra + * @tparam InputPolyhedraPtrIterator must be a model of + * `ForwardIterator` and value type `Polyhedron*` + * + * @param begin iterator for a sequence of pointers to polyhedra + * @param end iterator for a sequence of pointers to polyhedra */ template - Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, - InputPolyhedraPtrIterator end, - CGAL::Random* p_rng = nullptr) + Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin + , InputPolyhedraPtrIterator end +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : p_rng_(p_rng) { if(begin != end) { @@ -299,7 +350,9 @@ public: bounding_tree_ = 0; } - /// Destructor + /// @} + + // Destructor ~Polyhedral_mesh_domain_3() { if(bounding_tree_ != 0 && bounding_tree_ != &tree_) { delete bounding_tree_; @@ -311,9 +364,9 @@ public: } /** - * Constructs a set of \ccc{n} points on the surface, and output them to - * the output iterator \ccc{pts} whose value type is required to be - * \ccc{std::pair}. + * constructs a set of `n` points on the surface, and output them to + * the output iterator `pts` whose value type is required to be + * `std::pair`. */ struct Construct_initial_points { @@ -342,9 +395,9 @@ public: /** - * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the + * Returns true if point `p` is in the domain. If `p` is in the * domain, the parameter index is set to the index of the subdomain - * including $p$. It is set to the default value otherwise. + * including `p`. It is set to the default value otherwise. */ struct Is_in_domain { @@ -363,16 +416,16 @@ public: return tree_.closest_point(p); } - /// Allowed query types + // Allowed query types typedef boost::mpl::vector Allowed_query_types; /** - * Returns true is the element \ccc{type} intersect properly any of the - * surface patches describing the either the domain boundary or some + * Returns `true` if the element `type` intersects properly any of the + * surface patches describing either the domain boundary or some * subdomain boundary. - * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}. + * `Type` is either `Segment_3`, `Ray_3` or `Line_3`. * Parameter index is set to the index of the intersected surface patch - * if \ccc{true} is returned and to the default \ccc{Surface_patch_index} + * if `true` is returned and to the default `Surface_patch_index` * value otherwise. */ struct Do_intersect_surface @@ -388,7 +441,7 @@ public: { CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION)); - boost::optional primitive_id = r_domain_.tree_.any_intersected_primitive(q); + std::optional primitive_id = r_domain_.tree_.any_intersected_primitive(q); if ( primitive_id ) { r_domain_.cache_primitive(q, *primitive_id); @@ -408,12 +461,12 @@ public: } /** - * Returns a point in the intersection of the primitive \ccc{type} + * Returns a point in the intersection of the primitive `type` * with some boundary surface. - * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}. - * The integer \ccc{dimension} is set to the dimension of the lowest + * `Type1` is either `Segment_3`, `Ray_3` or `Line_3`. + * The integer `dimension` is set to the dimension of the lowest * dimensional face in the input complex containing the returned point, and - * \ccc{index} is set to the index to be stored at a mesh vertex lying + * `index` is set to the index to be stored at a mesh vertex lying * on this face. */ struct Construct_intersection @@ -430,7 +483,7 @@ public: CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION)); typedef typename AABB_tree_::template Intersection_and_primitive_id::Type Intersection_and_primitive_id; - typedef boost::optional AABB_intersection; + typedef std::optional AABB_intersection; typedef Point_3 Bare_point; AABB_intersection intersection; @@ -447,7 +500,7 @@ public: { #ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 CGAL_precondition(r_domain_.do_intersect_surface_object()(q) - != boost::none); + != std::nullopt); #endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 intersection = r_domain_.tree_.any_intersection(q); @@ -459,7 +512,7 @@ public: // intersection may be either a point or a segment if ( const Bare_point* p_intersect_pt = - boost::get( &(intersection->first) ) ) + std::get_if( &(intersection->first) ) ) { return Intersection(*p_intersect_pt, r_domain_.index_from_surface_patch_index( @@ -467,7 +520,7 @@ public: 2); } else if ( const Segment_3* p_intersect_seg = - boost::get(&(intersection->first))) + std::get_if(&(intersection->first))) { CGAL_MESH_3_PROFILER("Mesh_3 profiler: Intersection is a segment"); @@ -533,14 +586,14 @@ public: * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const - { return boost::get(index); } + { return std::get(index); } /** * Returns the index of the subdomain containing a vertex * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const - { return boost::get(index); } + { return std::get(index); } // ----------------------------------- // Backward Compatibility @@ -607,7 +660,7 @@ private: AABB_tree_* bounding_tree_; // cache queries and intersected primitive - typedef typename boost::make_variant_over::type Cached_query; + typedef std::variant Cached_query; struct Query_cache { Query_cache() : has_cache(false) {} diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index acaf3455321..593c0624258 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -57,23 +57,56 @@ namespace CGAL { -/** - * @class Polyhedral_mesh_domain_with_features_3 - * - * - */ -template < class IGT_, - class Polyhedron_ = typename Mesh_polyhedron_3::type, - class TriangleAccessor= CGAL::Default, - class Patch_id=int, - class Use_exact_intersection_construction_tag = Tag_true > +/*! +\ingroup PkgMesh3Domains + +The class `Polyhedral_mesh_domain_with_features_3` implements a domain whose +boundary is a simplicial polyhedral surface. + +This surface must be free of intersections. It can either be closed, +included inside another polyhedral surface which is closed and free of intersections, +or open. In the latter case, the meshing process will only take care of the quality +of the 1D (features and boundaries) and 2D (surfaces) components of the mesh. + +It is a model of the concept `MeshDomainWithFeatures_3`. It also provides +a member function to automatically detect sharp features and boundaries from +the input polyhedral surface(s). + +\tparam IGT stands for a geometric traits class providing the types +and functors required to implement the intersection tests and intersection computations +for polyhedral boundary surfaces. This parameter has to be +instantiated with a model of the concept +`IntersectionGeometricTraits_3`. + +\tparam Polyhedron stands for the type of the input polyhedral surface(s), model of `FaceListGraph`. + +\cgalModels `MeshDomainWithFeatures_3` + +\sa `CGAL::Mesh_domain_with_polyline_features_3` +\sa `CGAL::Polyhedral_mesh_domain_3` +\sa `CGAL::Mesh_polyhedron_3` +*/ +#ifdef DOXYGEN_RUNNING +template ::type> class Polyhedral_mesh_domain_with_features_3 : public Mesh_domain_with_polyline_features_3< - Polyhedral_mesh_domain_3< Polyhedron_, - IGT_, - TriangleAccessor, - Patch_id, - Use_exact_intersection_construction_tag > > + Polyhedral_mesh_domain_3 > +#else +template ::type, + class TriangleAccessor = CGAL::Default, + class Patch_id = int, + class Use_exact_intersection_construction_tag = Tag_true> +class Polyhedral_mesh_domain_with_features_3 + : public Mesh_domain_with_polyline_features_3< + Polyhedral_mesh_domain_3 > +#endif { typedef Mesh_domain_with_polyline_features_3< Polyhedral_mesh_domain_3< @@ -97,8 +130,9 @@ public: typedef typename Base::Surface_patch_index Surface_patch_index; typedef typename Base::Subdomain_index Subdomain_index; + // Backward-compatibility #ifndef CGAL_NO_DEPRECATED_CODE - typedef Curve_index Curve_segment_index; ///< Backward-compatibility + typedef Curve_index Curve_segment_index; #endif typedef typename boost::property_map Bare_polyline; typedef Mesh_3::Polyline_with_context Polyline_with_context; - /// Constructors - Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, - CGAL::Random* p_rng = nullptr) + + /// \name Creation + /// @{ + + /*! + Constructor from a polyhedral surface. + No feature detection is done at this level. Note that a copy of `bounding_polyhedron` will be done. + The polyhedron `bounding_polyhedron` has to be closed and free of intersections. + The interior of `bounding_polyhedron` will be meshed. + */ + Polyhedral_mesh_domain_with_features_3(const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : Base(p_rng) , borders_detected_(false) { stored_polyhedra.resize(1); - stored_polyhedra[0] = p; + stored_polyhedra[0] = bounding_polyhedron; get(face_patch_id_t(), stored_polyhedra[0]); this->add_primitives(stored_polyhedra[0]); this->build(); } #ifndef CGAL_NO_DEPRECATED_CODE - + /*! + \deprecated Constructor from an OFF file. No feature detection is done at this level. + Users must read the file into a `Polyhedron` and call the constructor above. + */ CGAL_DEPRECATED - Polyhedral_mesh_domain_with_features_3(const std::string& filename, - CGAL::Random* p_rng = nullptr) + Polyhedral_mesh_domain_with_features_3(const std::string& filename +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : Base(p_rng) , borders_detected_(false) { load_from_file(filename.c_str()); } +#ifndef DOXYGEN_RUNNING // The following is needed, because otherwise, when a "const char*" is // passed, the constructors templates are a better match, than the // constructor with `std::string`. @@ -153,31 +207,56 @@ public: { load_from_file(filename); } +#endif // DOXYGEN_RUNNING #endif // not CGAL_NO_DEPRECATED_CODE - Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, - const Polyhedron& bounding_p, - CGAL::Random* p_rng = nullptr) + /*! + Constructor from a polyhedral surface, and a bounding polyhedral surface. + The first polyhedron should be entirely included inside `bounding_polyhedron`, which has to be closed + and free of intersections. + Using this constructor enables to mesh a polyhedral surface which is not closed, or has holes. + The inside of `bounding_polyhedron` will be meshed. + */ + Polyhedral_mesh_domain_with_features_3(const Polyhedron& polyhedron, + const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : Base(p_rng) , borders_detected_(false) { stored_polyhedra.resize(2); - stored_polyhedra[0] = p; - stored_polyhedra[1] = bounding_p; + stored_polyhedra[0] = polyhedron; + stored_polyhedra[1] = bounding_polyhedron; get(face_patch_id_t(), stored_polyhedra[0]); get(face_patch_id_t(), stored_polyhedra[1]); this->add_primitives(stored_polyhedra[0]); this->add_primitives(stored_polyhedra[1]); - if(CGAL::is_empty(bounding_p)) { + if(CGAL::is_empty(bounding_polyhedron)) { this->set_surface_only(); } else { this->add_primitives_to_bounding_tree(stored_polyhedra[1]); } } + /*! + * Constructor from a sequence of polyhedral surfaces, without a bounding + * surface. The domain will always answer `false` to `is_in_domain()` + * queries. + * + * @tparam InputPolyhedraPtrIterator must be a model of + * `ForwardIterator` with value type `Polyhedron*` + * + * @param begin iterator for a sequence of pointers to polyhedra + * @param end iterator for a sequence of pointers to polyhedra + */ template Polyhedral_mesh_domain_with_features_3(InputPolyhedraPtrIterator begin, - InputPolyhedraPtrIterator end, - CGAL::Random* p_rng = nullptr) + InputPolyhedraPtrIterator end +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : Base(p_rng) , borders_detected_(false) { stored_polyhedra.reserve(std::distance(begin, end)); @@ -190,11 +269,25 @@ public: this->build(); } + /*! + * Constructor from a sequence of polyhedral surfaces, and a bounding + * polyhedral surface. + * + * @tparam InputPolyhedraPtrIterator must be a model of + * `ForwardIterator` with value type `Polyhedron*` + * + * @param begin iterator for a sequence of pointers to polyhedra + * @param end iterator for a sequence of pointers to polyhedra + * @param bounding_polyhedron the bounding surface + */ template Polyhedral_mesh_domain_with_features_3(InputPolyhedraPtrIterator begin, InputPolyhedraPtrIterator end, - const Polyhedron& bounding_polyhedron, - CGAL::Random* p_rng = nullptr) + const Polyhedron& bounding_polyhedron +#ifndef DOXYGEN_RUNNING + , CGAL::Random* p_rng = nullptr +#endif + ) : Base(p_rng) , borders_detected_(false) { stored_polyhedra.reserve(std::distance(begin, end)+1); @@ -216,21 +309,44 @@ public: this->build(); } - /// Destructor + /// @} + + // Destructor ~Polyhedral_mesh_domain_with_features_3() {} - /// Detect features + // Detect features void initialize_ts(Polyhedron& p); + void detect_borders(std::vector& p); + void detect_features(FT angle_in_degree, std::vector& p); - void detect_features(FT angle_in_degree = FT(60)) + + /// \name Operations + /// @{ + + /*! + detects sharp features and boundaries of the internal bounding polyhedron (and the potential + internal polyhedra) and inserts them as features of the domain. + + @param angle_bound gives the maximum angle (in degrees) between the two normal vectors of adjacent triangles. + For an edge of a polyhedron, if the angle between the two normal vectors of its + incident facets is bigger than the given bound, then the edge is considered as + a feature edge. + */ + void detect_features(FT angle_bound = FT(60)) { - detect_features(angle_in_degree, stored_polyhedra); + detect_features(angle_bound, stored_polyhedra); } - void detect_borders(std::vector& p); + /*! + detects border edges of the bounding polyhedron and inserts them as features of the domain. + + This function should only be called alone, and not before or after `detect_features()`. + */ void detect_borders() { detect_borders(stored_polyhedra); }; + /// @} + template void add_features(InputIterator first, InputIterator end) diff --git a/Mesh_3/include/CGAL/Sizing_field_with_aabb_tree.h b/Mesh_3/include/CGAL/Sizing_field_with_aabb_tree.h index b3a0379c989..a71bef61734 100644 --- a/Mesh_3/include/CGAL/Sizing_field_with_aabb_tree.h +++ b/Mesh_3/include/CGAL/Sizing_field_with_aabb_tree.h @@ -52,7 +52,7 @@ namespace CGAL { * protecting ball will intersect a surface patch to which the * corresponding vertex does not belong. * -* @tparam GeomTraits is the geometric traits class. It must match the type `Triangulation::Geom_traits`, +* @tparam GT is the geometric traits class. It must match the type `Triangulation::Geom_traits`, * where `Triangulation` is the nested type of the model of `MeshComplex_3InTriangulation_3` used * in the meshing process. * @tparam MeshDomain is the type of the domain. It must be a model of `MeshDomainWithFeatures_3`, @@ -61,7 +61,7 @@ namespace CGAL { * @cgalModels `MeshDomainField_3` */ -template struct Sizing_field_with_aabb_tree { - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; + using FT = typename GT::FT; + using Point_3 = typename GT::Point_3; using Index = typename MeshDomain::Index; private: @@ -89,7 +89,7 @@ private: typedef std::vector Corners_incident_patches; typedef std::vector Curves_incident_patches; - typedef GeomTraits Kernel_; + typedef GT Kernel_; typedef CGAL::Delaunay_triangulation_3 Dt; using Input_facets_AABB_tree = typename CGAL::Default::Get< @@ -284,11 +284,11 @@ public: } } - boost::optional + std::optional closest_point_on_surfaces(const Point_3& p, const Patches_ids& patch_ids_to_ignore) const { - boost::optional result{}; + std::optional result{}; if(d_ptr->aabb_tree.empty()) return result; for(std::size_t i = 0; i < d_ptr->kd_trees_ptrs.size(); ++i) { const auto patch_id = static_cast(i + d_ptr->min_patch_id); @@ -391,7 +391,7 @@ public: const auto closest_point_and_primitive = closest_point_on_surfaces(p, ids); - if(closest_point_and_primitive != boost::none) { + if(closest_point_and_primitive != std::nullopt) { result = (std::min)(FT(0.9 / CGAL::sqrt(CGAL::Mesh_3::internal::weight_modifier) * CGAL_NTS @@ -445,7 +445,7 @@ public: if(!d_ptr->aabb_tree.empty()) { //Compute distance to surface patches const auto closest_point_and_primitive = closest_point_on_surfaces(p, ids); - if(closest_point_and_primitive == boost::none) { + if(closest_point_and_primitive == std::nullopt) { #ifdef CGAL_MESH_3_PROTECTION_HIGH_VERBOSITY std::cerr << result << " (projection not found) ids:"; for(Patch_index i : ids) { @@ -532,8 +532,8 @@ public: d_ptr->domain.curves_aabb_tree().traversal(p, curves_projection_traits); //Compute distance to the curve on which p lies - typedef typename GeomTraits::Segment_3 Segment_3; - typedef typename GeomTraits::Plane_3 Plane_3; + typedef typename GT::Segment_3 Segment_3; + typedef typename GT::Plane_3 Plane_3; const typename Input_curves_AABB_tree_::Point_and_primitive_id& ppid = d_ptr->domain.curves_aabb_tree().closest_point_and_primitive(p); @@ -567,7 +567,7 @@ public: const auto int_res = CGAL::intersection(prim.datum(), curr_ortho_plane); if (int_res) { - if (const Point_3* pp = boost::get(&*int_res)) + if (const Point_3* pp = std::get_if(&*int_res)) { FT new_sqd = CGAL::squared_distance(p, *pp); FT dist = CGAL::abs(d_ptr->domain.signed_geodesic_distance(p, *pp, curve_id)); diff --git a/Mesh_3/include/CGAL/Triangle_accessor_3.h b/Mesh_3/include/CGAL/Triangle_accessor_3.h index 03e8313e687..4e336aea354 100644 --- a/Mesh_3/include/CGAL/Triangle_accessor_3.h +++ b/Mesh_3/include/CGAL/Triangle_accessor_3.h @@ -19,7 +19,6 @@ #include - #include #include #include @@ -33,7 +32,6 @@ class Triangle_accessor_3 { typedef typename Polyhedron::Error_bad_match Error_bad_match; }; - template < class K,class Items, template < class T, class I, class A> class T_HDS, @@ -41,9 +39,12 @@ template < class K,class Items, class Triangle_accessor_3, K > { typedef Polyhedron_3 Polyhedron; + public: typedef typename K::Triangle_3 Triangle_3; + typedef typename Polyhedron::Facet_const_iterator Triangle_iterator; + typedef typename Polyhedron::Facet_const_handle Triangle_handle; Triangle_accessor_3() { } @@ -68,8 +69,7 @@ public: } }; - - template +template class Triangle_accessor_3 >, K > { typedef Graph_with_descriptor_with_graph > Polyhedron; @@ -108,8 +108,6 @@ public: } }; - } // end namespace CGAL - #endif // POLYHEDRON_TRIANGLE_ACCESSOR_H diff --git a/Mesh_3/include/CGAL/refine_mesh_3.h b/Mesh_3/include/CGAL/refine_mesh_3.h index b4823d073f4..922c063aec1 100644 --- a/Mesh_3/include/CGAL/refine_mesh_3.h +++ b/Mesh_3/include/CGAL/refine_mesh_3.h @@ -170,11 +170,11 @@ private: * of 1-dimensional exposed features. * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. * They control which optimization processes are performed - * and allow the user to tune the parameters of the optimization processes. + * and enable the user to tune the parameters of the optimization processes. * Individual optimization parameters are not described here as they are * internal types (see instead the documentation page of each optimizer). * For each optimization algorithm, there exist two global functions - * that allow to enable or disable the optimizer. + * that enable/disable the optimizer. * * \cgalNamedParamsBegin * \cgalParamSectionBegin{Topological options (manifoldness)} @@ -310,7 +310,7 @@ void refine_mesh_3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria& cri * done at the end of refinement process * @param reset_c3t3 if `true`, a new C3T3 will be construct from param c3t3. * The new c3t3 keeps only the vertices (as NON-weighted points with their - * dimension and Index) of the triangulation. That allows to refine a mesh + * dimension and Index) of the triangulation. That enables to refine a mesh * which has been exuded. * @param mesh_3_options is a struct object used to pass non-documented options, * for debugging purpose. diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 2a8e19e1c38..b0e9e250c27 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -30,17 +30,14 @@ create_single_source_cgal_program( "test_without_detect_features.cpp" ) if(CGAL_ImageIO_USE_ZLIB) create_single_source_cgal_program( "test_meshing_3D_image.cpp" ) - create_single_source_cgal_program( "test_meshing_3D_image_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_3D_image_with_features.cpp" ) create_single_source_cgal_program( "test_meshing_3D_gray_image.cpp" ) - create_single_source_cgal_program( "test_meshing_3D_gray_image_deprecated.cpp" ) create_single_source_cgal_program( "test_min_size_criteria.cpp") else() message(STATUS "NOTICE: The test 'test_meshing_3D_image' requires the ZLIB library, and will not be compiled.") endif() create_single_source_cgal_program( "test_meshing_implicit_function.cpp" ) -create_single_source_cgal_program( "test_meshing_implicit_function_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_polyhedral_complex.cpp" ) create_single_source_cgal_program( "test_meshing_polyhedron.cpp" ) create_single_source_cgal_program( "test_meshing_polylines_only.cpp" ) @@ -66,12 +63,9 @@ foreach(target test_mesh_criteria_creation test_without_detect_features test_meshing_3D_image - test_meshing_3D_image_deprecated test_meshing_3D_image_with_features test_meshing_3D_gray_image - test_meshing_3D_gray_image_deprecated test_meshing_implicit_function - test_meshing_implicit_function_deprecated test_meshing_polyhedral_complex test_meshing_polyhedron test_meshing_polylines_only diff --git a/Mesh_3/test/Mesh_3/XML_exporter.h b/Mesh_3/test/Mesh_3/XML_exporter.h index 8ecb25600b6..5be7055d320 100644 --- a/Mesh_3/test/Mesh_3/XML_exporter.h +++ b/Mesh_3/test/Mesh_3/XML_exporter.h @@ -185,7 +185,7 @@ public: m_xml_fstream << " " << std::endl; // Save current pointer position - std::ofstream::streampos pos = m_xml_fstream.tellp(); + std::streampos pos = m_xml_fstream.tellp(); // Close the XML file (temporarily) so that the XML file is always correct m_xml_fstream << "" << std::endl; // Restore the pointer position so that the next "add_element" will overwrite diff --git a/Mesh_3/test/Mesh_3/test_criteria.cpp b/Mesh_3/test/Mesh_3/test_criteria.cpp index 317fcb5f3e9..a10460ceee2 100644 --- a/Mesh_3/test/Mesh_3/test_criteria.cpp +++ b/Mesh_3/test/Mesh_3/test_criteria.cpp @@ -49,8 +49,8 @@ struct Tester typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; C3t3 c3t3_; // Cells & facets diff --git a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp index 25a468bbf6f..e5e5cf7f04f 100644 --- a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp +++ b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp @@ -205,7 +205,7 @@ private: Intersection i = construct_intersection(s); assert(std::get<0>(i) != Point_3(1., 0., 0.)); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 2); } @@ -213,7 +213,7 @@ private: Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); Intersection i = construct_intersection(s); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 0); } @@ -222,7 +222,7 @@ private: Intersection i = construct_intersection(r); assert(std::get<0>(i) != Point_3(1., 0., 0.)); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 2); } @@ -230,7 +230,7 @@ private: Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); Intersection i = construct_intersection(r); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 0); } @@ -239,7 +239,7 @@ private: Intersection i = construct_intersection(l); assert(std::get<0>(i) != Point_3(1., 0., 0.)); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 2); } @@ -247,7 +247,7 @@ private: Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); Intersection i = construct_intersection(l); Index ii = std::get<1>(i); - assert(boost::get(&ii)); + assert(std::get_if(&ii)); assert(std::get<2>(i) == 0); } } diff --git a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp index fe31c62f6a4..f0371d3a96d 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp @@ -24,7 +24,7 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; typedef CGAL::Mesh_triangulation_3::type Tr; -typedef Tr::Geom_traits Gt; +typedef Tr::Geom_traits GT; typedef CGAL::Mesh_complex_3_in_triangulation_3(domain, criteria, no_perturb(), no_exude()); - Gt::Construct_weighted_circumcenter_3 w_circumcenter = + GT::Construct_weighted_circumcenter_3 w_circumcenter = c3t3.triangulation().geom_traits().construct_weighted_circumcenter_3_object(); int return_code = 0; diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image_deprecated.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image_deprecated.cpp deleted file mode 100644 index b2ba365111f..00000000000 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image_deprecated.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include - -#include "test_meshing_utilities.h" - -#include -#include -#include - -#include - -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; - -template -struct Greater_than { - typedef T argument_type; - Greater_than(const T& second) : second(second) {} - bool operator()(const T& first) const { - return std::greater()(first, second); - } - T second; -}; - -template -struct Image_tester : public Tester -{ -public: - void image() const - { - typedef float Image_word_type; - typedef CGAL::Image_3 Image; - typedef CGAL::Gray_image_mesh_domain_3< - Image, - K_e_i, - Image_word_type, - Greater_than > Mesh_domain; - - typedef typename CGAL::Mesh_triangulation_3< - Mesh_domain, - CGAL::Kernel_traits::Kernel, - Concurrency_tag>::type Tr; - typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - - CGAL_USE_TYPE(typename Mesh_domain::Surface_patch_index); - - //------------------------------------------------------- - // Data generation - //------------------------------------------------------- - Image image; - if (!image.read(CGAL::data_file_path("images/skull_2.9.inr"))) - { - std::cout << "Image reading error. Exit test.\n"; - return; - } - - std::cout << "\tSeed is\t" - << CGAL::get_default_random().get_seed() << std::endl; - - // Domain - Mesh_domain domain(image, - 2.9f, //isovalue - 0.f, //value_outside - 1e-3, //error_bound - &CGAL::get_default_random());//random generator for determinism - - // Mesh criteria - Mesh_criteria criteria(facet_angle = 30, - facet_size = 6, - facet_distance = 2, - facet_topology = CGAL::MANIFOLD, - cell_radius_edge_ratio = 3, - cell_size = 8); - - // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - no_perturb(), - no_exude(), - mesh_3_options(number_of_initial_points = 30), - non_manifold() - ); - - // Verify - this->verify_c3t3_volume(c3t3, 1236086 * 0.95, 1236086 * 1.05); - this->verify(c3t3, domain, criteria, Bissection_tag()); - } -}; - - -int main() -{ - Image_tester<> test_epic; - std::cerr << "Mesh generation from a 3D image:\n"; - test_epic.image(); - -#ifdef CGAL_LINKED_WITH_TBB - Image_tester test_epic_p; - std::cerr << "Parallel mesh generation from a 3D image:\n"; - test_epic_p.image(); -#endif - - return EXIT_SUCCESS; -} diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_image_deprecated.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_image_deprecated.cpp deleted file mode 100644 index 2883524ccc8..00000000000 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_image_deprecated.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#define CGAL_MESH_3_VERBOSE 1 -#include - -#include "test_meshing_utilities.h" - -#include -#include -#include - -template -struct Image_tester : public Tester -{ -public: - void image() const - { - typedef CGAL::Image_3 Image; - typedef CGAL::Labeled_image_mesh_domain_3 Mesh_domain; - - typedef typename CGAL::Mesh_triangulation_3< - Mesh_domain, - CGAL::Kernel_traits::Kernel, - Concurrency_tag>::type Tr; - typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; - - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - typedef typename Mesh_criteria::Facet_criteria Facet_criteria; - typedef typename Mesh_criteria::Cell_criteria Cell_criteria; - - //------------------------------------------------------- - // Data generation - //------------------------------------------------------- - Image image; - image.read(CGAL::data_file_path("images/liver.inr.gz")); - - std::cout << "\tSeed is\t" - << CGAL::get_default_random().get_seed() << std::endl; - Mesh_domain domain(image, 1e-6, &CGAL::get_default_random()); - - // Set mesh criteria - Facet_criteria facet_criteria(25, 20*image.vx(), 5*image.vx()); - Cell_criteria cell_criteria(4, 25*image.vx()); - Mesh_criteria criteria(facet_criteria, cell_criteria); - - // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - CGAL::parameters::no_exude(), - CGAL::parameters::no_perturb()); - - // Verify - this->verify_c3t3_volume(c3t3, 1772330*0.95, 1772330*1.05); - this->verify(c3t3,domain,criteria, Bissection_tag()); - - typedef typename Mesh_domain::Surface_patch_index Patch_id; - static_assert(CGAL::Output_rep::is_specialized); - CGAL_USE_TYPE(Patch_id); - } - -}; - -int main() -{ - Image_tester<> test_epic; - std::cerr << "Mesh generation from a 3D image:\n"; - test_epic.image(); - -#ifdef CGAL_LINKED_WITH_TBB - Image_tester test_epic_p; - std::cerr << "Parallel mesh generation from a 3D image:\n"; - test_epic_p.image(); -#endif - - return EXIT_SUCCESS; -} diff --git a/Mesh_3/test/Mesh_3/test_meshing_implicit_function_deprecated.cpp b/Mesh_3/test/Mesh_3/test_meshing_implicit_function_deprecated.cpp deleted file mode 100644 index 7877b7558d5..00000000000 --- a/Mesh_3/test/Mesh_3/test_meshing_implicit_function_deprecated.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include - -#include "test_meshing_utilities.h" - -#include - -template -struct Implicit_tester : public Tester -{ - typedef typename K::Point_3 Point; - typedef typename K::FT FT; - static FT sphere_function (const Point& p) - { - const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z(); - return x2+y2+z2-1; - } - - void implicit() const - { - typedef FT (Function)(const Point&); - typedef CGAL::Implicit_mesh_domain_3 Mesh_domain; - - typedef typename CGAL::Mesh_triangulation_3< - Mesh_domain, - typename CGAL::Kernel_traits::Kernel, - Concurrency_tag>::type Tr; - typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; - - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - typedef typename Mesh_criteria::Facet_criteria Facet_criteria; - typedef typename Mesh_criteria::Cell_criteria Cell_criteria; - - typedef typename K::Sphere_3 Sphere_3; - - typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; - - //------------------------------------------------------- - // Data generation - //------------------------------------------------------- - std::cout << "\tSeed is\t" - << CGAL::get_default_random().get_seed() << std::endl; - - Mesh_domain domain(Implicit_tester::sphere_function, - Sphere_3(CGAL::ORIGIN,2.), - 1e-3, - &CGAL::get_default_random()); - - // Set mesh criteria - Facet_criteria facet_criteria(0, 0, 0.3); - Cell_criteria cell_criteria(0, 0.5); - Mesh_criteria criteria(facet_criteria, cell_criteria); - - std::vector initial_points; - initial_points.push_back(Point(1,0,0)); - initial_points.push_back(Point(0,1,0)); - initial_points.push_back(Point(0,0,1)); - initial_points.push_back(Point(-1,0,0)); - initial_points.push_back(Point(0,-1,0)); - initial_points.push_back(Point(0,0,-1)); - - // Mesh generation - C3t3 c3t3; - c3t3.insert_surface_points(initial_points.begin(), - initial_points.end(), - domain.index_from_surface_patch_index(Surface_patch_index(0,1))); - - CGAL::refine_mesh_3(c3t3, domain, criteria, - CGAL::parameters::no_exude(), - CGAL::parameters::no_perturb()); - - CGAL::remove_far_points_in_mesh_3(c3t3); - -#ifdef CGAL_LINKED_WITH_TBB - // Parallel - if (std::is_convertible::value) - { - this->verify(c3t3, domain, criteria, Bissection_tag(), 40, 65, 60, 110); - } - else -#endif //CGAL_LINKED_WITH_TBB - { - // Verify - this->verify(c3t3, domain, criteria, Bissection_tag(), 50, 58, 80, 90); - } - } -}; - - -int main() -{ - Implicit_tester test_epic; - std::cerr << "Mesh generation from an implicit function:\n"; - test_epic.implicit(); - -#ifdef CGAL_LINKED_WITH_TBB - Implicit_tester test_epic_p; - std::cerr << "Parallel mesh generation from an implicit function:\n"; - test_epic_p.implicit(); -#endif - return EXIT_SUCCESS; -} diff --git a/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp b/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp index 09021df2d4c..9d43786e1a1 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp @@ -31,9 +31,9 @@ struct Polyhedron_tester : public Tester { void polyhedron() const { - typedef K Gt; - typedef CGAL::Polyhedron_3 Polyhedron; - typedef CGAL::Polyhedral_mesh_domain_3 Mesh_domain; + typedef K GT; + typedef CGAL::Polyhedron_3 Polyhedron; + typedef CGAL::Polyhedral_mesh_domain_3 Mesh_domain; static_assert(std::is_same< typename Mesh_domain::Surface_patch_index, diff --git a/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp b/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp index 7258d647ac3..ac77144de61 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp @@ -75,9 +75,9 @@ struct Polyhedron_with_features_tester : public Tester } void operator()() const { - typedef CGAL::Mesh_3::Robust_intersection_traits_3 Gt; - typedef typename CGAL::Mesh_polyhedron_3::type Polyhedron; - typedef CGAL::Polyhedral_mesh_domain_with_features_3 GT; + typedef typename CGAL::Mesh_polyhedron_3::type Polyhedron; + typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; diff --git a/Mesh_3/test/Mesh_3/test_meshing_utilities.h b/Mesh_3/test/Mesh_3/test_meshing_utilities.h index 1851c14737f..2e7571eb41d 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_utilities.h +++ b/Mesh_3/test/Mesh_3/test_meshing_utilities.h @@ -333,13 +333,13 @@ struct Tester else { std::cerr << "\nc1 circumcenter: " << tr.dual(c1); std::cerr << "\nc1 is in domain: " - << domain.is_in_domain_object()(tr.dual(c1)); + << CGAL::IO::oformat(domain.is_in_domain_object()(tr.dual(c1))); } if(tr.is_infinite(c2)) std::cerr << "\nc2 is infinite"; else { std::cerr << "\nc2 circumcenter: "<< tr.dual(c2); std::cerr << "\nc2 is in domain: " - << domain.is_in_domain_object()(tr.dual(c2)); + << CGAL::IO::oformat(domain.is_in_domain_object()(tr.dual(c2))); } std::cerr << std::endl; assert(false); diff --git a/Mesh_3/test/Mesh_3/test_min_size_criteria.cpp b/Mesh_3/test/Mesh_3/test_min_size_criteria.cpp index 427030c4c70..d42bef33f80 100644 --- a/Mesh_3/test/Mesh_3/test_min_size_criteria.cpp +++ b/Mesh_3/test/Mesh_3/test_min_size_criteria.cpp @@ -37,7 +37,7 @@ public: Concurrency_tag>::type; using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; - using Gt = typename Tr::Geom_traits; + using GT = typename Tr::Geom_traits; using FT = typename Tr::Geom_traits::FT; using Bare_point = typename Tr::Bare_point; @@ -79,8 +79,8 @@ public: CGAL::parameters::no_perturb()); const Tr& tr = c3t3.triangulation(); - typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); - typename Gt::Compute_squared_radius_3 sq_radius = tr.geom_traits().compute_squared_radius_3_object(); + typename GT::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); + typename GT::Compute_squared_radius_3 sq_radius = tr.geom_traits().compute_squared_radius_3_object(); double max_sq_facet_radius = 0.; double max_sq_cell_radius = 0.; diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h index d2cfbd99436..b44438f24e8 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h @@ -17,7 +17,7 @@ #include -#include +#include namespace CGAL { @@ -69,7 +69,7 @@ class First_intersection_traits public: typedef - boost::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > + std::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > Result; public: First_intersection_traits(const AABBTraits& traits) @@ -124,7 +124,7 @@ public: void intersection(const Query& query, const Primitive& primitive) { - boost::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > + std::optional< typename AABBTraits::template Intersection_and_primitive_id::Type > intersection = m_traits.intersection_object()(query, primitive); if(intersection) @@ -211,7 +211,7 @@ public: { if( m_traits.do_intersect_object()(query, primitive) ) { - m_result = boost::optional(primitive.id()); + m_result = std::optional(primitive.id()); m_is_found = true; } } @@ -221,12 +221,12 @@ public: return m_traits.do_intersect_object()(query, node.bbox()); } - boost::optional result() const { return m_result; } + std::optional result() const { return m_result; } bool is_intersection_found() const { return m_is_found; } private: bool m_is_found; - boost::optional m_result; + std::optional m_result; const AABBTraits& m_traits; }; diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h index 05d35f8026f..aabc398f739 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifdef CGAL_HAS_THREADS #include @@ -252,7 +252,7 @@ public: /// `do_intersect` predicates are defined /// in the traits class `AABBTraits`. template - boost::optional any_intersected_primitive(const Query& query) const; + std::optional any_intersected_primitive(const Query& query) const; ///@} @@ -276,7 +276,7 @@ public: /// for which `do_intersect` predicates /// and intersections are defined in the traits class AABBTraits. template - boost::optional< typename Intersection_and_primitive_id::Type > + std::optional< typename Intersection_and_primitive_id::Type > any_intersection(const Query& query) const; ///@} @@ -764,7 +764,7 @@ public: template template - boost::optional< typename AABB_tree_with_join::template Intersection_and_primitive_id::Type > + std::optional< typename AABB_tree_with_join::template Intersection_and_primitive_id::Type > AABB_tree_with_join::any_intersection(const Query& query) const { using namespace CGAL::internal::AABB_tree_with_join; @@ -776,7 +776,7 @@ public: template template - boost::optional::Primitive_id> + std::optional::Primitive_id> AABB_tree_with_join::any_intersected_primitive(const Query& query) const { using namespace CGAL::internal::AABB_tree_with_join; diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h index ffbb4e4249f..8a9ed4a7455 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h @@ -168,12 +168,10 @@ protected: typename Kernel::Orientation_2 f_orient = ker.orientation_2_object(); Traits_2 traits; - std::list xobjs; - std::list::iterator xobj_it; + std::list> xobjs; typename Traits_2::Make_x_monotone_2 f_make_x_monotone = traits.make_x_monotone_2_object(); Curve_2 arc; - X_monotone_curve_2 xarc; do { @@ -517,12 +515,11 @@ protected: // convolution cycle. xobjs.clear(); f_make_x_monotone (arc, std::back_inserter(xobjs)); - for (xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { - assign_success = CGAL::assign (xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); - *oi++ = Labeled_curve_2 (xarc, - X_curve_label (xarc.is_directed_right(), + for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion(xarc!=nullptr); + *oi++ = Labeled_curve_2 (*xarc, + X_curve_label (xarc->is_directed_right(), cycle_id, curve_index++)); } } @@ -571,18 +568,17 @@ protected: xobjs.clear(); f_make_x_monotone (arc, std::back_inserter(xobjs)); - xobj_it = xobjs.begin(); + auto xobj_it = xobjs.begin(); while (xobj_it != xobjs.end()) { - assign_success = CGAL::assign (xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc != nullptr); ++xobj_it; bool is_last = (xobj_it == xobjs.end()); - *oi++ = Labeled_curve_2 (xarc, - X_curve_label (xarc.is_directed_right(), + *oi++ = Labeled_curve_2 (*xarc, + X_curve_label (xarc->is_directed_right(), cycle_id, curve_index++, is_last)); } diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h index 8db0bd9849a..72a3c3758ac 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h @@ -297,11 +297,8 @@ public: OutputIterator oi) const { typedef std::pair Intersection_base_point; - typedef boost::variant + typedef std::variant Intersection_base_result; - typedef std::pair Intersection_point; - typedef boost::variant - Intersection_result; // In case the curves are adjacent in their curve sequence, we do // not have to compute their intersection (we already know that they @@ -317,24 +314,22 @@ public: // Attach labels to the intersection objects. for (const auto& xection : xections) { const Intersection_base_point* base_pt = - boost::get(&xection); + std::get_if(&xection); if (base_pt != nullptr) { // Attach an invalid label to an itersection point. - *oi++ = Intersection_result(std::make_pair(Point_2(base_pt->first), - base_pt->second)); + *oi++ = std::make_pair(Point_2(base_pt->first), base_pt->second); continue; } const Base_x_monotone_curve_2* base_xcv = - boost::get(&xection); + std::get_if(&xection); CGAL_assertion(base_xcv != nullptr); // Attach a merged label to the overlapping curve. - *oi++ = - Intersection_result(X_monotone_curve_2(*base_xcv, - X_curve_label(cv1.label(), - cv2.label()))); + *oi++ = X_monotone_curve_2(*base_xcv, + X_curve_label(cv1.label(), + cv2.label())); } return oi; diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h index ca77157ec5c..2220f1f536e 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h @@ -117,7 +117,7 @@ protected: Algebraic a, b, c; unsigned int curve_index(0); - std::list xobjs; + std::list> xobjs; Traits_2 traits; auto nt_traits = traits.nt_traits(); @@ -127,8 +127,6 @@ protected: auto alg_ker = traits.alg_kernel(); auto f_equal = alg_ker->equal_2_object(); - bool assign_success; - do { // Get a circulator for the next vertex (in the proper orientation). if (forward) ++next; @@ -185,13 +183,11 @@ protected: f_make_x_monotone(arc, std::back_inserter(xobjs)); for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { - X_monotone_curve_2 xarc; - assign_success = CGAL::assign(xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc!=nullptr); - *oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(), - cycle_id, curve_index)); + *oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(), + cycle_id, curve_index)); curve_index++; } } @@ -237,15 +233,13 @@ protected: auto xobj_it = xobjs.begin(); while (xobj_it != xobjs.end()) { - X_monotone_curve_2 xarc; - assign_success = CGAL::assign(xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc!=nullptr); ++xobj_it; is_last = (xobj_it == xobjs.end()); - *oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(), + *oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(), cycle_id, curve_index, is_last)); curve_index++; diff --git a/Nef_2/include/CGAL/Nef_2/HDS_items.h b/Nef_2/include/CGAL/Nef_2/HDS_items.h index e0b342e9e68..12e1d32d873 100644 --- a/Nef_2/include/CGAL/Nef_2/HDS_items.h +++ b/Nef_2/include/CGAL/Nef_2/HDS_items.h @@ -19,10 +19,10 @@ #include #include #include -#include +#include #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -62,7 +62,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Traits::Point Point; // geometric embedding @@ -73,7 +73,7 @@ private: Halfedge_handle _h; Face_handle _f; Point _p; - boost::optional _ivit; + std::optional _ivit; Mark _m; GenPtr _i; public: @@ -127,7 +127,7 @@ public: iv_iterator ivit() const { return *_ivit; } void set_ivit(iv_iterator it) { _ivit = it; } - void reset_ivit() { _ivit = boost::none; } + void reset_ivit() { _ivit = std::nullopt; } }; @@ -151,7 +151,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename std::list::iterator fc_iterator; @@ -162,7 +162,7 @@ protected: Halfedge_handle opp, prv, nxt; Vertex_handle _v; Face_handle _f; - boost::optional _fcit; + std::optional _fcit; Mark _m; GenPtr _i; public: @@ -223,7 +223,7 @@ public: fc_iterator fcit() const { return *_fcit; } void set_fcit(fc_iterator it) { _fcit = it; } - void reset_fcit() { _fcit = boost::none; } + void reset_fcit() { _fcit = std::nullopt; } bool is_hole_entry() const /*{\Mop returns true iff |\Mvar| is entry point into a hole face @@ -248,7 +248,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Traits::Mark Mark; // mark information diff --git a/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h b/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h index 7748f4b1f61..5a685f9e310 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h @@ -28,7 +28,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif #include @@ -137,7 +137,7 @@ typedef size_t Size_type; /*{\Mtypemember The size type.}*/ typedef void* GenPtr; #else -typedef boost::any GenPtr; +typedef std::any GenPtr; #endif diff --git a/Nef_2/include/CGAL/Nef_2/PM_decorator.h b/Nef_2/include/CGAL/Nef_2/PM_decorator.h index 914a6a58d6a..6cc528c7dab 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_decorator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_decorator.h @@ -19,7 +19,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include diff --git a/Nef_2/include/CGAL/Nef_2/PM_overlayer.h b/Nef_2/include/CGAL/Nef_2/PM_overlayer.h index a1aced0e3ff..947239b9c05 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_overlayer.h +++ b/Nef_2/include/CGAL/Nef_2/PM_overlayer.h @@ -23,7 +23,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 13 @@ -92,7 +92,7 @@ struct PMO_from_segs { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::access(G.info(v)) = e; #else - *boost::any_cast(&G.info(v)) = e; + *std::any_cast(&G.info(v)) = e; #endif } @@ -102,7 +102,7 @@ struct PMO_from_segs { return geninfo::access(G.info(v)); #else return - boost::any_cast(G.info(v)); + std::any_cast(G.info(v)); #endif } @@ -112,7 +112,7 @@ struct PMO_from_segs { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(G.info(v)); #else - G.info(v)=boost::any(); + G.info(v)=std::any(); #endif } @@ -674,7 +674,7 @@ void discard_info(Vertex_handle v) const #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(info(v)); #else - info(v)=boost::any(); + info(v)=std::any(); #endif } @@ -684,7 +684,7 @@ vertex_info& ginfo(Vertex_handle v) const return geninfo::access(info(v)); #else return - *boost::any_cast(&info(v)); + *std::any_cast(&info(v)); #endif } @@ -729,8 +729,8 @@ void discard_info(Halfedge_handle e) const geninfo::clear(info(e)); geninfo::clear(info(twin(e))); #else - info(e)=boost::any(); - info(twin(e))=boost::any(); + info(e)=std::any(); + info(twin(e))=std::any(); #endif } @@ -740,7 +740,7 @@ halfedge_info& ginfo(Halfedge_handle e) const return geninfo::access(info(e)); #else return - *boost::any_cast(&info(e)); + *std::any_cast(&info(e)); #endif } @@ -782,7 +782,7 @@ void discard_info(Face_handle f) const #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(info(f)); #else - info(f)=boost::any(); + info(f)=std::any(); #endif } @@ -792,7 +792,7 @@ face_info& ginfo(Face_handle f) const return geninfo::access(info(f)); #else return - *boost::any_cast(&info(f)); + *std::any_cast(&info(f)); #endif } diff --git a/Nef_2/include/CGAL/Nef_2/PM_point_locator.h b/Nef_2/include/CGAL/Nef_2/PM_point_locator.h index c03e60e3fcf..0e2d063b9cd 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_point_locator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_point_locator.h @@ -28,7 +28,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #ifdef CGAL_USE_LEDA_LIBRARY @@ -497,7 +497,7 @@ protected: return geninfo::const_access(CT.info(v)).first; #else return - boost::any_cast(CT.info(v)).first; + std::any_cast(CT.info(v)).first; #endif } @@ -507,7 +507,7 @@ protected: return geninfo::const_access(CT.info(e)).first; #else return - boost::any_cast(CT.info(e)).first; + std::any_cast(CT.info(e)).first; #endif } @@ -517,7 +517,7 @@ protected: return geninfo::const_access(CT.info(e)).second; #else return - boost::any_cast(CT.info(e)).second; + std::any_cast(CT.info(e)).second; #endif } @@ -584,10 +584,10 @@ protected: f = geninfo::access(info(e_from)).second; #else f = - boost::any_cast(info(source(e))).second; + std::any_cast(info(source(e))).second; else f = - boost::any_cast(info(e_from)).second; + std::any_cast(info(e_from)).second; #endif mark(e) = _DP.mark(f); #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO @@ -968,7 +968,7 @@ PM_point_locator:: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(CT.info(vit)); #else - CT.info(vit)=boost::any(); + CT.info(vit)=std::any(); #endif } Halfedge_iterator eit, eend = CT.halfedges_end(); @@ -976,7 +976,7 @@ PM_point_locator:: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(CT.info(eit)); #else - CT.info(eit)=boost::any(); + CT.info(eit)=std::any(); #endif } CT.clear(); diff --git a/Nef_2/include/CGAL/Nef_2/gen_point_location.h b/Nef_2/include/CGAL/Nef_2/gen_point_location.h index c479a9af62a..1430b785ae0 100644 --- a/Nef_2/include/CGAL/Nef_2/gen_point_location.h +++ b/Nef_2/include/CGAL/Nef_2/gen_point_location.h @@ -27,7 +27,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif @@ -55,7 +55,7 @@ class GenericLocation { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif public: /*{\Mtypes}*/ @@ -89,7 +89,7 @@ public: return geninfo::const_access(value); #else return - *boost::any_cast(&value); + *std::any_cast(&value); #endif } /*{\Mconversion converts |\Mvar| into a node.\\ @@ -105,7 +105,7 @@ public: return geninfo::const_access(value); #else return - *boost::any_cast(&value); + *std::any_cast(&value); #endif } /*{\Mconversion converts |\Mvar| into an edge.\\ @@ -159,8 +159,8 @@ public: case NODE: geninfo::clear(value); break; case EDGE: geninfo::clear(value); break; #else - case NODE: value=boost::any(); break; - case EDGE: value=boost::any(); break; + case NODE: value=std::any(); break; + case EDGE: value=std::any(); break; #endif case NIL: break; } @@ -174,14 +174,14 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::access(value) = geninfo::const_access(L.value); #else - *boost_any_cast(&value) = boost::any_cast(L.value); + *boost_any_cast(&value) = std::any_cast(L.value); #endif break; case EDGE: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::access(value) = geninfo::const_access(L.value); #else - *boost::any_cast(&value) = boost::any_cast(L.value); + *std::any_cast(&value) = std::any_cast(L.value); #endif break; case NIL: break; diff --git a/Nef_2/include/CGAL/Nef_2/geninfo.h b/Nef_2/include/CGAL/Nef_2/geninfo.h index 08273c2e23e..eb723de0fcd 100644 --- a/Nef_2/include/CGAL/Nef_2/geninfo.h +++ b/Nef_2/include/CGAL/Nef_2/geninfo.h @@ -17,7 +17,7 @@ #define CGAL_DEPRECATED_HEADER "" #define CGAL_DEPRECATED_MESSAGE_DETAILS \ - "Something like boost::any or boost::variant should be used instead." + "Something like std::any or std::variant should be used instead." #include #include diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h index 99b71db68a1..c35cfd303f5 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h @@ -34,9 +34,9 @@ struct Exact_intersect_xy_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional + std::optional operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -55,18 +55,18 @@ struct Exact_intersect_xy_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(p2.x(),p2.y(),0))); + return std::make_optional(variant_type(Point_3(p2.x(),p2.y(),0))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),p2.y(),0), + return std::make_optional(variant_type(Segment_3(Point_3(p2.x(),p2.y(),0), Point_3(q2.x(),q2.y(),0) ) )); } }; @@ -80,9 +80,9 @@ struct Exact_intersect_xy_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional operator() (Segment_3 s3, Segment_3 t3) + std::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -102,18 +102,18 @@ struct Exact_intersect_xy_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(p2.hx(),p2.hy(),0,p2.hw()))); + return std::make_optional(variant_type(Point_3(p2.hx(),p2.hy(),0,p2.hw()))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),p2.hy(),0,p2.hw()), + return std::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),p2.hy(),0,p2.hw()), Point_3 (q2.hx(),q2.hy(),0,q2.hw())) )); } }; diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h index 7d77eaae669..b68849ee87e 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h @@ -33,9 +33,9 @@ struct Exact_intersect_xz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional + std::optional operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -54,18 +54,18 @@ struct Exact_intersect_xz_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(p2.x(),0,p2.y()))); + return std::make_optional(variant_type(Point_3(p2.x(),0,p2.y()))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),0,p2.y()), + return std::make_optional(variant_type(Segment_3(Point_3(p2.x(),0,p2.y()), Point_3(q2.x(),0,q2.y()) ) )); } }; @@ -79,9 +79,9 @@ struct Exact_intersect_xz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional operator() (Segment_3 s3, Segment_3 t3) + std::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -101,18 +101,18 @@ struct Exact_intersect_xz_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(p2.hx(),0,p2.hy(),p2.hw()))); + return std::make_optional(variant_type(Point_3(p2.hx(),0,p2.hy(),p2.hw()))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),0,p2.hy(),p2.hw()), + return std::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),0,p2.hy(),p2.hw()), Point_3 (q2.hx(),0,q2.hy(),q2.hw())) )); } diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h index a98b74fd144..6b396bf9dd9 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h @@ -34,9 +34,9 @@ struct Exact_intersect_yz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional + std::optional operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -55,18 +55,18 @@ struct Exact_intersect_yz_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(0,p2.x(),p2.y()))); + return std::make_optional(variant_type(Point_3(0,p2.x(),p2.y()))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3(0,p2.x(),p2.y()), + return std::make_optional(variant_type(Segment_3(Point_3(0,p2.x(),p2.y()), Point_3(0,q2.x(),q2.y()) ) )); } }; @@ -80,9 +80,9 @@ struct Exact_intersect_yz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - typedef boost::variant variant_type; + typedef std::variant variant_type; - boost::optional operator() (Segment_3 s3, Segment_3 t3) + std::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -102,18 +102,18 @@ struct Exact_intersect_yz_2 // so all third components are faked! auto obj = intersection (s2,t2); if(! obj){ - return boost::none; + return std::nullopt; } - if (const Point_2* pi = boost::get(&*obj)) + if (const Point_2* pi = std::get_if(&*obj)) { - return boost::make_optional(variant_type(Point_3(0,p2.hx(),p2.hy(),p2.hw()))); + return std::make_optional(variant_type(Point_3(0,p2.hx(),p2.hy(),p2.hw()))); } - const Segment_2* si = boost::get(&*obj); + const Segment_2* si = std::get_if(&*obj); p2 = si->source(); q2 = si->target(); - return boost::make_optional(variant_type(Segment_3(Point_3 (0,p2.hx(),p2.hy(),p2.hw()), + return std::make_optional(variant_type(Segment_3(Point_3 (0,p2.hx(),p2.hy(),p2.hw()), Point_3 (0,q2.hx(),q2.hy(),q2.hw())) )); } }; diff --git a/Nef_3/include/CGAL/Nef_3/Halfedge.h b/Nef_3/include/CGAL/Nef_3/Halfedge.h index b4fc7065740..01c8df55785 100644 --- a/Nef_3/include/CGAL/Nef_3/Halfedge.h +++ b/Nef_3/include/CGAL/Nef_3/Halfedge.h @@ -31,7 +31,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -42,7 +42,7 @@ class Halfedge_base #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Vector_3 Vector_3; diff --git a/Nef_3/include/CGAL/Nef_3/SFace.h b/Nef_3/include/CGAL/Nef_3/SFace.h index 3ee882271d6..c723b2cd4d0 100644 --- a/Nef_3/include/CGAL/Nef_3/SFace.h +++ b/Nef_3/include/CGAL/Nef_3/SFace.h @@ -29,7 +29,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -39,7 +39,7 @@ class SFace_base { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Vertex_handle Vertex_handle; diff --git a/Nef_3/include/CGAL/Nef_3/SHalfedge.h b/Nef_3/include/CGAL/Nef_3/SHalfedge.h index 19339312f20..2191e73bbe6 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfedge.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfedge.h @@ -30,7 +30,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -40,7 +40,7 @@ class SHalfedge_base { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Sphere_circle Sphere_circle; diff --git a/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h b/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h index 6f60c188570..6cbc6be0ed8 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h @@ -18,7 +18,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include @@ -413,7 +413,7 @@ protected: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO Edge_of[geninfo::access(info(e_min->twin()->source()->twin()->source()))]; #else - Edge_of[ boost::any_cast(info(e_min->twin()->source()->twin()->source())) ]; + Edge_of[ std::any_cast(info(e_min->twin()->source()->twin()->source())) ]; #endif CGAL_assertion( e_below != SHalfedge_handle() ); CGAL_NEF_TRACEN(" edge below " << debug(e_below)); @@ -652,7 +652,7 @@ create_facet_objects(const Plane_3& plane_supporting_facet, #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO Edge_of[geninfo::access(info(l->incident_sface()->center_vertex()))]; #else - Edge_of[ boost::any_cast(info(l->incident_sface()->center_vertex())) ]; + Edge_of[ std::any_cast(info(l->incident_sface()->center_vertex())) ]; #endif CGAL_assertion( e_below != SHalfedge_handle() ); diff --git a/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h b/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h index 8c45ba71566..2c29bca697c 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h @@ -23,7 +23,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include diff --git a/Nef_3/include/CGAL/Nef_3/SNC_const_decorator.h b/Nef_3/include/CGAL/Nef_3/SNC_const_decorator.h index 83f89e413b3..47e85c817ae 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_const_decorator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_const_decorator.h @@ -32,7 +32,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -118,7 +118,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif SNC_const_decorator() : sncp_(0) {} diff --git a/Nef_3/include/CGAL/Nef_3/SNC_decorator.h b/Nef_3/include/CGAL/Nef_3/SNC_decorator.h index 61dcbb983ef..281fb0d0dcd 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_decorator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_decorator.h @@ -36,7 +36,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -157,7 +157,7 @@ class SNC_decorator : public SNC_const_decorator { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif SNC_decorator() : Base(), sncp_() {} diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h index 9aa445f38a1..c546843ffc5 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h @@ -37,7 +37,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif #include @@ -963,7 +963,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif using Base::visit_shell_objects; diff --git a/Nef_3/include/CGAL/Nef_3/SNC_structure.h b/Nef_3/include/CGAL/Nef_3/SNC_structure.h index 27a3c5c414d..8806122cadb 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_structure.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_structure.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -384,13 +384,13 @@ public: expensive operation.}*/ SNC_structure() : - boundary_item_(boost::none), sm_boundary_item_(boost::none), + boundary_item_(std::nullopt), sm_boundary_item_(std::nullopt), vertices_(), halfedges_(), halffacets_(), volumes_(), shalfedges_(), shalfloops_(), sfaces_() {} ~SNC_structure() { CGAL_NEF_TRACEN("~SNC_structure: clearing "< bool is_boundary_object(H h) const - { return boundary_item_[h]!=boost::none; } + { return boundary_item_[h]!=std::nullopt; } template bool is_sm_boundary_object(H h) const - { return sm_boundary_item_[h]!=boost::none; } + { return sm_boundary_item_[h]!=std::nullopt; } template Object_iterator& boundary_item(H h) @@ -462,12 +462,12 @@ public: template void undef_boundary_item(H h) - { CGAL_assertion(boundary_item_[h]!=boost::none); - boundary_item_[h] = boost::none; } + { CGAL_assertion(boundary_item_[h]!=std::nullopt); + boundary_item_[h] = std::nullopt; } template void undef_sm_boundary_item(H h) - { CGAL_assertion(sm_boundary_item_[h]!=boost::none); - sm_boundary_item_[h] = boost::none; } + { CGAL_assertion(sm_boundary_item_[h]!=std::nullopt); + sm_boundary_item_[h] = std::nullopt; } void reset_iterator_hash(Object_iterator it) { SVertex_handle sv; @@ -1035,7 +1035,7 @@ public: protected: void pointer_update(const Self& D); - typedef boost::optional Optional_object_iterator ; + typedef std::optional Optional_object_iterator ; private: Generic_handle_map boundary_item_; Generic_handle_map sm_boundary_item_; diff --git a/Nef_3/include/CGAL/Nef_3/Vertex.h b/Nef_3/include/CGAL/Nef_3/Vertex.h index 0a1d7bc280e..fdccc06bd03 100644 --- a/Nef_3/include/CGAL/Nef_3/Vertex.h +++ b/Nef_3/include/CGAL/Nef_3/Vertex.h @@ -30,7 +30,7 @@ #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -41,7 +41,7 @@ class Vertex_base { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Point_3 Point_3; diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h index e1e1762dc8f..eb83d34928f 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h @@ -32,7 +32,7 @@ #define CGAL_NEF_DEBUG 67 #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -75,7 +75,7 @@ typedef size_t Size_type; #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else -typedef boost::any GenPtr; +typedef std::any GenPtr; #endif diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_decorator.h index 4328b38f44c..8576d4488c8 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_decorator.h @@ -31,7 +31,7 @@ #include #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -84,7 +84,7 @@ typedef typename Sphere_kernel::Aff_transformation_3 Aff_transformation_3; #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else -typedef boost::any GenPtr; +typedef std::any GenPtr; #endif typedef typename Map::SVertex SVertex; typedef typename Map::SVertex_handle SVertex_handle; diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h index 7c09b4eaf0c..994c6a41b80 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h @@ -34,7 +34,7 @@ namespace CGAL { /*{\Manpage {SM_io_parser}{Decorator_}{IO of embedded maps}{IO}}*/ /*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a -decorator to provide input and output of a embedded map. |\Mtype| is +decorator to provide input and output of an embedded map. |\Mtype| is generic with respect to the |Decorator_| parameter. |Decorator_| has to be a decorator model of our |SM_decorator| concept.}*/ diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_items.h b/Nef_S2/include/CGAL/Nef_S2/SM_items.h index d1141a21311..4508f4cc115 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_items.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_items.h @@ -27,7 +27,7 @@ #include #include #ifndef CGAL_I_DO_WANT_TO_USE_GENINFO -#include +#include #endif namespace CGAL { @@ -45,7 +45,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Sphere_point Sphere_point; @@ -127,7 +127,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Sphere_circle Sphere_circle; @@ -228,7 +228,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Sphere_circle Sphere_circle; @@ -306,7 +306,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO typedef void* GenPtr; #else - typedef boost::any GenPtr; + typedef std::any GenPtr; #endif typedef typename Refs::Mark Mark; typedef typename Refs::Object_handle Object_handle; diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h b/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h index 52c94bad708..24496cae987 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h @@ -23,7 +23,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include @@ -106,7 +106,7 @@ struct SMO_from_segs { return geninfo::access(G.info(v)); #else return - boost::any_cast( G.info(v) ); + std::any_cast( G.info(v) ); #endif } @@ -122,7 +122,7 @@ struct SMO_from_segs { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(G.info(v)); #else - G.info(v)=boost::any(); + G.info(v)=std::any(); #endif } @@ -141,7 +141,7 @@ struct SMO_from_segs { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(G.info(v)); #else - G.info(v)=boost::any(); + G.info(v)=std::any(); #endif } @@ -564,7 +564,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(info(v)); #else - info(v)=boost::any(); + info(v)=std::any(); #endif } @@ -574,7 +574,7 @@ public: return geninfo::access(info(v)); #else return - *boost::any_cast(&info(v)); + *std::any_cast(&info(v)); #endif } @@ -618,8 +618,8 @@ public: geninfo::clear(info(e)); geninfo::clear(info(e->twin())); #else - info(e)=boost::any(); - info(e->twin())=boost::any(); + info(e)=std::any(); + info(e->twin())=std::any(); #endif } @@ -629,7 +629,7 @@ public: return geninfo::access(info(e)); #else return - *boost::any_cast(&info(e)); + *std::any_cast(&info(e)); #endif } @@ -671,7 +671,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(info(f)); #else - info(f)=boost::any(); + info(f)=std::any(); #endif } @@ -681,7 +681,7 @@ public: return geninfo::access(info(f)); #else return - *boost::any_cast(&info(f)); + *std::any_cast(&info(f)); #endif } diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h b/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h index 563c5471b45..2e982c5e1f7 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h @@ -21,7 +21,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_triangulator.h b/Nef_S2/include/CGAL/Nef_S2/SM_triangulator.h index af50600aa4a..8c33ff31cc7 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_triangulator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_triangulator.h @@ -22,7 +22,7 @@ #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO #include #else -#include +#include #endif #include #include @@ -213,7 +213,7 @@ public: #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::clear(info(v)); #else - info(v)=boost::any(); + info(v)=std::any(); #endif } @@ -223,7 +223,7 @@ public: return geninfo::access(info(v)); #else return - *boost::any_cast(&info(v)); + *std::any_cast(&info(v)); #endif } @@ -258,8 +258,8 @@ public: geninfo::clear(info(e)); geninfo::clear(info(e->twin())); #else - info(e)=boost::any(); - info(e->twin())=boost::any(); + info(e)=std::any(); + info(e->twin())=std::any(); #endif } @@ -269,7 +269,7 @@ public: return geninfo::access(info(e)); #else return - *boost::any_cast(&info(e)); + *std::any_cast(&info(e)); #endif } @@ -288,7 +288,7 @@ public: return geninfo::const_access(info(e)); #else return - *boost::any_cast(&info(e)); + *std::any_cast(&info(e)); #endif } const Mark& incident_mark(SHalfedge_const_handle e) const diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h index 4c89dbf4ecd..aaa74f14fe4 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h @@ -30,7 +30,7 @@ #define CGAL_NEF_DEBUG 109 #include -#include +#include #include namespace CGAL { @@ -128,7 +128,7 @@ public: typedef std::list Object_list; typedef typename Object_list::iterator Object_iterator; typedef typename Object_list::const_iterator Object_const_iterator; - typedef boost::optional Optional_object_iterator ; + typedef std::optional Optional_object_iterator ; typedef Generic_handle_map Handle_to_iterator_map; typedef Sphere_map* Constructor_parameter; @@ -226,7 +226,7 @@ public: construction means cloning an isomorphic structure and is thus an expensive operation.}*/ - Sphere_map(bool = false) : boundary_item_(boost::none), + Sphere_map(bool = false) : boundary_item_(std::nullopt), svertices_(), sedges_(), sfaces_(), shalfloop_() {} ~Sphere_map() noexcept(!CGAL_ASSERTIONS_ENABLED) @@ -236,7 +236,7 @@ public: ); } - Sphere_map(const Self& D) : boundary_item_(boost::none), + Sphere_map(const Self& D) : boundary_item_(std::nullopt), svertices_(D.svertices_), sedges_(D.sedges_), sfaces_(D.sfaces_), @@ -258,7 +258,7 @@ public: void clear() { - boundary_item_.clear(boost::none); + boundary_item_.clear(std::nullopt); svertices_.destroy(); sfaces_.destroy(); while ( shalfedges_begin() != shalfedges_end() ) @@ -268,7 +268,7 @@ public: template bool is_sm_boundary_object(H h) const - { return boundary_item_[h]!=boost::none; } + { return boundary_item_[h]!=std::nullopt; } template Object_iterator& sm_boundary_item(H h) @@ -280,8 +280,8 @@ public: template void undef_sm_boundary_item(H h) - { CGAL_assertion(boundary_item_[h]!=boost::none); - boundary_item_[h] = boost::none; } + { CGAL_assertion(boundary_item_[h]!=std::nullopt); + boundary_item_[h] = std::nullopt; } void reset_sm_iterator_hash(Object_iterator it) { SVertex_handle sv; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h index 09ed5664c46..d62b8215cc5 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h @@ -182,7 +182,7 @@ typename typeset_intersection()(obj,*this); } - //TODO: convert boost::variant + //TODO: convert std::variant }; diff --git a/Number_types/include/CGAL/Sqrt_extension/Fraction_traits.h b/Number_types/include/CGAL/Sqrt_extension/Fraction_traits.h index 80e67f1ea86..a4daeef3828 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Fraction_traits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Fraction_traits.h @@ -41,9 +41,9 @@ namespace Intern{ * * Extensions provide suitable specializations of \c CGAL::Fraction_traits. * They are decomposable iff their coefficient type is. - * The denominator \e d of a Extension \e ext is a low common multiple + * The denominator \e d of an extension \e ext is a low common multiple * (see \c CGAL::Fraction_traits::Common_factor for details) of the - * denominators of its coefficients. The numerator is the Extenion + * denominators of its coefficients. The numerator is the extenion * \e d*ext with a fraction-free coefficient type. * * This works for nested Sqrt_extensions, too. diff --git a/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h b/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h index c49303dd42d..4a562530c75 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h +++ b/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -92,7 +92,7 @@ template <> class Interval_optional_caching< ::CGAL::Tag_true > { protected: - typedef boost::optional< std::pair > Cached_interval; + typedef std::optional< std::pair > Cached_interval; mutable Cached_interval interval_; void invalidate_interval() {interval_=Cached_interval();} bool is_cached() const {return (interval_?true:false);} diff --git a/Number_types/include/CGAL/boost_mp.h b/Number_types/include/CGAL/boost_mp.h index 3dcaadcad21..b98980acbc5 100644 --- a/Number_types/include/CGAL/boost_mp.h +++ b/Number_types/include/CGAL/boost_mp.h @@ -20,8 +20,18 @@ // easy solution. // MSVC had trouble with versions <= 1.69: // https://github.com/boostorg/multiprecision/issues/98 +// +// Disable also on Windows 32 bits +// because CGAL/cpp_float.h assumes _BitScanForward64 is available +// See https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64 +// +// Disable also with PowerPC processors, with Boost<1.80 because of that bug: +// https://github.com/boostorg/multiprecision/pull/421 +// #if !defined CGAL_DO_NOT_USE_BOOST_MP && \ - (!defined _MSC_VER || BOOST_VERSION >= 107000) + (!defined _MSC_VER || BOOST_VERSION >= 107000) && \ + (!defined _WIN32 || defined _WIN64) && \ + (BOOST_VERSION >= 108000 || (!defined _ARCH_PPC && !defined _ARCH_PPC64)) #define CGAL_USE_BOOST_MP 1 #include diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h index 16fe600bb34..979ec116b10 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include // STL #include @@ -764,7 +764,7 @@ public: // signed distance from t to the intersection of line(a,b) and line(t,s) // the pair::first is false if sign==-1 and true otherwise - std::pair > + std::pair > signed_distance_from_intersection(Vertex_handle a, Vertex_handle b, Vertex_handle t, Vertex_handle s) const { const Point& pa = a->point(); @@ -776,24 +776,24 @@ public: // signed distance from t to the intersection of line(a,b) and line(t,s) // the pair::first is false if sign==-1 and true otherwise - std::pair > + std::pair > compute_signed_distance_from_intersection( const Point& pa, const Point& pb, const Point& pt, const Point& ps) const { FT Dabt = compute_signed_distance(pa, pb, pt); if (Dabt == FT(0)) - return std::make_pair(true,boost::make_optional(FT(0))); + return std::make_pair(true,std::make_optional(FT(0))); Line lab = geom_traits().construct_line_2_object()( pa, geom_traits().construct_vector_2_object()(pa, pb)); Line lts = geom_traits().construct_line_2_object()( pt, geom_traits().construct_vector_2_object()(pt, ps)); - boost::optional Dqt; + std::optional Dqt; const auto result = intersection(lab, lts); if (result) { - const Point* iq = boost::get(&(*result)); + const Point* iq = std::get_if(&(*result)); if (iq) Dqt = CGAL::approximate_sqrt(geom_traits().compute_squared_distance_2_object()(*iq, pt)); } @@ -996,24 +996,24 @@ public: std::cout <<"( " << (edge).priority() << ") ( " << a << " , " << b << " )" << std::endl; } - bool is_p_infinity(const std::pair >& p) const + bool is_p_infinity(const std::pair >& p) const { - return p.first && p.second==boost::none; + return p.first && p.second==std::nullopt; } - bool is_m_infinity(const std::pair >& p) const + bool is_m_infinity(const std::pair >& p) const { - return !p.first && p.second==boost::none; + return !p.first && p.second==std::nullopt; } - bool is_infinity(const std::pair >& p) const + bool is_infinity(const std::pair >& p) const { - return p.second==boost::none; + return p.second==std::nullopt; } - std::pair > m_infinity() const + std::pair > m_infinity() const { - return std::pair >(false,boost::optional()); + return std::pair >(false,std::optional()); } template // value_type = Edge @@ -1028,9 +1028,9 @@ public: Edge ab = twin_edge(*it); Vertex_handle a = source_vertex(ab); Vertex_handle b = target_vertex(ab); - std::pair > D = signed_distance_from_intersection(a, b, target, source); + std::pair > D = signed_distance_from_intersection(a, b, target, source); if (!D.first ) { - CGAL_assertion(D.second!=boost::none); + CGAL_assertion(D.second!=std::nullopt); multi_ind.insert(Rec_edge_2(ab, *D.second)); } } @@ -1053,11 +1053,11 @@ public: Vertex_handle c = target_vertex(bc); Vertex_handle d = target_vertex(cd); - std::pair > Dac=m_infinity(); + std::pair > Dac=m_infinity(); if (a != c && is_triangle_ccw(a, b, c)) Dac = signed_distance_from_intersection(a, c, target, source); - std::pair > Dbd=m_infinity(); + std::pair > Dbd=m_infinity(); if (b != d && is_triangle_ccw(b, c, d)) Dbd = signed_distance_from_intersection(b, d, target, source); diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index a74c0ed2fe7..df3be1a4851 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -52,7 +52,7 @@ #ifndef CGAL_NO_ASSERTIONS # include // for float_prior #endif -#include +#include #include #include #include @@ -988,7 +988,7 @@ dump_dummy_points(const std::string filename) const for(; vit!=vend; ++vit) { Index index = c3t3_.index(vit); - const int* i = boost::get(&index); + const int* i = std::get_if(&index); if(i && *i == 0) dummy_out << cp(c3t3_.triangulation().point(vit)) << std::endl; } @@ -1002,7 +1002,7 @@ try_to_remove_dummy_vertex(const Vertex_handle dummy_vertex) const { // 'dummy_vertex' must correspond to a dummy point CGAL_precondition_code(Index index = c3t3_.index(dummy_vertex);) - CGAL_precondition_code(if(const int* i = boost::get(&index)) {) + CGAL_precondition_code(if(const int* i = std::get_if(&index)) {) CGAL_precondition(*i == 0); CGAL_precondition_code(}) @@ -1347,7 +1347,7 @@ try_to_solve_close_dummy_point(Vertex_handle& protection_vertex, { // dummy_vertex must be a dummy point CGAL_precondition_code(Index index = c3t3_.index(dummy_vertex);) - CGAL_precondition_code(if(const int* i = boost::get(&index)) {) + CGAL_precondition_code(if(const int* i = std::get_if(&index)) {) CGAL_precondition(*i == 0); CGAL_precondition_code(}) @@ -1615,7 +1615,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, Vertex_handle v = ch->vertex(li); Index existing_vertex_index = c3t3_.index(v); - const int* i = boost::get(&existing_vertex_index); + const int* i = std::get_if(&existing_vertex_index); if(i && *i == 0) { @@ -1684,7 +1684,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, << "at distance: " << sq_d << std::endl; Index nearest_vh_index = c3t3_.index(nearest_vh); - int* i = boost::get(&nearest_vh_index); + int* i = std::get_if(&nearest_vh_index); if(i && *i == 0) std::cerr << "Nearest power vertex is a dummy point" << std::endl; #endif @@ -1752,7 +1752,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, #ifdef CGAL_PERIODIC_PROTECTION_ATTEMPT_TO_REMOVE_DUMMY_PTS Index v_index = c3t3_.index(v); - const int* id = boost::get(&v_index); + const int* id = std::get_if(&v_index); bool is_v_dummy_vertex(id && *id == 0); #endif @@ -1799,7 +1799,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, << c3t3_.triangulation().point(nearest_vertex) << ")\n"; Index nearest_vertex_index = c3t3_.index(nearest_vertex); - i = boost::get(&nearest_vertex_index); + i = std::get_if(&nearest_vertex_index); if(i && *i == 0) std::cerr << "reduced due to dummy" << std::endl; #endif @@ -2494,7 +2494,7 @@ change_ball_size(Vertex_handle& v, const FT squared_size, const bool special_bal const Bare_point p = cp(c3t3_.triangulation().point(v)); // intentional copy // Remove v from the set of corners - boost::optional corner_index = boost::make_optional(false, Corner_index()); + std::optional corner_index; if(c3t3_.is_in_complex(v)) { corner_index = c3t3_.corner_index(v); diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h index 36cfbb488e9..97fc3e0d06a 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/HyperbolicPainterOstream.h @@ -77,12 +77,12 @@ public: using Base::operator <<; PainterOstream& operator << (Hyperbolic_segment_2 s) { - if(const Euclidean_segment_2* seg = boost::get(&s)) { + if(const Euclidean_segment_2* seg = std::get_if(&s)) { CGAL::Qt::PainterOstream::operator << (*seg); return *this; } - Circular_arc_2* arc = boost::get(&s); + Circular_arc_2* arc = std::get_if(&s); if(arc->squared_radius() > 100) { Euclidean_segment_2 seg(arc->source(), arc->target()); diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/hyperbolic_free_motion_animation.h b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/hyperbolic_free_motion_animation.h index 5651f2c614a..80f9808370b 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/hyperbolic_free_motion_animation.h +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/hyperbolic_free_motion_animation.h @@ -28,7 +28,7 @@ MainWindow::initialize_animation_parameters() { source = Point(rx1, ry1); target = Point(rx2, ry2); Segment_2 seg = Construct_hyperbolic_segment_2()(source, target); - Circular_arc_2* carc = boost::get(&seg); + Circular_arc_2* carc = std::get_if(&seg); source = carc->source(); target = carc->target(); @@ -118,7 +118,7 @@ Point MainWindow::get_image(Point src, Point tgt, double time) { //std::cout << " ..getting image "; std::cout.flush(); Segment_2 seg = Construct_hyperbolic_segment_2()(src, tgt); - Circular_arc_2* carc = boost::get(&seg); + Circular_arc_2* carc = std::get_if(&seg); Circle_2 crc = carc->supporting_circle(); double sx = CGAL::to_double(((src.x()) - crc.center().x())/sqrt(crc.squared_radius())); @@ -233,7 +233,7 @@ MainWindow::animate() { // Correct in case of wrong orientation. //std::cout << " ..making line..." << std::endl; Segment_2 seg = Construct_hyperbolic_segment_2()(source, target); - Circular_arc_2* carc = boost::get(&seg); + Circular_arc_2* carc = std::get_if(&seg); std::pair inters = Construct_inexact_intersection_2()(carc->supporting_circle(), poincare); if(squared_distance(source, inters.first) < squared_distance(source, inters.second)) { source = inters.first; diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h index 8304f78bf98..9c89cc574d0 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -371,9 +371,9 @@ class Compute_approximate_hyperbolic_diameter Hyperbolic_point_2 operator()(const Hyperbolic_segment_2& s1, const Hyperbolic_segment_2& s2) { - if(Circular_arc_2* c1 = boost::get(&s1)) + if(Circular_arc_2* c1 = std::get_if(&s1)) { - if(Circular_arc_2* c2 = boost::get(&s2)) + if(Circular_arc_2* c2 = std::get_if(&s2)) { std::pair res = operator()(c1->circle(), c2->circle()); @@ -387,7 +387,7 @@ class Compute_approximate_hyperbolic_diameter } else { - Euclidean_segment_2* ell2 = boost::get(&s2); + Euclidean_segment_2* ell2 = std::get_if(&s2); std::pair res = operator()(c1->circle(), ell2->supporting_line()); Hyperbolic_point_2 p1 = res.first; @@ -401,8 +401,8 @@ class Compute_approximate_hyperbolic_diameter } else { - Euclidean_segment_2* ell1 = boost::get(&s1); - if(Circular_arc_2* c2 = boost::get(&s2)) + Euclidean_segment_2* ell1 = std::get_if(&s1); + if(Circular_arc_2* c2 = std::get_if(&s2)) { std::pair res = operator()(ell1->supporting_line(), c2->circle()); @@ -416,7 +416,7 @@ class Compute_approximate_hyperbolic_diameter } else { - Euclidean_segment_2* ell2 = boost::get(&s2); + Euclidean_segment_2* ell2 = std::get_if(&s2); Hyperbolic_point_2 p1 = operator()(ell1->supporting_line(), ell2->supporting_line()); CGAL_assertion(p1.x()*p1.x() + p1.y()*p1.y()) < FT(1); return p1; @@ -465,9 +465,9 @@ class Compute_approximate_hyperbolic_diameter Euclidean_line_2* l; Circle_2* c; - if(Circle_2* c_pq = boost::get(&bis_pq)) + if(Circle_2* c_pq = std::get_if(&bis_pq)) { - if(Circle_2* c_qr = boost::get(&bis_qr)) + if(Circle_2* c_qr = std::get_if(&bis_qr)) { std::pair inters = _gt.construct_inexact_intersection_2_object()(*c_pq, *c_qr); @@ -477,14 +477,14 @@ class Compute_approximate_hyperbolic_diameter return inters.second; } // here bis_qr is a line - l = boost::get(&bis_qr); + l = std::get_if(&bis_qr); c = c_pq; } else { // here bis_pq is a line - l = boost::get(&bis_pq); - c = boost::get(&bis_qr); + l = std::get_if(&bis_pq); + c = std::get_if(&bis_qr); } std::pair inters = _gt.construct_inexact_intersection_2_object()(*c, *l); diff --git a/Point_set_3/examples/Point_set_3/point_set_algo.cpp b/Point_set_3/examples/Point_set_3/point_set_algo.cpp index 12c98682475..19f10f5ecfb 100644 --- a/Point_set_3/examples/Point_set_3/point_set_algo.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_algo.cpp @@ -68,7 +68,7 @@ int main (int, char**) parameters.normal_threshold = 0.9; ransac.detect(parameters); - for(boost::shared_ptr shape : ransac.shapes()) + for(std::shared_ptr shape : ransac.shapes()) if (Sphere* sphere = dynamic_cast(shape.get())) std::cerr << "Detected sphere of center " << sphere->center() // Center should be approx 0, 0, 0 << " and of radius " << sphere->radius() << std::endl; // Radius should be approx 1 diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Voronoi_covariance_3/voronoi_covariance_3.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Voronoi_covariance_3/voronoi_covariance_3.h index c5f3f513700..6646bc2bbf5 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Voronoi_covariance_3/voronoi_covariance_3.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Voronoi_covariance_3/voronoi_covariance_3.h @@ -167,7 +167,7 @@ namespace CGAL { (planes.begin(), planes.end(), P, - boost::make_optional(Point(CGAL::ORIGIN))); + std::make_optional(Point(CGAL::ORIGIN))); // apply f to the triangles on the boundary of P for(typename boost::graph_traits::face_descriptor fd : faces(P)) diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 0b517436394..fbbae3fbfcf 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -58,8 +58,8 @@ is a vertex). The implementation follow \cgalCite{cgal:la-srpss-13}. \tparam Kernel a model of `EfficientRANSACTraits` that must provide in addition a function `Intersect_3 intersection_3_object() const` and a functor `Intersect_3` with: -- `boost::optional< boost::variant< Traits::Plane_3, Traits::Line_3 > > operator()(typename Traits::Plane_3, typename Traits::Plane_3)` -- `boost::optional< boost::variant< Traits::Line_3, Traits::Point_3 > > operator()(typename Traits::Line_3, typename Traits::Plane_3)` +- `std::optional< std::variant< Traits::Plane_3, Traits::Line_3 > > operator()(typename Traits::Plane_3, typename Traits::Plane_3)` +- `std::optional< std::variant< Traits::Line_3, Traits::Point_3 > > operator()(typename Traits::Line_3, typename Traits::Plane_3)` */ template @@ -808,7 +808,7 @@ private: continue; } - if (const Line* l = boost::get(&*result)) + if (const Line* l = std::get_if(&*result)) m_edges[i].support = *l; else { @@ -1029,7 +1029,7 @@ private: auto result = CGAL::intersection (plane1, ortho); if (result) { - if (const Line* l = boost::get(&*result)) + if (const Line* l = std::get_if(&*result)) { if (!(pts1.empty())) { @@ -1066,7 +1066,7 @@ private: result = CGAL::intersection (plane2,ortho); if (result) { - if (const Line* l = boost::get(&*result)) + if (const Line* l = std::get_if(&*result)) { if (!(pts2.empty())) { @@ -1193,12 +1193,12 @@ private: const auto result = CGAL::intersection(plane1, plane2); if (result) { - if (const Line* l = boost::get(&*result)) + if (const Line* l = std::get_if(&*result)) { const auto result2 = CGAL::intersection(*l, plane3); if (result2) { - if (const Point* p = boost::get(&*result2)) + if (const Point* p = std::get_if(&*result2)) m_corners[i].support = *p; else { diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_and_intersection.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_and_intersection.cpp index ffa6f9aeb2e..9148d56bd07 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_and_intersection.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_and_intersection.cpp @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) } Mesh out_union, out_intersection; - std::array, 4> output; + std::array, 4> output; output[PMP::Corefinement::UNION] = &out_union; output[PMP::Corefinement::INTERSECTION] = &out_intersection; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index 81f9438a198..8cad7f7227c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -69,7 +69,7 @@ enum Boolean_operation_type {UNION = 0, INTERSECTION=1, * \ingroup PMP_corefinement_grp * * \link coref_def_subsec corefines \endlink `tm1` and `tm2` and for each triangle mesh `tm_out` passed - * as an optional in `output` different from `boost::none`, the triangulated surface mesh + * as an optional in `output` different from `std::nullopt`, the triangulated surface mesh * \link coref_def_subsec bounding \endlink the result of a particular Boolean operation * between the volumes bounded by `tm1` and `tm2` will be put in the corresponding triangle mesh. * The positions of the meshes in the array `output` are specific to the Boolean operation to compute @@ -186,7 +186,7 @@ std::array corefine_and_compute_boolean_operations( TriangleMesh& tm1, TriangleMesh& tm2, - const std::array< boost::optional,4>& output, + const std::array< std::optional,4>& output, const NamedParameters1& np1 = parameters::default_values(), const NamedParameters2& np2 = parameters::default_values(), const std::tuple VPM_out_tuple_helper; typedef std::tuple< - boost::optional< typename std::tuple_element<0, VPM_out_tuple_helper>::type::type >, - boost::optional< typename std::tuple_element<1, VPM_out_tuple_helper>::type::type >, - boost::optional< typename std::tuple_element<2, VPM_out_tuple_helper>::type::type >, - boost::optional< typename std::tuple_element<3, VPM_out_tuple_helper>::type::type > + std::optional< typename std::tuple_element<0, VPM_out_tuple_helper>::type::type >, + std::optional< typename std::tuple_element<1, VPM_out_tuple_helper>::type::type >, + std::optional< typename std::tuple_element<2, VPM_out_tuple_helper>::type::type >, + std::optional< typename std::tuple_element<3, VPM_out_tuple_helper>::type::type > > VPM_out_tuple; VPM_out_tuple vpm_out_tuple( @@ -251,24 +251,24 @@ corefine_and_compute_boolean_operations( // for now edges in a coplanar patch are not constrained so there is nothing to constrained here // \todo marked edges from input to output are not ported - if (output[Corefinement::UNION] != boost::none) + if (output[Corefinement::UNION] != std::nullopt) if (&tm1 != *output[Corefinement::UNION]) copy_face_graph(tm1, *(*output[Corefinement::UNION]), parameters::vertex_point_map(vpm1), parameters::vertex_point_map(*std::get(vpm_out_tuple))); - if (output[Corefinement::INTERSECTION] != boost::none) + if (output[Corefinement::INTERSECTION] != std::nullopt) if (&tm1 != *output[Corefinement::INTERSECTION]) copy_face_graph(tm1, *(*output[Corefinement::INTERSECTION]), parameters::vertex_point_map(vpm1), parameters::vertex_point_map(*std::get(vpm_out_tuple))); - if (output[Corefinement::TM1_MINUS_TM2] != boost::none) + if (output[Corefinement::TM1_MINUS_TM2] != std::nullopt) if (&tm1 == *output[Corefinement::TM1_MINUS_TM2]) clear(tm1); - if (output[Corefinement::TM2_MINUS_TM1] != boost::none) + if (output[Corefinement::TM2_MINUS_TM1] != std::nullopt) if (&tm1 == *output[Corefinement::TM2_MINUS_TM1]) clear(tm1); @@ -281,22 +281,22 @@ corefine_and_compute_boolean_operations( if(faces(tm2).empty()) { for (int i=0; i<4; ++i) - if (output[i] != boost::none) + if (output[i] != std::nullopt) clear(*(*output[i])); return CGAL::make_array(true, true, true, true); } // tm2 is not empty - if (output[Corefinement::UNION] != boost::none) + if (output[Corefinement::UNION] != std::nullopt) if (&tm2 != *output[Corefinement::UNION]) copy_face_graph(tm2, *(*output[Corefinement::UNION]), parameters::vertex_point_map(vpm2), parameters::vertex_point_map(*std::get(vpm_out_tuple))); - if (output[Corefinement::INTERSECTION] != boost::none) + if (output[Corefinement::INTERSECTION] != std::nullopt) clear(*(*output[Corefinement::INTERSECTION])); - if (output[Corefinement::TM1_MINUS_TM2] != boost::none) + if (output[Corefinement::TM1_MINUS_TM2] != std::nullopt) clear(*(*output[Corefinement::TM1_MINUS_TM2])); - if (output[Corefinement::TM2_MINUS_TM1] != boost::none) + if (output[Corefinement::TM2_MINUS_TM1] != std::nullopt) if (&tm2 != *output[Corefinement::TM2_MINUS_TM1]) copy_face_graph(tm2, *(*output[Corefinement::TM2_MINUS_TM1]), @@ -308,17 +308,17 @@ corefine_and_compute_boolean_operations( if (faces(tm2).empty()) { // tm1 is not empty - if (output[Corefinement::UNION] != boost::none) + if (output[Corefinement::UNION] != std::nullopt) if (&tm1 != *output[Corefinement::UNION]) copy_face_graph(tm1, *(*output[Corefinement::UNION]), parameters::vertex_point_map(vpm1), parameters::vertex_point_map(*std::get(vpm_out_tuple))); - if (output[Corefinement::INTERSECTION] != boost::none) + if (output[Corefinement::INTERSECTION] != std::nullopt) clear(*(*output[Corefinement::INTERSECTION])); - if (output[Corefinement::TM2_MINUS_TM1] != boost::none) + if (output[Corefinement::TM2_MINUS_TM1] != std::nullopt) clear(*(*output[Corefinement::TM2_MINUS_TM1])); - if (output[Corefinement::TM1_MINUS_TM2] != boost::none) + if (output[Corefinement::TM1_MINUS_TM2] != std::nullopt) if (&tm1 != *output[Corefinement::TM1_MINUS_TM2]) copy_face_graph(tm1, *(*output[Corefinement::TM1_MINUS_TM2]), @@ -394,10 +394,10 @@ corefine_and_compute_boolean_operations( // special case used for clipping open meshes if (choose_parameter(get_parameter(np1, internal_np::use_bool_op_to_clip_surface), false)) { - CGAL_assertion(output[Corefinement::INTERSECTION] != boost::none); - CGAL_assertion(output[Corefinement::UNION] == boost::none); - CGAL_assertion(output[Corefinement::TM1_MINUS_TM2] == boost::none); - CGAL_assertion(output[Corefinement::TM2_MINUS_TM1] == boost::none); + CGAL_assertion(output[Corefinement::INTERSECTION] != std::nullopt); + CGAL_assertion(output[Corefinement::UNION] == std::nullopt); + CGAL_assertion(output[Corefinement::TM1_MINUS_TM2] == std::nullopt); + CGAL_assertion(output[Corefinement::TM2_MINUS_TM1] == std::nullopt); const bool use_compact_clipper = choose_parameter(get_parameter(np1, internal_np::use_compact_clipper), true); ob.setup_for_clipping_a_surface(use_compact_clipper); @@ -523,7 +523,7 @@ corefine_and_compute_union( TriangleMesh& tm1, const NamedParametersOut& np_out = parameters::default_values()) { using namespace CGAL::parameters; - std::array< boost::optional,4> output; + std::array< std::optional,4> output; output[Corefinement::UNION]=&tm_out; return @@ -555,7 +555,7 @@ corefine_and_compute_intersection( TriangleMesh& tm1, const NamedParametersOut& np_out = parameters::default_values()) { using namespace CGAL::parameters; - std::array< boost::optional,4> output; + std::array< std::optional,4> output; output[Corefinement::INTERSECTION]=&tm_out; return @@ -588,7 +588,7 @@ corefine_and_compute_difference( TriangleMesh& tm1, { using namespace CGAL::parameters; using namespace CGAL::Polygon_mesh_processing::Corefinement; - std::array< boost::optional,4> output; + std::array< std::optional,4> output; output[TM1_MINUS_TM2]=&tm_out; return diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h index f109adcfa0c..8b41ff2ecdb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h @@ -43,7 +43,7 @@ #include #endif // CGAL_LINKED_WITH_TBB -#include +#include #include #include @@ -1818,10 +1818,10 @@ struct Bounded_error_preprocessing #ifdef CGAL_HAUSDORFF_DEBUG using Timer = CGAL::Real_timer; #endif - std::vector& tm_wrappers; + std::vector& tm_wrappers; // Constructor. - Bounded_error_preprocessing(std::vector& tm_wrappers) + Bounded_error_preprocessing(std::vector& tm_wrappers) : tm_wrappers(tm_wrappers) { } @@ -1830,8 +1830,8 @@ struct Bounded_error_preprocessing : tm_wrappers(s.tm_wrappers) { } - bool is_tm1_wrapper(const boost::any& operand) const { return operand.type() == typeid(TM1Wrapper); } - bool is_tm2_wrapper(const boost::any& operand) const { return operand.type() == typeid(TM2Wrapper); } + bool is_tm1_wrapper(const std::any& operand) const { return operand.type() == typeid(TM1Wrapper); } + bool is_tm2_wrapper(const std::any& operand) const { return operand.type() == typeid(TM2Wrapper); } // TODO: make AABB tree build parallel! void operator()(const tbb::blocked_range& range) @@ -1849,12 +1849,12 @@ struct Bounded_error_preprocessing auto& tm_wrapper = tm_wrappers[i]; if(is_tm1_wrapper(tm_wrapper)) { - TM1Wrapper& object = boost::any_cast(tm_wrapper); + TM1Wrapper& object = std::any_cast(tm_wrapper); object.build_tree(); } else if(is_tm2_wrapper(tm_wrapper)) { - TM2Wrapper& object = boost::any_cast(tm_wrapper); + TM2Wrapper& object = std::any_cast(tm_wrapper); object.build_tree(); } else @@ -2031,7 +2031,7 @@ bounded_error_squared_one_sided_Hausdorff_distance_impl(const TriangleMesh1& tm1 std::vector tm1_parts; std::vector tm1_trees; - std::vector tm_wrappers; + std::vector tm_wrappers; #endif // defined(CGAL_LINKED_WITH_TBB) && defined(CGAL_METIS_ENABLED) #ifdef CGAL_HAUSDORFF_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index c27ae2bda3a..06200f2f19d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -181,7 +181,7 @@ class Face_graph_output_builder Node_id_map vertex_to_node_id1, vertex_to_node_id2; // output meshes - const std::array, 4>& requested_output; + const std::array, 4>& requested_output; // input meshes closed ? /// \todo do we really need this? bool is_tm1_closed; @@ -411,7 +411,7 @@ public: const VpmOutTuple& output_vpms, EdgeMarkMapTuple& out_edge_mark_maps, UserVisitor& user_visitor, - const std::array, 4 >& requested_output) + const std::array, 4 >& requested_output) : tm1(tm1), tm2(tm2) , vpm1(vpm1), vpm2(vpm2) , fids1(fids1), fids2(fids2) @@ -513,10 +513,10 @@ public: const boost::dynamic_bitset<>& is_node_of_degree_one, const Mesh_to_map_node&) { - const bool used_to_classify_patches = requested_output[UNION]==boost::none && - requested_output[TM1_MINUS_TM2]==boost::none && - requested_output[TM2_MINUS_TM1]==boost::none && - requested_output[INTERSECTION]==boost::none; + const bool used_to_classify_patches = requested_output[UNION]==std::nullopt && + requested_output[TM1_MINUS_TM2]==std::nullopt && + requested_output[TM2_MINUS_TM1]==std::nullopt && + requested_output[INTERSECTION]==std::nullopt; CGAL_assertion( vertex_to_node_id1.size() <= nodes.size() ); CGAL_assertion( vertex_to_node_id2.size() <= nodes.size() ); @@ -1680,8 +1680,8 @@ public: // special code to handle non-manifold vertices on the boundary for (vertex_descriptor vd : vertices(tm1)) { - boost::optional op_h = is_border(vd, tm1); - if (op_h == boost::none) continue; + std::optional op_h = is_border(vd, tm1); + if (op_h == std::nullopt) continue; halfedge_descriptor h = *op_h; CGAL_assertion( target(h, tm1) == vd); // check if the target of h is a non-manifold vertex diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index 7d9a37385f8..4a15d9e59c7 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -397,20 +397,20 @@ struct TweakedGetVertexPointMap }; template -boost::optional< typename TweakedGetVertexPointMap::type > -get_vpm(const NP& np, boost::optional opm, std::true_type) +std::optional< typename TweakedGetVertexPointMap::type > +get_vpm(const NP& np, std::optional opm, std::true_type) { - if (boost::none == opm) return boost::none; + if (std::nullopt == opm) return std::nullopt; return parameters::choose_parameter( parameters::get_parameter(np, internal_np::vertex_point), get_property_map(boost::vertex_point, *(*opm)) ); } template -boost::optional< typename TweakedGetVertexPointMap::type > -get_vpm(const NP&, boost::optional opm, std::false_type) +std::optional< typename TweakedGetVertexPointMap::type > +get_vpm(const NP&, std::optional opm, std::false_type) { - if (boost::none == opm) return boost::none; + if (std::nullopt == opm) return std::nullopt; return typename TweakedGetVertexPointMap::type(); } // diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h index c6f64c98322..4080ab1b682 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h @@ -265,9 +265,9 @@ public: to_exact( get(vpm, target(next(h3,tm),tm)))); const auto inter_res = exact_intersection(p1, p2, p3); - CGAL_assertion(inter_res != boost::none); + CGAL_assertion(inter_res != std::nullopt); const Exact_kernel::Point_3* pt = - boost::get(&(*inter_res)); + std::get_if(&(*inter_res)); CGAL_assertion(pt!=nullptr); add_new_node(*pt); } @@ -386,9 +386,9 @@ public: get(vpm, target(next(h3,tm),tm))); const auto inter_res = intersection(p1, p2, p3); - CGAL_assertion(inter_res != boost::none); + CGAL_assertion(inter_res != std::nullopt); const Point_3* pt = - boost::get(&(*inter_res)); + std::get_if(&(*inter_res)); CGAL_assertion(pt!=nullptr); add_new_node(*pt); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index ce906b5c954..3a323ce5312 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -797,7 +797,7 @@ public: Triangulation tr; std::vector edge_exist; std::pair range(0, n-1); - std::tuple, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist); + std::tuple, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist); if(!std::get<2>(res)) { #ifdef CGAL_HOLE_FILLING_VERBOSE #ifndef CGAL_TEST_SUITE @@ -944,14 +944,14 @@ private: } // returns [h.first-h.second edge, true if all edges inside 3D triangulation, true if tr.dimension() >= 2] - std::tuple, bool, bool> + std::tuple, bool, bool> construct_3D_triangulation(const Polyline_3& P, std::pair h, Triangulation& tr, std::vector& edge_exist) const { // construct 3D tr with P[h.first], P[h.second] also assign ids from h.first to h.second - boost::optional e; + std::optional e; int n_border = h.second - h.first + 1; tr.insert(boost::make_transform_iterator(std::next(P.begin(), h.first), Auto_count(h.first)), boost::make_transform_iterator(std::next(P.begin(), h.second +1), Auto_count(h.first))); @@ -999,7 +999,7 @@ private: * + when switched to all-space, we use map based lookup tables. ************************************************************************/ Weight fill_by_incomplete_patches(Triangulation& tr, - boost::optional start_edge, + std::optional start_edge, std::vector& edge_exist, const Polyline_3& P, const Polyline_3& Q, @@ -1072,7 +1072,7 @@ private: // construct tr for next coming hole h = remaining_holes.back(); tr.clear(); - std::tuple, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist); + std::tuple, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist); if(!std::get<0>(res)) { #ifdef CGAL_HOLE_FILLING_VERBOSE CGAL_warning_msg(false, "Returning no output. Filling hole with incomplete patches is not successful!"); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 72ef49c3996..458cdf00884 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include @@ -1944,7 +1944,7 @@ private: bool check_normals(const HalfedgeRange& hedges) const { std::size_t nb_patches = patch_id_to_index_map.size(); - //std::vector > normal_per_patch(nb_patches,boost::none); + //std::vector > normal_per_patch(nb_patches,std::nullopt); std::vector initialized(nb_patches,false); std::vector normal_per_patch(nb_patches); @@ -1968,7 +1968,7 @@ private: return false; } } - //normal_per_patch[index] = boost::make_optional(n); + //normal_per_patch[index] = std::make_optional(n); normal_per_patch[index] = n; initialized[index] = true; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h index 49cfea2a724..99483e93abc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h @@ -14,8 +14,8 @@ #include #include -#include -#include +#include +#include #ifndef CGAL_INTERNAL_POLYGON_MESH_SLICER_AXIS_PARALLEL_PLANE_TRAITS_H @@ -95,8 +95,8 @@ public: const typename Traits::Construct_source_3 m_source_3; const typename Traits::Construct_target_3 m_target_3; - typedef boost::variant Variant_type; - typedef boost::optional< Variant_type > result_type; + typedef std::variant Variant_type; + typedef std::optional< Variant_type > result_type; Intersect_3(const Axis_parallel_plane_traits& traits) : m_cst_coord(traits.m_cst_coord) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h index e282e092fa1..aabe4d20199 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -78,9 +78,9 @@ public: //the direction of the vertical ray depends on the position of the point in the bbox //in order to limit the expected number of nodes visited. Ray query = ray_functor(point, vector_functor(0,0,(2*point.z() < bbox.zmax()+bbox.zmin()?-1:1))); - boost::optional res = is_inside_ray_tree_traversal(query, tree); + std::optional res = is_inside_ray_tree_traversal(query, tree); - if(res == boost::none) + if(res == std::nullopt) { CGAL::Random rg(seed); // seed some value for make it easy to debug Random_points_on_sphere_3 random_point(1.,rg); @@ -88,14 +88,14 @@ public: do { //retry with a random ray query = ray_functor(point, vector_functor(CGAL::ORIGIN,*random_point++)); res = is_inside_ray_tree_traversal(query, tree); - } while (res == boost::none); + } while (res == std::nullopt); } return *res; } private: template - boost::optional + std::optional is_inside_ray_tree_traversal(const Ray& ray, const AABBTree& tree) const { std::pair @@ -114,7 +114,7 @@ private: //otherwise the point is on the facet return ON_BOUNDARY; } - return boost::optional(); // indeterminate + return std::optional(); // indeterminate } }; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index 0976ac2e4db..0804f769968 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -102,7 +102,7 @@ public: constrained_flags_[get(vimap_, v)] = true; // scaling things cannot preserve the position of more than a single constrained point - if(anchor_point == boost::none) + if(anchor_point == std::nullopt) anchor_point = get(vpmap_, v); else scale_volume_after_smoothing_ = false; @@ -230,7 +230,7 @@ public: // If no vertex is constrained, then the smoothed mesh will share the same centroid as the input mesh Point pre_smooth_anchor_point; - if(anchor_point != boost::none) + if(anchor_point != std::nullopt) pre_smooth_anchor_point = *anchor_point; else pre_smooth_anchor_point = PMP::centroid(mesh_, parameters::vertex_point_map(vpmap_).geom_traits(traits_)); @@ -247,7 +247,7 @@ public: } Point post_smooth_anchor_point; - if(anchor_point != boost::none) + if(anchor_point != std::nullopt) post_smooth_anchor_point = *anchor_point; else post_smooth_anchor_point = PMP::centroid(mesh_, parameters::vertex_point_map(vpmap_).geom_traits(traits_)); @@ -364,7 +364,7 @@ private: // of the initial mesh if no vertex is constrained. If there is more than a constrained vertex, // then no scaling can be done without violating the constraint. bool scale_volume_after_smoothing_; - boost::optional anchor_point; + std::optional anchor_point; // linear system data std::vector diagonal_; // index of vector -> index of vimap_ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 26d0266e03a..ef361b17529 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include @@ -52,6 +52,36 @@ namespace CGAL { namespace Polygon_mesh_processing { + +/// \ingroup PMP_locate_grp +/// +/// A variant used in the function `get_descriptor_from_location()`. +template +using descriptor_variant = std::variant::vertex_descriptor, + typename boost::graph_traits::halfedge_descriptor, + typename boost::graph_traits::face_descriptor>; + +/// \ingroup PMP_locate_grp +/// +/// A triplet of coordinates describing the barycentric coordinates of a point +/// with respect to the vertices of a triangular face. +/// +/// \sa `Face_location` +template +using Barycentric_coordinates = std::array; + +/// \ingroup PMP_locate_grp +/// +/// If `tm` is the input triangulated surface mesh and given the pair (`f`, `bc`) +/// such that `bc` is the triplet of barycentric coordinates `(w0, w1, w2)`, the correspondence +/// between the coordinates in `bc` and the vertices of the face `f` is the following: +/// - `w0` corresponds to `source(halfedge(f, tm), tm)` +/// - `w1` corresponds to `target(halfedge(f, tm), tm)` +/// - `w2` corresponds to `target(next(halfedge(f, tm), tm), tm)` +template +using Face_location = std::pair::face_descriptor, + Barycentric_coordinates >; + namespace internal { // The Ray must have the same ambient dimension as the property map's value type (aka, the point type) @@ -85,51 +115,20 @@ struct Location_traits typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef std::array Barycentric_coordinates; - typedef std::pair Face_location; + typedef CGAL::Polygon_mesh_processing::Barycentric_coordinates Barycentric_coordinates; + typedef CGAL::Polygon_mesh_processing::Face_location Face_location; }; } // end namespace internal -/// \ingroup PMP_locate_grp -/// -/// A variant used in the function `get_descriptor_from_location()`. -template -using descriptor_variant = boost::variant::vertex_descriptor, - typename boost::graph_traits::halfedge_descriptor, - typename boost::graph_traits::face_descriptor>; - -/// \ingroup PMP_locate_grp -/// -/// A triplet of coordinates describing the barycentric coordinates of a point -/// with respect to the vertices of a triangular face. -/// -/// \sa `Face_location` -template -using Barycentric_coordinates = std::array; - -/// \ingroup PMP_locate_grp -/// -/// If `tm` is the input triangulated surface mesh and given the pair (`f`, `bc`) -/// such that `bc` is the triplet of barycentric coordinates `(w0, w1, w2)`, the correspondence -/// between the coordinates in `bc` and the vertices of the face `f` is the following: -/// - `w0` corresponds to `source(halfedge(f, tm), tm)` -/// - `w1` corresponds to `target(halfedge(f, tm), tm)` -/// - `w2` corresponds to `target(next(halfedge(f, tm), tm), tm)` -template -using Face_location = std::pair::face_descriptor, - Barycentric_coordinates >; - // forward declarations template -bool is_in_face(const std::pair::face_descriptor, - std::array >& loc, +bool is_in_face(const Face_location& loc, const TriangleMesh& tm); template descriptor_variant -get_descriptor_from_location(const std::pair::face_descriptor, - std::array >& loc, +get_descriptor_from_location(const Face_location& loc, const TriangleMesh& tm); // end of forward declarations @@ -138,8 +137,7 @@ namespace internal { template OutputIterator -incident_faces(const std::pair::face_descriptor, - std::array >& location, +incident_faces(const Face_location& loc, const TriangleMesh& tm, OutputIterator out) { @@ -147,15 +145,15 @@ incident_faces(const std::pair::face_ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; - const descriptor_variant dv = get_descriptor_from_location(location, tm); + const descriptor_variant dv = get_descriptor_from_location(loc, tm); - if(const vertex_descriptor* vd_ptr = boost::get(&dv)) + if(const vertex_descriptor* vd_ptr = std::get_if(&dv)) { const vertex_descriptor vd = *vd_ptr; for(face_descriptor fd : faces_around_target(halfedge(vd, tm), tm)) *out++ = fd; } - else if(const halfedge_descriptor* hd_ptr = boost::get(&dv)) + else if(const halfedge_descriptor* hd_ptr = std::get_if(&dv)) { const halfedge_descriptor hd = *hd_ptr; *out++ = face(hd, tm); @@ -163,7 +161,7 @@ incident_faces(const std::pair::face_ } else { - const face_descriptor fd = boost::get(dv); + const face_descriptor fd = std::get(dv); *out++ = fd; } @@ -173,7 +171,7 @@ incident_faces(const std::pair::face_ // Snapping coordinates for robustness template bool -snap_coordinates_to_border(std::array& coords, +snap_coordinates_to_border(Barycentric_coordinates& coords, const FT tolerance = std::numeric_limits::epsilon()) { #ifdef CGAL_PMP_LOCATE_DEBUG @@ -224,8 +222,7 @@ snap_coordinates_to_border(std::array& coords, template bool -snap_location_to_border(std::pair::face_descriptor, - std::array >& loc, +snap_location_to_border(Face_location& loc, const TriangleMesh /*tm*/, const FT tolerance = std::numeric_limits::epsilon()) { @@ -235,7 +232,7 @@ snap_location_to_border(std::pair::fa template struct Barycentric_coordinate_calculator // 2D version { - std::array + Barycentric_coordinates operator()(const P& ip, const P& iq, const P& ir, const P& iquery, const K& k) const { typedef typename K::FT FT; @@ -273,7 +270,7 @@ struct Barycentric_coordinate_calculator // 2D version template struct Barycentric_coordinate_calculator { - std::array + Barycentric_coordinates operator()(const P& ip, const P& iq, const P& ir, const P& iquery, const K& k) const { typedef typename K::FT FT; @@ -364,7 +361,7 @@ struct Barycentric_point_constructor // 3D version /// \pre `query` lies on the plane defined by `p`, `q`, and `r`. /// template -std::array +Barycentric_coordinates barycentric_coordinates(const Point& p, const Point& q, const Point& r, const Point& query, const GeomTraits& gt) { @@ -373,7 +370,7 @@ barycentric_coordinates(const Point& p, const Point& q, const Point& r, const Po } template -std::array::type::FT, 3> +Barycentric_coordinates::type::FT> barycentric_coordinates(const Point& p, const Point& q, const Point& r, const Point& query) { typedef typename CGAL::Kernel_traits::type Kernel; @@ -411,7 +408,7 @@ random_location_on_halfedge(typename boost::graph_traits::halfedge const int h_id = halfedge_index_in_face(hd, tm); const FT t(rnd.uniform_real(0., 1.)); - std::array coordinates; + Barycentric_coordinates coordinates; coordinates[h_id] = t; coordinates[(h_id+1)%3] = FT(1)-t; coordinates[(h_id+2)%3] = FT(0); @@ -510,8 +507,7 @@ descriptor_variant #ifdef DOXYGEN_RUNNING // just for convenience because template alias do not allow template deduction get_descriptor_from_location(const Face_location& loc, #else -get_descriptor_from_location(const std::pair::face_descriptor, - std::array >& loc, +get_descriptor_from_location(const Face_location& loc, #endif const TriangleMesh& tm) { @@ -589,12 +585,10 @@ get_descriptor_from_location(const std::pair #ifdef DOXYGEN_RUNNING Point -construct_point(const Face_location& loc, #else typename internal::Location_traits::Point -construct_point(const std::pair::face_descriptor, - std::array >& loc, #endif +construct_point(const Face_location& loc, const TriangleMesh& tm, const NamedParameters& np = parameters::default_values()) { @@ -648,12 +642,7 @@ construct_point(const std::pair::face /// template bool -#ifdef DOXYGEN_RUNNING is_on_vertex(const Face_location& loc, -#else -is_on_vertex(const std::pair::face_descriptor, - std::array >& loc, -#endif const typename boost::graph_traits::vertex_descriptor vd, const TriangleMesh& tm) { @@ -664,7 +653,7 @@ is_on_vertex(const std::pair::face_de const descriptor_variant dv = get_descriptor_from_location(loc, tm); - if(const vertex_descriptor* vd_ptr = boost::get(&dv)) + if(const vertex_descriptor* vd_ptr = std::get_if(&dv)) return (vd == *vd_ptr); return false; @@ -692,12 +681,7 @@ is_on_vertex(const std::pair::face_de /// template bool -#ifdef DOXYGEN_RUNNING is_on_halfedge(const Face_location& loc, -#else -is_on_halfedge(const std::pair::face_descriptor, - std::array >& loc, -#endif const typename boost::graph_traits::halfedge_descriptor hd, const TriangleMesh& tm) { @@ -709,9 +693,9 @@ is_on_halfedge(const std::pair::face_ const descriptor_variant dv = get_descriptor_from_location(loc, tm); - if(const vertex_descriptor* vd_ptr = boost::get(&dv)) + if(const vertex_descriptor* vd_ptr = std::get_if(&dv)) return (*vd_ptr == source(hd, tm) || *vd_ptr == target(hd, tm)); - else if(const halfedge_descriptor* hd_ptr = boost::get(&dv)) + else if(const halfedge_descriptor* hd_ptr = std::get_if(&dv)) return (*hd_ptr == hd); return false; @@ -738,11 +722,7 @@ is_on_halfedge(const std::pair::face_ /// template bool -#ifdef DOXYGEN_RUNNING is_in_face(const Barycentric_coordinates& bar, -#else -is_in_face(const std::array& bar, -#endif const TriangleMesh& tm) { CGAL_USE(tm); @@ -780,12 +760,7 @@ is_in_face(const std::array& bar, /// template bool -#ifdef DOXYGEN_RUNNING is_in_face(const Face_location& loc, -#else -is_in_face(const std::pair::face_descriptor, - std::array >& loc, -#endif const TriangleMesh& tm) { return is_in_face(loc.second, tm); @@ -812,12 +787,7 @@ is_in_face(const std::pair::face_desc /// template bool -#ifdef DOXYGEN_RUNNING is_on_face_border(const Face_location& loc, -#else -is_on_face_border(const std::pair::face_descriptor, - std::array >& loc, -#endif const TriangleMesh& tm) { if(!is_in_face(loc, tm)) @@ -853,12 +823,7 @@ is_on_face_border(const std::pair::fa /// template bool -#ifdef DOXYGEN_RUNNING is_on_mesh_border(const Face_location& loc, -#else -is_on_mesh_border(const std::pair::face_descriptor, - std::array >& loc, -#endif const TriangleMesh& tm) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -1136,7 +1101,7 @@ locate_in_face(const typename internal::Location_traits coords = barycentric_coordinates(p0, p1, p2, query, gt); + Barycentric_coordinates coords = barycentric_coordinates(p0, p1, p2, query, gt); if(snap_tolerance != FT(0) && !is_in_face(coords, tm)) { @@ -1174,12 +1139,7 @@ locate_in_face(const typename internal::Location_traits Face_location -#ifdef DOXYGEN_RUNNING locate_in_adjacent_face(const Face_location& loc, -#else -locate_in_adjacent_face(const std::pair::face_descriptor, - std::array >& loc, -#endif const typename boost::graph_traits::face_descriptor fd, const TriangleMesh& tm) { @@ -1193,14 +1153,14 @@ locate_in_adjacent_face(const std::pair loc_in_fd = std::make_pair(fd, CGAL::make_array(FT(0), FT(0), FT(0))); const descriptor_variant dv = get_descriptor_from_location(loc, tm); - if(const vertex_descriptor* vd_ptr = boost::get(&dv)) + if(const vertex_descriptor* vd_ptr = std::get_if(&dv)) { int index_of_vd = vertex_index_in_face(*vd_ptr, fd, tm); loc_in_fd.second[index_of_vd] = FT(1); // Note that the barycentric coordinates were initialized to 0, // so the second and third coordinates are already set up properly. } - else if(const halfedge_descriptor* hd_ptr = boost::get(&dv)) + else if(const halfedge_descriptor* hd_ptr = std::get_if(&dv)) { // Note that, here, we know that we are _not_ on a vertex const halfedge_descriptor hd = *hd_ptr; @@ -1225,7 +1185,7 @@ locate_in_adjacent_face(const std::pair(dv);) + CGAL_assertion_code(const face_descriptor fd2 = std::get(dv);) CGAL_assertion(fd2 != boost::graph_traits::null_face()); CGAL_assertion(fd2 != fd); @@ -1247,11 +1207,9 @@ locate_in_adjacent_face(const std::pair bool -locate_in_common_face(std::pair::face_descriptor, - std::array >& known_location, +locate_in_common_face(Face_location& known_location, const typename internal::Location_traits::Point& query, - std::pair::face_descriptor, - std::array >& query_location, + Face_location& query_location, const TriangleMesh& tm, const NamedParameters& np, const FT tolerance = std::numeric_limits::epsilon()) @@ -1264,7 +1222,7 @@ locate_in_common_face(std::pair::face bool is_query_location_in_face = false; - if(const vertex_descriptor* vd_ptr = boost::get(&dv)) + if(const vertex_descriptor* vd_ptr = std::get_if(&dv)) { const vertex_descriptor vd = *vd_ptr; halfedge_descriptor hd = halfedge(vd, tm); @@ -1284,7 +1242,7 @@ locate_in_common_face(std::pair::face break; } } - else if(const halfedge_descriptor* hd_ptr = boost::get(&dv)) + else if(const halfedge_descriptor* hd_ptr = std::get_if(&dv)) { const halfedge_descriptor hd = *hd_ptr; if(!is_border(hd, tm)) @@ -1304,7 +1262,7 @@ locate_in_common_face(std::pair::face } else { - const face_descriptor fd = boost::get(dv); + const face_descriptor fd = std::get(dv); CGAL_precondition(fd != boost::graph_traits::null_face()); query_location = locate_in_face(query, fd, tm, np); @@ -1323,10 +1281,8 @@ locate_in_common_face(std::pair::face // - both locations must be known but can change template bool -locate_in_common_face(std::pair::face_descriptor, - std::array >& first_location, - std::pair::face_descriptor, - std::array >& second_location, +locate_in_common_face(Face_location& first_location, + Face_location& second_location, const TriangleMesh& tm) { typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -1846,7 +1802,7 @@ locate_with_AABB_tree(const typename internal::Location_traits AABB_traits; typedef AABB_tree AABB_face_graph_tree; typedef typename AABB_face_graph_tree::template Intersection_and_primitive_id::Type Intersection_type; - typedef boost::optional Ray_intersection; + typedef std::optional Ray_intersection; using parameters::get_parameter; using parameters::choose_parameter; @@ -1866,7 +1822,7 @@ locate_with_AABB_tree(const typename internal::Location_traits(&(intersections[i]->first)); + Point_3* intersection_point = std::get_if(&(intersections[i]->first)); if(intersection_point) { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h index 2ffc899b549..de2bcab9c1c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h @@ -39,10 +39,10 @@ namespace CGAL { namespace Polygon_mesh_processing { /** \ingroup PMP_orientation_grp + * * Default visitor model of `PMPPolygonSoupOrientationVisitor`. * All of its functions have an empty body. This class can be used as a - * base class if only some of the functions of the concept require to be - * overridden. + * base class if only some of the functions of the concept will be overridden. */ struct Default_orientation_visitor{ void non_manifold_edge(std::size_t, std::size_t, std::size_t){} @@ -483,12 +483,22 @@ struct Polygon_soup_orienter * * \brief tries to consistently orient a soup of polygons in 3D space. * - * When it is not possible to produce a combinatorial manifold surface, + * The algorithm re-orients polygons such that the orientation + * of adjacent polygons is consistent. Note that the adjacency is + * defined in a combinatorial sense, i.e. two polygons are sharing + * an edge if and only if the endpoints of this edge are represented + * by the same point indices in both faces (possibly in a different order); + * it is not sufficient for the points to be geometrically identical. + * One may use `CGAL::Polygon_mesh_processing::merge_duplicate_points_in_polygon_soup()` + * to convert geometrical point equality into combinatorial point equality. + * + * When it is not possible to produce a combinatorial manifold surface + * (for example, if the polygon soup makes up a Möbius strip), * some points are duplicated. * Because a polygon soup does not have any connectivity (each point * has as many occurrences as the number of polygons it belongs to), * duplicating one point (or a pair of points) - * amounts to duplicate the polygon to which it belongs. + * amounts to duplicating the polygon to which it belongs. * * These points are either an endpoint of an edge incident to more * than two polygons, an endpoint of an edge between @@ -521,7 +531,7 @@ struct Polygon_soup_orienter * \cgalNamedParamsEnd * * @return `true` if the orientation operation succeeded. - * @return `false` if some points were duplicated, thus producing a self-intersecting polyhedron. + * @return `false` if some points were duplicated, thus producing a combinatorially manifold but self-intersecting polyhedron. * * @sa `orient_triangle_soup_with_reference_triangle_mesh()` */ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 40f480cbb7c..c71a5d4c806 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -197,7 +197,7 @@ bool is_collapse_geometrically_valid(typename boost::graph_traits: // @todo handle boundary edges template -boost::optional +std::optional get_collapse_volume(typename boost::graph_traits::halfedge_descriptor h, const TriangleMesh& tmesh, const VPM& vpm, @@ -244,7 +244,7 @@ get_collapse_volume(typename boost::graph_traits::halfedge_descrip Vector_3 n1 = gt.construct_cross_product_vector_3_object()(v_ar, v_ab); Vector_3 n2 = gt.construct_cross_product_vector_3_object()(v_ak, v_ab); if(gt.compute_scalar_product_3_object()(n1, n2) <= 0) - return boost::none; + return std::nullopt; delta_vol += volume(b, a, removed, origin) + volume(a, b, kept, origin); // opposite orientation } @@ -268,27 +268,27 @@ get_best_edge_orientation(typename boost::graph_traits::edge_descr halfedge_descriptor h = halfedge(e, tmesh), ho = opposite(h, tmesh); - boost::optional dv1 = get_collapse_volume(h, tmesh, vpm, gt); - boost::optional dv2 = get_collapse_volume(ho, tmesh, vpm, gt); + std::optional dv1 = get_collapse_volume(h, tmesh, vpm, gt); + std::optional dv2 = get_collapse_volume(ho, tmesh, vpm, gt); // the resulting point of the collapse of a halfedge is the target of the halfedge before collapse if(get(vcm, source(h, tmesh))) - return dv2 != boost::none ? ho + return dv2 != std::nullopt ? ho : boost::graph_traits::null_halfedge(); if(get(vcm, target(h, tmesh))) - return dv1 != boost::none ? h + return dv1 != std::nullopt ? h : boost::graph_traits::null_halfedge(); - if(dv1 != boost::none) + if(dv1 != std::nullopt) { - if(dv2 != boost::none) + if(dv2 != std::nullopt) return (*dv1 < *dv2) ? h : ho; return h; } - if(dv2 != boost::none) + if(dv2 != std::nullopt) return ho; return boost::graph_traits::null_halfedge(); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h index d14e513d347..fe680d00718 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h @@ -218,6 +218,7 @@ void tangential_relaxation(const VertexRange& vertices, typedef std::tuple VNP; std::vector< VNP > barycenters; auto gt_barycenter = gt.construct_barycenter_3_object(); + auto gt_project = gt.construct_projected_point_3_object(); // at each vertex, compute vertex normal std::unordered_map vnormals; @@ -269,8 +270,19 @@ void tangential_relaxation(const VertexRange& vertices, //check squared cosine is < 0.25 (~120 degrees) if (0.25 < dot*dot / ( squared_distance(get(vpm,ph0), get(vpm, v)) * squared_distance(get(vpm,ph1), get(vpm, v))) ) - barycenters.emplace_back(v, vn, - gt_barycenter(get(vpm, ph0), 0.25, get(vpm, ph1), 0.25, get(vpm, v), 0.5)); + { + typename GT::Point_3 bary = gt_barycenter(get(vpm, ph0), 0.25, get(vpm, ph1), 0.25, get(vpm, v), 0.5); + // to avoid shrinking of borders, we project back onto the incident segments + typename GT::Segment_3 s1(get(vpm, ph0), get(vpm,v)), + s2(get(vpm, ph1), get(vpm,v)); + + typename GT::Point_3 p1 = gt_project(s1, bary), p2 = gt_project(s2, bary); + + bary = squared_distance(p1, bary) #include -#include +#include #include #include @@ -63,7 +63,7 @@ namespace CGAL { /// - `Point_3` /// - `Segment_3` /// - `Oriented_side_3` with `Oriented_side operator()(Plane_3, Point_3)` -/// - `Do_intersect_3` with `boost::optional operator()(Plane_3,Segment_3)` +/// - `Do_intersect_3` with `std::optional operator()(Plane_3,Segment_3)` /// - `Do_intersect_3` with `bool operator()(Plane_3, Bbox_3)` /// /// \todo If we keep the traits for plane orthogonal to a frame axis, `Traits` must also provide: @@ -102,7 +102,7 @@ class Polygon_mesh_slicer typedef typename Traits::FT FT; /// typedefs for internal graph to get connectivity of the polylines - typedef boost::variant AL_vertex_info; + typedef std::variant AL_vertex_info; typedef boost::adjacency_list < boost::vecS, boost::vecS, @@ -181,9 +181,9 @@ class Polygon_mesh_slicer AL_vertex_info v1 = al_graph[nodes_for_orient.first]; AL_vertex_info v2 = al_graph[nodes_for_orient.second]; - if (const vertex_descriptor* vd1_ptr = boost::get(&v1) ) + if (const vertex_descriptor* vd1_ptr = std::get_if(&v1) ) { - if (const vertex_descriptor* vd2_ptr = boost::get(&v2) ) + if (const vertex_descriptor* vd2_ptr = std::get_if(&v2) ) { CGAL_assertion( halfedge(*vd1_ptr, *vd2_ptr, m_tmesh).second ); halfedge_descriptor h_opp = halfedge(*vd1_ptr, *vd2_ptr, m_tmesh).first; @@ -207,7 +207,7 @@ class Polygon_mesh_slicer else { // e2 is intersected in its interior - edge_descriptor e2 = boost::get(v2); + edge_descriptor e2 = std::get(v2); halfedge_descriptor h2 = halfedge(e2, m_tmesh); if ( target(next(h2, m_tmesh), m_tmesh) != *vd1_ptr ) h2=opposite(h2, m_tmesh); @@ -216,9 +216,9 @@ class Polygon_mesh_slicer } else { - edge_descriptor e1 = boost::get(v1); + edge_descriptor e1 = std::get(v1); halfedge_descriptor h1 = halfedge(e1, m_tmesh); - if (const vertex_descriptor* vd2_ptr = boost::get(&v2) ) + if (const vertex_descriptor* vd2_ptr = std::get_if(&v2) ) { // e1 is intersected in its interior if ( target(next(h1, m_tmesh), m_tmesh) != *vd2_ptr ) @@ -228,7 +228,7 @@ class Polygon_mesh_slicer else { // intersection in the interior of both edges - edge_descriptor e2 = boost::get(v2); + edge_descriptor e2 = std::get(v2); halfedge_descriptor h2 = halfedge(e2, m_tmesh); if ( face(h1, m_tmesh) != face(h2,m_tmesh) ) { @@ -265,20 +265,20 @@ class Polygon_mesh_slicer nodes_for_orient.second=node_id; AL_vertex_info v = al_graph[node_id]; - if (const vertex_descriptor* vd_ptr = boost::get(&v) ) + if (const vertex_descriptor* vd_ptr = std::get_if(&v) ) { current_poly.push_back( get(m_vpmap, *vd_ptr) ); } else { - edge_descriptor ed = boost::get(v); + edge_descriptor ed = std::get(v); Segment_3 s( get(m_vpmap, source(ed, m_tmesh)), get(m_vpmap,target(ed, m_tmesh)) ); const auto inter = intersect_3(m_plane, s); - CGAL_assertion(inter != boost::none); - const Point_3* pt_ptr = boost::get(&(*inter)); + CGAL_assertion(inter != std::nullopt); + const Point_3* pt_ptr = std::get_if(&(*inter)); current_poly.push_back( *pt_ptr ); } } diff --git a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h index c8a311a37ae..7a377a935c9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h +++ b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h @@ -825,7 +825,7 @@ private: for (unsigned int i = 0; i < cutp.size(); i++){ const Plane& plane_i = prism[cutp[i]]; - boost::optional op = intersection_point_for_polyhedral_envelope(line, plane_i.eplane); + std::optional op = intersection_point_for_polyhedral_envelope(line, plane_i.eplane); if(! op){ std::cout << "there must be an intersection 2" << std::endl; } @@ -950,7 +950,7 @@ private: } for (unsigned int j = 0; j < cidl.size(); j++) { - boost::optional op = intersection_point_for_polyhedral_envelope(line, + std::optional op = intersection_point_for_polyhedral_envelope(line, halfspace[prismindex[queue[i]]][cidl[j]].eplane); const ePoint_3& ip = *op; inter = Implicit_Seg_Facet_interpoint_Out_Prism_return_local_id @@ -1142,7 +1142,7 @@ private: const Plane& plane_i = prism[cutp[i]]; const eLine_3& eline = *(seg[k]); - boost::optional op = intersection_point_for_polyhedral_envelope(eline, plane_i.eplane); + std::optional op = intersection_point_for_polyhedral_envelope(eline, plane_i.eplane); if(! op){ #ifdef CGAL_ENVELOPE_DEBUG std::cout << "there must be an intersection 6" << std::endl; @@ -1227,7 +1227,7 @@ private: } - boost::optional ipp = intersection_point_for_polyhedral_envelope(tri_eplane, prism[cutp[i]].eplane, prism[cutp[j]].eplane); + std::optional ipp = intersection_point_for_polyhedral_envelope(tri_eplane, prism[cutp[i]].eplane, prism[cutp[j]].eplane); if(ipp){ inter = is_3_triangle_cut_float_fast(etri0, etri1, etri2, n, @@ -1667,7 +1667,7 @@ private: if (!cut) continue; for (unsigned int j = 0; j < cidl.size(); j++) { - boost::optional op = intersection_point_for_polyhedral_envelope(eline, + std::optional op = intersection_point_for_polyhedral_envelope(eline, halfspace[prismindex[queue[i]]][cidl[j]].eplane); const ePoint_3& ip = *op; inter = Implicit_Seg_Facet_interpoint_Out_Prism_return_local_id(ip, idlist, jump1, check_id); @@ -1751,7 +1751,7 @@ private: } // now we know that there exists an intesection point - boost::optional op = intersection_point_for_polyhedral_envelope(eline, + std::optional op = intersection_point_for_polyhedral_envelope(eline, halfspace[filtered_intersection[queue[i]]][intersect_face[queue[i]][j]].eplane); const ePoint_3& ip = *op; @@ -1834,7 +1834,7 @@ private: // We moved the intersection here // In case there is no intersection point we continue - boost::optional + std::optional op = intersection_point_for_polyhedral_envelope(etriangle_eplane, halfspace[jump1][intersect_face[queue[i]][k]].eplane, halfspace[jump2][intersect_face[queue[j]][h]].eplane); @@ -2113,7 +2113,7 @@ private: } ePoint_3 origin(env_vertices[env_faces[i][0]].x(), env_vertices[env_faces[i][0]].y(),env_vertices[env_faces[i][0]].z()); Surface_mesh esm; - halfspace_intersection_3(eplanes.begin(),eplanes.end(),esm , boost::make_optional(origin)); + halfspace_intersection_3(eplanes.begin(),eplanes.end(),esm , std::make_optional(origin)); copy_face_graph(esm,sm); } diff --git a/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h b/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h index 89e28153408..eff54edea7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h @@ -99,7 +99,7 @@ class Side_of_triangle_mesh typename GeomTraits::Construct_ray_3 ray_functor; typename GeomTraits::Construct_vector_3 vector_functor; const TriangleMesh* tm_ptr; - boost::optional opt_vpm; + std::optional opt_vpm; bool own_tree; CGAL::Bbox_3 box; #ifdef CGAL_HAS_THREADS @@ -255,7 +255,7 @@ public: CGAL_SCOPED_LOCK(tree_mutex); tree_ptr = const_cast(atomic_tree_ptr.load(std::memory_order_relaxed)); #endif - CGAL_assertion(tm_ptr != nullptr && opt_vpm!=boost::none); + CGAL_assertion(tm_ptr != nullptr && opt_vpm!=std::nullopt); if (tree_ptr==nullptr) { tree_ptr = new AABB_tree(faces(*tm_ptr).first, @@ -297,7 +297,7 @@ public: CGAL_SCOPED_LOCK(tree_mutex); tree_ptr = const_cast(atomic_tree_ptr.load(std::memory_order_relaxed)); #endif - CGAL_assertion(tm_ptr != nullptr && opt_vpm!=boost::none); + CGAL_assertion(tm_ptr != nullptr && opt_vpm!=std::nullopt); if (tree_ptr==nullptr) { tree_ptr = new AABB_tree(faces(*tm_ptr).first, diff --git a/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h b/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h index 458fc0a703c..83562f64601 100644 --- a/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h +++ b/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -34,8 +34,8 @@ namespace internal { struct Dummy_filter2 { template inline - const boost::optional - operator()(const Profile&, const boost::optional& op) const + const std::optional + operator()(const Profile&, const std::optional& op) const { return op; } @@ -109,8 +109,8 @@ public: template - boost::optional - operator()(const Profile& profile, boost::optional op) const + std::optional + operator()(const Profile& profile, std::optional op) const { typedef typename Profile::Point Point; typedef typename Profile::vertex_descriptor_vector Link; @@ -127,7 +127,7 @@ public: if(! (*m_envelope)(p)){ // the new placement is outside envelope - return boost::none; + return std::nullopt; } const Link link = profile.link(); @@ -141,7 +141,7 @@ public: if(! (*m_envelope)(p, pv, pw)){ // the triangle intersects the envelope - return boost::none; + return std::nullopt; } pv = pw; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp index 1eec758737e..6508c453337 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp @@ -164,11 +164,10 @@ void test_bool_op_no_copy( assert( count_constrained_edges(tm1, ecm1)==307 ); assert( count_constrained_edges(tm2, ecm2)==307 ); - typedef boost::optional OTM; - Triangle_mesh *ptr = nullptr; + typedef std::optional OTM; const std::array output = - reverse ? CGAL::make_array(OTM(&tm2), OTM(&tm1), boost::make_optional(false,ptr), boost::make_optional(false,ptr)) - : CGAL::make_array(OTM(&tm1), OTM(&tm2), boost::make_optional(false,ptr), boost::make_optional(false,ptr)); + reverse ? CGAL::make_array(OTM(&tm2), OTM(&tm1), std::optional(), std::optional()) + : CGAL::make_array(OTM(&tm1), OTM(&tm2), std::optional(), std::optional()); PMP::corefine_and_compute_boolean_operations(tm1, tm2, output, diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cpp index 244c4601cc0..8356106a9b1 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cpp @@ -97,7 +97,7 @@ void run_boolean_operations( { std::cout << "Scenario #" << id << " - " << scenario << "\n"; - typedef boost::optional OSM; + typedef std::optional OSM; std::array output; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp index 60c14ec9604..d0554ebc9a6 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -209,19 +209,19 @@ void test_constructions(const G& g, // --------------------------------------------------------------------------- loc = std::make_pair(f, CGAL::make_array(FT(0.3), FT(0.4), FT(0.3))); descriptor_variant dv = PMP::get_descriptor_from_location(loc, g); - const face_descriptor* fd = boost::get(&dv); + const face_descriptor* fd = std::get_if(&dv); assert(fd); loc = std::make_pair(f, CGAL::make_array(FT(0.5), FT(0.5), FT(0))); dv = PMP::get_descriptor_from_location(loc, g); - const halfedge_descriptor* hd = boost::get(&dv); + const halfedge_descriptor* hd = std::get_if(&dv); assert(hd); loc = std::make_pair(f, CGAL::make_array(FT(1), FT(0), FT(0))); assert(PMP::is_on_vertex(loc, source(halfedge(f, g), g), g)); dv = PMP::get_descriptor_from_location(loc, g); - if(const vertex_descriptor* v = boost::get(&dv)) { } else { assert(false); } + if(const vertex_descriptor* v = std::get_if(&dv)) { } else { assert(false); } // --------------------------------------------------------------------------- // just to check the API @@ -393,8 +393,8 @@ void test_predicates(const G& g, CGAL::Random& rnd) loc.second[id_of_h] = FT(1); loc.second[(id_of_h+1)%3] = FT(0); loc.second[(id_of_h+2)%3] = FT(0); - boost::optional opt_hd = CGAL::is_border(source(h, g), g); - assert(PMP::is_on_mesh_border(loc, g) == (opt_hd != boost::none)); + std::optional opt_hd = CGAL::is_border(source(h, g), g); + assert(PMP::is_on_mesh_border(loc, g) == (opt_hd != std::nullopt)); loc.second[id_of_h] = FT(0.5); loc.second[(id_of_h+1)%3] = FT(0.5); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 99c722048ee..111238006ce 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1267,7 +1267,7 @@ void MainWindow::open(QString filename) bool MainWindow::open(QString filename, QString loader_name) { QFileInfo fileinfo(filename); - boost::optional item_opt; + std::optional item_opt; try { item_opt = wrap_a_call_to_cpp ([this, fileinfo, loader_name]() @@ -1890,7 +1890,7 @@ void MainWindow::closeEvent(QCloseEvent *event) bool MainWindow::loadScript(QString filename) { QFileInfo fileinfo(filename); - boost::optional opt = wrap_a_call_to_cpp + std::optional opt = wrap_a_call_to_cpp ([this, fileinfo] { return loadScript(fileinfo); }, this, __FILE__, __LINE__, CGAL::Three::PARENT_CONTEXT); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h index 224a66d20c7..ef4d006e2ce 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h @@ -98,7 +98,7 @@ class Cluster_classification : public Item_classification_base void add_cluster_features () { - m_eigen = boost::make_shared + m_eigen = std::make_shared (Local_eigen_analysis::create_from_point_clusters(m_clusters, Concurrency_tag())); @@ -388,7 +388,7 @@ class Cluster_classification : public Item_classification_base int m_index_color; - boost::shared_ptr m_eigen; + std::shared_ptr m_eigen; bool m_input_is_las; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp index 7ba691b6cf1..fc6d564379b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp @@ -605,18 +605,25 @@ private: sm_item->setRenderingMode(GouraudPlusEdges); sm_item->redraw(); - scene->addItem(heat_item); - scene->setSelectedItem(scene->item_id(sm_item)); + auto heat_item_id = scene->addItem(heat_item); + scene->setSelectedItem(heat_item_id); // any change of sm_item destroys everything - connect(sm_item, &Scene_surface_mesh_item::itemChanged, - this, [this, sm_item, heat_item]() - { - sm_item->resetColors(); - removePluginProperties(sm_item); - scene->erase(scene->item_id(heat_item)); - onItemIndicesSelected(scene->selectionIndices()); - }); + + // @todo do not emit itemChanged when the colors are reset + // @todo with qt6, single connection can be performed with `static_cast(Qt::SingleShotConnection)` + // see https://www.kdab.com/single-shot-connections/ + auto connection = std::make_shared(); + *connection = connect(sm_item, &Scene_surface_mesh_item::itemChanged, + this, [this, sm_item, heat_item, connection]() + { + QObject::disconnect(*connection); + + sm_item->resetColors(); + removePluginProperties(sm_item); + scene->erase(scene->item_id(heat_item)); + onItemIndicesSelected(scene->selectionIndices()); + }); connect(sm_item, &Scene_surface_mesh_item::aboutToBeDestroyed, this, [this, heat_item]() @@ -765,7 +772,8 @@ private Q_SLOTS: Scene_polyhedron_selection_item* source_vertices = new Scene_polyhedron_selection_item(sm_item, mw); source_vertices->setName(tr("%1 (source vertices)").arg(sm_item->name())); - scene->addItem(source_vertices); + auto source_vertices_id = scene->addItem(source_vertices); + scene->setSelectedItem(source_vertices_id); link_mesh_and_selection(sm_item, source_vertices); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp index 9139fdd2590..4cadd392fd3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -265,7 +265,7 @@ struct Fake_mesh_domain { typedef std::pair Surface_patch_index; typedef int Curve_index; typedef int Corner_index; - typedef boost::variant Index; + typedef std::variant Index; }; typedef Geom_traits Fake_gt; @@ -417,12 +417,12 @@ struct Update_vertex case 2: { const typename V1::Index& index = v1.index(); - const Sp_index sp_index = boost::get(index); + const Sp_index sp_index = std::get(index); v2.set_index((std::max)(sp_index.first, sp_index.second)); } break; default:// -1, 0, 1, 3 - v2.set_index(boost::get(v1.index())); + v2.set_index(std::get(v1.index())); } return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index bd5f0eb143f..80eedf998fa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -68,7 +68,7 @@ #include #include -#include +#include #include #include @@ -120,13 +120,13 @@ Q_SIGNALS: void x(QString); public: - void setIC(const IntConverter& x) { ic = x; fc = boost::optional(); } - void setFC(const DoubleConverter& x) { fc = x; ic = boost::optional(); } + void setIC(const IntConverter& x) { ic = x; fc = std::optional(); } + void setFC(const DoubleConverter& x) { fc = x; ic = std::optional(); } void setViewer(Viewer_interface* viewer) { this->viewer = viewer; } private: - boost::optional ic; - boost::optional fc; + std::optional ic; + std::optional fc; Viewer_interface* viewer; void getPixel(const QPoint& e) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 64ffff89444..9257317215e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -29,7 +29,7 @@ auto make_not_null(T&& t) { } #include -#include +#include #include "Scene_polylines_item.h" #ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS @@ -135,7 +135,7 @@ public: } public Q_SLOTS: - boost::optional get_items_or_return_error_string() const; + std::optional get_items_or_return_error_string() const; void set_defaults(); void mesh_3_volume(); void mesh_3_surface(); @@ -241,7 +241,7 @@ private: IMAGE_MESH_ITEMS, IMPLICIT_MESH_ITEMS }; - mutable boost::optional> items; @@ -287,9 +287,8 @@ void Mesh_3_plugin::mesh_3_volume() mesh_3(Mesh_type::VOLUME); } -boost::optional Mesh_3_plugin::get_items_or_return_error_string() const +std::optional Mesh_3_plugin::get_items_or_return_error_string() const { - using boost::get; items = {}; features_protection_available = false; item = nullptr; @@ -332,7 +331,7 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const { if (!items) continue; - auto poly_items_ptr = get(&*items); + auto poly_items_ptr = std::get_if(&items.value()); if(poly_items_ptr) { if (poly_items_ptr->polylines_item) { return tr("Only one polyline item is accepted"); @@ -341,7 +340,7 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const } } else { - if(auto image_items_ptr = get(&*items)) + if(auto image_items_ptr = std::get_if(&items.value())) { if (image_items_ptr->polylines_item) { return tr("Only one polyline item is accepted"); @@ -365,10 +364,10 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const //attach polylines_item to one or the other item //if it could not be done in the for loop //because of selection order - if (polylines_item != nullptr && items != boost::none) + if (polylines_item != nullptr && items != std::nullopt) { - auto poly_items_ptr = get(&*items); - auto image_items_ptr = get(&*items); + auto poly_items_ptr = std::get_if(&items.value()); + auto image_items_ptr = std::get_if(&items.value()); if(poly_items_ptr && poly_items_ptr == nullptr) poly_items_ptr->polylines_item = polylines_item; else if(image_items_ptr && image_items_ptr == nullptr) @@ -378,7 +377,7 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const if (!items) { return tr("Selected objects can't be meshed"); } item = nullptr; features_protection_available = false; - if (auto poly_items = get(&*items)) { + if (auto poly_items = std::get_if(&items.value())) { auto& sm_items = poly_items->sm_items; if(sm_items.empty()) { return tr("ERROR: there must be at least one surface mesh item."); @@ -399,12 +398,12 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const features_protection_available = true; } # ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS - else if (auto implicit_mesh_items = get(&*items)) { + else if (auto implicit_mesh_items = std::get_if(&items.value())) { item = implicit_mesh_items->function_item; } # endif # ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES - else if (auto image_mesh_items = get(&*items)) { + else if (auto image_mesh_items = std::get_if(&items.value())) { auto& image_item = image_mesh_items->image_item; item = image_item; features_protection_available = true; @@ -413,7 +412,7 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const if(item) { bbox = item->bbox(); - if (auto poly_items = get(&*items)) { + if (auto poly_items = std::get_if(&items.value())) { for (auto it : poly_items->sm_items) { bbox = bbox + it->bbox(); } @@ -448,28 +447,28 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, QMessageBox::warning(mw, tr("Mesh_3 plugin"), *error_string); return; } - using boost::get; + const bool more_than_one_item = - get(&*items) && - (get(&*items)->sm_items.size() > 1); + std::get_if(&items.value()) && + (std::get_if(&items.value())->sm_items.size() > 1); Scene_image_item* image_item = - get(&*items) - ? get(&*items)->image_item.get() + std::get_if(&items.value()) + ? std::get_if(&items.value())->image_item.get() : nullptr; Scene_surface_mesh_item* bounding_sm_item = - get(&*items) - ? get(&*items)->bounding_sm_item + std::get_if(&items.value()) + ? std::get_if(&items.value())->bounding_sm_item : nullptr; Scene_polylines_item* polylines_item = - get(&*items) - ? get(&*items)->polylines_item + std::get_if(&items.value()) + ? std::get_if(&items.value())->polylines_item : nullptr; - if (polylines_item == nullptr && get(&*items) != nullptr) - polylines_item = get(&*items)->polylines_item; + if (polylines_item == nullptr && std::get_if(&items.value()) != nullptr) + polylines_item = std::get_if(&items.value())->polylines_item; Scene_implicit_function_item* function_item = - get(&*items) - ? get(&*items)->function_item.get() + std::get_if(&items.value()) + ? std::get_if(&items.value())->function_item.get() : nullptr; // ----------------------------------- // Create Mesh dialog @@ -625,13 +624,13 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.initializationGroup->setVisible(input_is_labeled_img); ui.grayImgGroup->setVisible(input_is_gray_img); - if (items->which() == POLYHEDRAL_MESH_ITEMS) + if (items->index() == POLYHEDRAL_MESH_ITEMS) ui.volumeGroup->setVisible(mesh_type == Mesh_type::VOLUME && nullptr != bounding_sm_item); else ui.volumeGroup->setVisible(mesh_type == Mesh_type::VOLUME); ui.sharpEdgesAngle->setValue(sharp_edges_angle_bound); - if (items->which() != POLYHEDRAL_MESH_ITEMS || polylines_item != nullptr) { + if (items->index() != POLYHEDRAL_MESH_ITEMS || polylines_item != nullptr) { ui.sharpEdgesAngleLabel->setVisible(false); ui.sharpEdgesAngle->setVisible(false); @@ -657,14 +656,14 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, const Item on_cube{"Polylines on cube", BORDERS}; const Item triple_lines{"Triple+ lines", FEATURES}; if (features_protection_available) { - if (items->which() == POLYHEDRAL_MESH_ITEMS) { + if (items->index() == POLYHEDRAL_MESH_ITEMS) { auto v = [](Protection_flags f) { return QVariant::fromValue(f); }; if (mesh_type == Mesh_type::SURFACE_ONLY) { ui.protectEdges->addItem(sharp_and_boundary.first, v(sharp_and_boundary.second)); ui.protectEdges->addItem(boundary_only.first, v(boundary_only.second)); } else ui.protectEdges->addItem(sharp_edges.first, v(sharp_edges.second)); - } else if (items->which() == IMAGE_MESH_ITEMS) { + } else if (items->index() == IMAGE_MESH_ITEMS) { if (polylines_item != nullptr) { ui.protectEdges->addItem(input_polylines.first, QVariant::fromValue(input_polylines.second)); ui.protectEdges->addItem(QString(on_cube.first).append(" and input polylines"), @@ -745,7 +744,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, : false; Meshing_thread* thread = nullptr; - switch (items->which()) { + switch (items->index()) { case POLYHEDRAL_MESH_ITEMS: { auto& poly_items = get(*items); auto& sm_items = poly_items.sm_items; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h index e1b4e7190ee..dfd31aadd84 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h @@ -34,7 +34,7 @@ #include // for C3t3_initializer #include -#include +#include namespace CGAL { class Image_3; @@ -117,7 +117,7 @@ private: void tweak_criteria(Mesh_criteria&, Mesh_fnt::Domain_tag) {} void tweak_criteria(Mesh_criteria&, Mesh_fnt::Polyhedral_domain_tag); private: - boost::any object_to_destroy; + std::any object_to_destroy; C3t3& c3t3_; Domain* const domain_; Mesh_parameters const p_; @@ -273,10 +273,10 @@ edge_criteria(double edge_size, double minb, Mesh_fnt::Polyhedral_domain_tag) Mesh_sizing_field* sizing_field_ptr = new Mesh_sizing_field(edge_size, *domain_, domain_->aabb_tree()); // The sizing field object, as well as the `patch_ids_vector` are - // allocated on the heap, and the following `boost::any` object, + // allocated on the heap, and the following `std::any` object, // containing two shared pointers, is used to make the allocated // objects be destroyed at the destruction of the thread object, using - // type erasure (`boost::any`). + // type erasure (`std::any`). object_to_destroy = std::make_pair(QSharedPointer(sizing_field_ptr), QSharedPointer(patches_ids_vector_p)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp index 6f2e1eed542..85238d26ff4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include using namespace CGAL::Three; @@ -189,11 +189,10 @@ public Q_SLOTS: void on_Sample_random_points_from_bbox() { // calculate bbox of selected polyhedron items - boost::optional bbox - = boost::make_optional(false, CGAL::Three::Scene_interface::Bbox()); + std::optional bbox; // Workaround a bug in g++-4.8.3: // https://stackoverflow.com/a/21755207/1728537 - // Using boost::make_optional to copy-initialize 'bbox' hides the + // Using std::make_optional to copy-initialize 'bbox' hides the // warning about '*bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index 5f543518f2f..f4134ecfd15 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -497,7 +497,7 @@ public Q_SLOTS: return; } - boost::optional minimum = + std::optional minimum = selection_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value()); if(minimum) { ui_widget.Threshold_size_spin_box->setValue((int) *minimum); @@ -512,7 +512,7 @@ public Q_SLOTS: print_message("Error: there is no selected polyhedron selection item!"); return; } - boost::optional minimum = selection_item->get_minimum_isolated_component(); + std::optional minimum = selection_item->get_minimum_isolated_component(); if(minimum) { ui_widget.Threshold_size_spin_box->setValue((int) *minimum); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp index b39fd8b8f0a..036cdc43026 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp @@ -216,13 +216,13 @@ void Polyhedron_demo_intersection_plugin::intersectionPolylines() CGAL::cpp11::result_of::type result = CGAL::intersection(segA, segB); if (result) { - if (const Kernel::Segment_3* s = boost::get(&*result)) { + if (const Kernel::Segment_3* s = std::get_if(&*result)) { Polyline_3 p; p.push_back(s->point(0)); p.push_back(s->point(1)); new_pol_item->polylines.push_back(p); } else { - const Kernel::Point_3* p = boost::get(&*result); + const Kernel::Point_3* p = std::get_if(&*result); new_point_item->point_set()->insert(*p); } } @@ -326,13 +326,13 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfacePolyline() CGAL::cpp11::result_of::type result = CGAL::intersection(triangle, segment); if (result) { - if (const Kernel::Segment_3* s = boost::get(&*result)) { + if (const Kernel::Segment_3* s = std::get_if(&*result)) { Polyline_3 p; p.push_back(s->point(0)); p.push_back(s->point(1)); new_pol_item->polylines.push_back(p); } else { - const Kernel::Point_3* p = boost::get(&*result); + const Kernel::Point_3* p = std::get_if(&*result); new_point_item->point_set()->insert(*p); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp index d11f45cd623..78c0e2482d4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp @@ -27,7 +27,7 @@ struct Compute_average_spacing_functor { Point_set* points; const int nb_neighbors; - boost::shared_ptr result; + std::shared_ptr result; Compute_average_spacing_functor (Point_set* points, const int nb_neighbors) : points (points), nb_neighbors (nb_neighbors), result (new double(0)) { } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp index c4a13af368d..03f18810236 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp @@ -29,7 +29,7 @@ struct Bilateral_smoothing_functor Point_set* points; unsigned int neighborhood_size; unsigned int sharpness_angle; - boost::shared_ptr result; + std::shared_ptr result; Bilateral_smoothing_functor (Point_set* points, unsigned int neighborhood_size, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp index e898807835f..b998a35750e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp @@ -29,7 +29,7 @@ struct Clustering_functor Point_set* points; Point_set::Property_map cluster_map; const double neighbor_radius; - boost::shared_ptr result; + std::shared_ptr result; Clustering_functor (Point_set* points, const double neighbor_radius, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp index 925195e38d4..c18343a17a9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp @@ -26,7 +26,7 @@ struct Outlier_removal_functor int nb_neighbors; double removed_percentage; double distance_threshold; - boost::shared_ptr result; + std::shared_ptr result; Outlier_removal_functor (Point_set* points, int nb_neighbors, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp index 185ce8930fc..634ae8c699b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -332,7 +332,7 @@ class Neighborhood typedef CGAL::Fuzzy_sphere Sphere; Scene_points_with_normal_item* points_item; - boost::shared_ptr tree; + std::shared_ptr tree; public: @@ -351,7 +351,7 @@ public: { this->points_item = points_item; - tree = boost::make_shared (points_item->point_set()->begin(), + tree = std::make_shared (points_item->point_set()->begin(), points_item->point_set()->end(), Tree::Splitter(), Search_traits (points_item->point_set()->point_map())); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 68a1fe2c6d3..e79f43e02d6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -440,7 +440,7 @@ private: Scene_surface_mesh_item* sm_item = nullptr; sm_item = new Scene_surface_mesh_item; - boost::shared_ptr rg_plane(boost::make_shared(plane)); + std::shared_ptr rg_plane(std::make_shared(plane)); build_alpha_shape( *(point_item->point_set()), rg_plane, sm_item, search_sphere_radius); @@ -656,7 +656,7 @@ private: std::map color_map; int index = 0; - for(boost::shared_ptr shape : ransac.shapes()) + for(std::shared_ptr shape : ransac.shapes()) { CGAL::Shape_detection::Cylinder *cyl; cyl = dynamic_cast *>(shape.get()); @@ -731,8 +731,8 @@ private: { ss << item->name().toStdString() << "_plane_"; - boost::shared_ptr > pshape - = boost::dynamic_pointer_cast > (shape); + std::shared_ptr > pshape + = std::dynamic_pointer_cast > (shape); Kernel::Point_3 ref = CGAL::ORIGIN + pshape->plane_normal (); @@ -901,7 +901,7 @@ private: } template - void build_alpha_shape (Point_set& points, boost::shared_ptr plane, + void build_alpha_shape (Point_set& points, std::shared_ptr plane, Scene_surface_mesh_item* sm_item, double epsilon); }; // end Polyhedron_demo_point_set_shape_detection_plugin @@ -997,7 +997,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered template void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape -(Point_set& points, boost::shared_ptr plane, Scene_surface_mesh_item* sm_item, double epsilon) +(Point_set& points, std::shared_ptr plane, Scene_surface_mesh_item* sm_item, double epsilon) { typedef Kernel::Point_2 Point_2; typedef CGAL::Alpha_shape_vertex_base_2 Vb; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp index cc5431609ac..05eb2d41493 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp @@ -29,7 +29,7 @@ struct Compute_average_spacing_functor { Point_set* points; const int nb_neighbors; - boost::shared_ptr result; + std::shared_ptr result; Compute_average_spacing_functor (Point_set* points, const int nb_neighbors) : points (points), nb_neighbors (nb_neighbors), result (new double(0)) { } @@ -50,7 +50,7 @@ struct Grid_simplify_functor Point_set* points; double grid_size; unsigned int min_points_per_cell; - boost::shared_ptr result; + std::shared_ptr result; Grid_simplify_functor (Point_set* points, double grid_size, unsigned min_points_per_cell) : points (points), grid_size (grid_size), min_points_per_cell(min_points_per_cell) @@ -72,7 +72,7 @@ struct Hierarchy_simplify_functor Point_set* points; unsigned int max_cluster_size; double max_surface_variation; - boost::shared_ptr result; + std::shared_ptr result; Hierarchy_simplify_functor (Point_set* points, double max_cluster_size, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp index 538a48b32b7..519b4fff4ef 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp @@ -27,7 +27,7 @@ struct Compute_average_spacing_functor { Point_set* points; const int nb_neighbors; - boost::shared_ptr result; + std::shared_ptr result; Compute_average_spacing_functor (Point_set* points, const int nb_neighbors) : points (points), nb_neighbors (nb_neighbors), result (new double(0)) { } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp index 9385ee2442b..724ed194fc5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp @@ -309,7 +309,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_butto Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type - boost::optional minimum = + std::optional minimum = edit_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value()); if(minimum) { ui_widget.Threshold_size_spin_box->setValue((int) *minimum); @@ -321,7 +321,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_Get_minimum_button_clicked() { Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type - boost::optional minimum = edit_item->get_minimum_isolated_component(); + std::optional minimum = edit_item->get_minimum_isolated_component(); if(minimum) { ui_widget.Threshold_size_spin_box->setValue((int) *minimum); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 28163a38043..c4a060696cd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -1621,7 +1621,7 @@ void Scene_edit_polyhedron_item::reset_deform_object() refresh_all_group_centers(); } -boost::optional Scene_edit_polyhedron_item::get_minimum_isolated_component() { +std::optional Scene_edit_polyhedron_item::get_minimum_isolated_component() { Travel_isolated_components::Minimum_visitor visitor; Travel_isolated_components(*surface_mesh()).travel (vertices(*surface_mesh()).first, vertices(*surface_mesh()).second, @@ -1630,7 +1630,7 @@ boost::optional Scene_edit_polyhedron_item::get_minimum_isolated_co } -boost::optional Scene_edit_polyhedron_item::select_isolated_components(std::size_t threshold) { +std::optional Scene_edit_polyhedron_item::select_isolated_components(std::size_t threshold) { typedef boost::function_output_iterator > Output_iterator; Output_iterator out(d->deform_sm_mesh); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h index 3fc7b02d1dd..b78d140ffe3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h @@ -379,7 +379,7 @@ public: } }; - boost::optional get_minimum_isolated_component(); + std::optional get_minimum_isolated_component(); template struct Select_roi_output{ typedef typename CGAL::Surface_mesh_deformation select_isolated_components(std::size_t threshold) ; + std::optional select_isolated_components(std::size_t threshold) ; protected: // Deformation related functions // diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index 38114309886..5b808ac8e01 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include class QEvent; class QMouseEvent; diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h index 8164cdacf8f..a65e7adf764 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h @@ -289,15 +289,13 @@ public: { // Workaround a bug in g++-4.8.3: // https://stackoverflow.com/a/21755207/1728537 - // Using boost::make_optional to copy-initialize 'item_bbox' hides the + // Using std::make_optional to copy-initialize 'item_bbox' hides the // warning about '*item_bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 constVPmap vpm = get(CGAL::vertex_point, *polyhedron()); - boost::optional item_bbox - = boost::make_optional(false, CGAL::Bbox_3()); - + std::optional item_bbox; for(Selection_set_vertex::const_iterator v_it = selected_vertices.begin(); v_it != selected_vertices.end(); ++v_it) { @@ -488,7 +486,7 @@ public: clear(); } - boost::optional get_minimum_isolated_component() { + std::optional get_minimum_isolated_component() { switch(get_active_handle_type()) { case Active_handle::VERTEX: return get_minimum_isolated_component(); @@ -499,7 +497,7 @@ public: } } template // use fg_vertex_descriptor, fg_face_descriptor, fg_edge_descriptor - boost::optional get_minimum_isolated_component() { + std::optional get_minimum_isolated_component() { Selection_traits tr(this); Travel_isolated_components::Minimum_visitor visitor; Travel_isolated_components(*polyhedron()).travel @@ -507,7 +505,7 @@ public: return visitor.minimum; } - boost::optional select_isolated_components(std::size_t threshold) { + std::optional select_isolated_components(std::size_t threshold) { switch(get_active_handle_type()) { case Active_handle::VERTEX: return select_isolated_components(threshold); @@ -518,7 +516,7 @@ public: } } template // use fg_vertex_descriptor, fg_face_descriptor, fg_edge_descriptor - boost::optional select_isolated_components(std::size_t threshold) { + std::optional select_isolated_components(std::size_t threshold) { typedef Selection_traits Tr; Tr tr(this); typedef std::insert_iterator Output_iterator; diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index e41dda678d8..49e2da75e65 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -1200,7 +1200,7 @@ Scene_surface_mesh_item::select(double orig_x, { const EPICK::Point_3* closest_point = - boost::get(&(closest->first)); + std::get_if(&(closest->first)); for(Intersections::iterator it = std::next(intersections.begin()), end = intersections.end(); @@ -1211,7 +1211,7 @@ Scene_surface_mesh_item::select(double orig_x, } else { const EPICK::Point_3* it_point = - boost::get(&it->first); + std::get_if(&it->first); if(it_point && (ray_dir * (*it_point - *closest_point)) < 0) { @@ -1909,7 +1909,7 @@ void Scene_surface_mesh_item::zoomToPosition(const QPoint &point, CGAL::Three::V if(!intersections.empty()) { Intersections::iterator closest = intersections.begin(); const EPICK::Point_3* closest_point = - boost::get(&closest->first); + std::get_if(&closest->first); for(Intersections::iterator it = std::next(intersections.begin()), end = intersections.end(); @@ -1920,7 +1920,7 @@ void Scene_surface_mesh_item::zoomToPosition(const QPoint &point, CGAL::Three::V } else { const EPICK::Point_3* it_point = - boost::get(&it->first); + std::get_if(&it->first); if(it_point && (ray_dir * (*it_point - *closest_point)) < 0) { diff --git a/Polyhedron/demo/Polyhedron/Travel_isolated_components.h b/Polyhedron/demo/Polyhedron/Travel_isolated_components.h index 5cdd2dfdeb9..c1e1124f6b2 100644 --- a/Polyhedron/demo/Polyhedron/Travel_isolated_components.h +++ b/Polyhedron/demo/Polyhedron/Travel_isolated_components.h @@ -1,7 +1,7 @@ #ifndef TRAVEL_ISOLATED_COMPONENTS_H #define TRAVEL_ISOLATED_COMPONENTS_H -#include +#include #include #include "One_ring_iterators.h" #include diff --git a/Polyhedron/demo/Polyhedron/include/id_printing.h b/Polyhedron/demo/Polyhedron/include/id_printing.h index 71f93c809c5..91be6e8f224 100644 --- a/Polyhedron/demo/Polyhedron/include/id_printing.h +++ b/Polyhedron/demo/Polyhedron/include/id_printing.h @@ -175,7 +175,7 @@ bool find_primitive_id(const QPoint& point, return false; typename Intersections::iterator closest = intersections.begin(); - const Point* closest_point = boost::get(&closest->first); + const Point* closest_point = std::get_if(&closest->first); for(typename Intersections::iterator it = std::next(intersections.begin()), end = intersections.end(); it != end; ++it) { @@ -185,7 +185,7 @@ bool find_primitive_id(const QPoint& point, } else { - const Point* it_point = boost::get(&it->first); + const Point* it_point = std::get_if(&it->first); if(it_point && (ray_dir * (*it_point - *closest_point)) < 0) { closest = it; diff --git a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h index 9671bb46277..b997b2ab1bf 100644 --- a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h +++ b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h @@ -20,9 +20,9 @@ private: mutable std::size_t nb; public: - boost::shared_ptr latest_adv; - boost::shared_ptr state; - boost::shared_ptr signaler; + std::shared_ptr latest_adv; + std::shared_ptr state; + std::shared_ptr signaler; Signal_callback(bool) : latest_adv (new double(0)) @@ -71,7 +71,7 @@ public: class Functor_with_signal_callback { protected: - boost::shared_ptr m_callback; + std::shared_ptr m_callback; public: Signal_callback* callback() { return m_callback.get(); } diff --git a/Polyline_simplification_2/doc/Polyline_simplification_2/Concepts/PolylineSimplificationCostFunction.h b/Polyline_simplification_2/doc/Polyline_simplification_2/Concepts/PolylineSimplificationCostFunction.h index 4722bcaa72c..b945f776017 100644 --- a/Polyline_simplification_2/doc/Polyline_simplification_2/Concepts/PolylineSimplificationCostFunction.h +++ b/Polyline_simplification_2/doc/Polyline_simplification_2/Concepts/PolylineSimplificationCostFunction.h @@ -27,7 +27,7 @@ Given a vertex in constraint iterator `viq` computes `vip=std::prev(viq)` and `v \param ct The underlying constrained Delaunay triangulation which embeds the polyline constraints \param viq The vertex in constraint iterator of the vertex to remove -\returns The cost for removing `*viq`. The value `boost::none` can be returned to indicate an infinite or uncomputable cost. +\returns The cost for removing `*viq`. The value `std::nullopt` can be returned to indicate an infinite or uncomputable cost. \tparam CDT must be `CGAL::Constrained_triangulation_plus_2` with a vertex type that is model of `PolylineSimplificationVertexBase_2`. `CDT::Geom_traits` must be model of @@ -35,7 +35,7 @@ the concept `ConstrainedDelaunayTriangulationTraits_2`. */ template - boost::optional + std::optional operator()(CGAL::Constrained_triangulation_plus_2 const& ct, CGAL::Constrained_triangulation_plus_2::Vertices_in_constraint_iterator viq) const;} diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h index fd1e9ccc0de..aa5418d0d43 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h @@ -49,7 +49,7 @@ public: /// \tparam CDT must be `CGAL::Constrained_Delaunay_triangulation_2` with a vertex type that /// is model of `PolylineSimplificationVertexBase_2`. template - boost::optional + std::optional operator()( const Constrained_triangulation_plus_2& pct , typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator vicq) const { diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h index 8a697736461..d26e3f22294 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h @@ -44,7 +44,7 @@ public: /// \tparam CDT must be `CGAL::Constrained_Delaunay_triangulation_2` with a vertex type that /// is model of `PolylineSimplificationVertexBase_2`. template - boost::optional + std::optional operator()(const Constrained_triangulation_plus_2& pct , typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator vicq) const { @@ -94,8 +94,8 @@ public: }while(vc != done); return d2_uninitialized ? - boost::optional(boost::none) : - boost::optional(d1 / d2); + std::optional(std::nullopt) : + std::optional(d1 / d2); } }; diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h index 4110a771821..70cfa39a6af 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h @@ -50,7 +50,7 @@ public: /// is model of `PolylineSimplificationVertexBase_2`. template - boost::optional + std::optional operator()(const Constrained_triangulation_plus_2& pct , typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator vicq)const { diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index 85404f86c2d..198928e2145 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -211,7 +211,7 @@ public: it != pct.vertices_in_constraint_end(cid); ++it){ if((*it)->is_removable()){ - boost::optional dist = cost(pct, it); + std::optional dist = cost(pct, it); if(dist){ (*it)->set_cost(*dist); if(! (*mpq).contains(*it)){ @@ -326,7 +326,7 @@ operator()() pct.simplify(vit); if((*u)->is_removable()){ - boost::optional dist = cost(pct, u); + std::optional dist = cost(pct, u); if(! dist){ // cost is undefined if( mpq->contains(*u) ){ @@ -344,7 +344,7 @@ operator()() } if((*w)->is_removable()){ - boost::optional dist = cost(pct, w); + std::optional dist = cost(pct, w); if(! dist){ // cost is undefined if( mpq->contains(*w) ){ diff --git a/Polynomial/include/CGAL/Polynomial_traits_d.h b/Polynomial/include/CGAL/Polynomial_traits_d.h index f7a4d3993e3..6eb4f0d6e3f 100644 --- a/Polynomial/include/CGAL/Polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Polynomial_traits_d.h @@ -462,7 +462,7 @@ private: // We use our own Strict Weak Ordering predicate in order to avoid - // problems when calling sort for a Exponents_coeff_pair where the + // problems when calling sort for an `Exponents_coeff_pair` where the // coeff type has no comparison operators available. private: struct Compare_exponents_coeff_pair diff --git a/SMDS_3/include/CGAL/IO/output_to_vtu.h b/SMDS_3/include/CGAL/IO/output_to_vtu.h index 28818b8ba68..51438e8dcde 100644 --- a/SMDS_3/include/CGAL/IO/output_to_vtu.h +++ b/SMDS_3/include/CGAL/IO/output_to_vtu.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -273,7 +273,7 @@ enum VTU_ATTRIBUTE_TYPE{ SIZE_TYPE }; -typedef boost::variant*, const std::vector*, const std::vector* > Vtu_attributes; +typedef std::variant*, const std::vector*, const std::vector* > Vtu_attributes; template void output_to_vtu_with_attributes(std::ostream& os, @@ -314,15 +314,15 @@ void output_to_vtu_with_attributes(std::ostream& os, os << " \n"; for(std::size_t i = 0; i< attributes.size(); ++i) { - switch(attributes[i].second.which()){ + switch(attributes[i].second.index()){ case 0: - write_attribute_tag(os,attributes[i].first, *boost::get* >(attributes[i].second), binary,offset); + write_attribute_tag(os,attributes[i].first, *std::get* >(attributes[i].second), binary,offset); break; case 1: - write_attribute_tag(os,attributes[i].first, *boost::get* >(attributes[i].second), binary,offset); + write_attribute_tag(os,attributes[i].first, *std::get* >(attributes[i].second), binary,offset); break; default: - write_attribute_tag(os,attributes[i].first, *boost::get* >(attributes[i].second), binary,offset); + write_attribute_tag(os,attributes[i].first, *std::get* >(attributes[i].second), binary,offset); break; } } @@ -334,15 +334,15 @@ void output_to_vtu_with_attributes(std::ostream& os, write_c3t3_points(os,tr,V); // fills V if the mode is BINARY write_cells(os,c3t3,V); for(std::size_t i = 0; i< attributes.size(); ++i) { - switch(attributes[i].second.which()){ + switch(attributes[i].second.index()){ case 0: - write_attributes(os, *boost::get* >(attributes[i].second)); + write_attributes(os, *std::get* >(attributes[i].second)); break; case 1: - write_attributes(os, *boost::get* >(attributes[i].second)); + write_attributes(os, *std::get* >(attributes[i].second)); break; default: - write_attributes(os, *boost::get* >(attributes[i].second)); + write_attributes(os, *std::get* >(attributes[i].second)); break; } } diff --git a/SMDS_3/include/CGAL/SMDS_3/internal/Handle_IO_for_pair_of_int.h b/SMDS_3/include/CGAL/SMDS_3/internal/Handle_IO_for_pair_of_int.h index cd3c8f135a9..87d4e5863d5 100644 --- a/SMDS_3/include/CGAL/SMDS_3/internal/Handle_IO_for_pair_of_int.h +++ b/SMDS_3/include/CGAL/SMDS_3/internal/Handle_IO_for_pair_of_int.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include namespace CGAL { template <> @@ -52,19 +52,19 @@ public: }; template <> -class Output_rep > > : public IO_rep_is_specialized { - typedef boost::variant > Variant; + typedef std::variant > Variant; const Variant& v; public: Output_rep(const Variant& v) : v(v) {} std::ostream& operator()( std::ostream& out) const { - if(v.which() == 1) { - out << IO::oformat(boost::get >(v)); + if(v.index() == 1) { + out << IO::oformat(std::get >(v)); } else { - out << boost::get(v); + out << std::get(v); } return out; } diff --git a/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h b/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h index 0e4e8901ce5..18d5e4b6cc8 100644 --- a/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h +++ b/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -36,12 +35,12 @@ namespace internal { // ----------------------------------- // Index_generator -// Don't use boost::variant if types are the same type +// Don't use std::variant if types are the same type // ----------------------------------- template < typename Subdomain_index, typename Surface_patch_index > struct Index_generator { - typedef boost::variant Index; + typedef std::variant Index; typedef Index type; }; @@ -72,19 +71,19 @@ struct Indices_tuple_generator template using Indices_tuple_t = typename Indices_tuple_generator::type; -// Nasty meta-programming to get a boost::variant of four types that +// Nasty meta-programming to get a std::variant of four types that // may not be all different. template struct seq1 { typedef T0 type; }; template struct seq2 { - typedef boost::variant type; + typedef std::variant type; }; template struct seq3 { - typedef boost::variant type; + typedef std::variant type; }; template struct seq4 { - typedef boost::variant type; + typedef std::variant type; }; template struct insert; @@ -142,10 +141,10 @@ struct Index_generator_with_features typedef Index type; }; -template -const T& get_index(const Boost_variant& x, - std::enable_if_t::value > * = 0) -{ return boost::get(x); } +template +const T& get_index(const Variant& x, + std::enable_if_t::value > * = 0) +{ return std::get(x); } template const T& get_index(const T& x) { return x; } @@ -305,8 +304,8 @@ struct Variant_read_visitor { }; template -struct Read_write_index> { - using Index = boost::variant; +struct Read_write_index> { + using Index = std::variant; using index_seq = std::make_index_sequence::value>; template @@ -317,12 +316,12 @@ struct Read_write_index> { void operator()(std::ostream& os, int, Index index) const { Variant_write_visitor visitor{os}; - apply_visitor(visitor, index); + std::visit(visitor, index); } Index operator()(std::istream& is, int dimension) const { Index index = get_index(dimension, index_seq{}); Variant_read_visitor visitor{is, index}; - apply_visitor(visitor, index); + std::visit(visitor, index); return index; } }; diff --git a/SMDS_3/include/CGAL/SMDS_3/io_signature.h b/SMDS_3/include/CGAL/SMDS_3/io_signature.h index ba50d850123..22022ba6051 100644 --- a/SMDS_3/include/CGAL/SMDS_3/io_signature.h +++ b/SMDS_3/include/CGAL/SMDS_3/io_signature.h @@ -33,7 +33,7 @@ #include #endif -#include +#include #include #include @@ -149,10 +149,10 @@ struct Get_io_signature }; template -struct Get_io_signature > +struct Get_io_signature > { std::string operator()() { - return std::string("boost::variant<") + + return std::string("std::variant<") + Get_io_signature()() + "," + Get_io_signature()() + ">"; } @@ -179,10 +179,10 @@ struct Get_io_signature > }; template -struct Get_io_signature > +struct Get_io_signature > { std::string operator()() { - return std::string("boost::variant<") + + return std::string("std::variant<") + Get_io_signature()() + "," + Get_io_signature()() + "," + Get_io_signature()() + ">"; @@ -191,10 +191,10 @@ struct Get_io_signature > template -struct Get_io_signature > +struct Get_io_signature > { std::string operator()() { - return std::string("boost::variant<") + + return std::string("std::variant<") + Get_io_signature()() + "," + Get_io_signature()() + "," + Get_io_signature()() + "," + diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h index 3f1a9c92d42..24656da85e1 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h @@ -26,9 +26,9 @@ #include #include +#include #include -#include #include namespace CGAL { @@ -53,7 +53,7 @@ public: using Vertex_handle = typename Vb::Vertex_handle; // Types - using Index = boost::variant; + using Index = Variant_with_no_duplicate_t; using FT = typename GT::FT; // Constructor diff --git a/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.binary.cgal b/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.binary.cgal index f4c958d9239..ab735a65e00 100644 Binary files a/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.binary.cgal and b/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.binary.cgal differ diff --git a/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.cgal b/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.cgal index f0c10161e35..e32557d8173 100644 --- a/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.cgal +++ b/SMDS_3/test/SMDS_3/data/c3t3_io-hetero.cgal @@ -1,4 +1,4 @@ -CGAL c3t3 Triangulation_3(Weighted_point,Vb(Tvb_3+i+boost::variant,i,d>),Cb(enum+RTcb_3+(std::pair)[4])) +CGAL c3t3 Triangulation_3(Weighted_point,Vb(Tvb_3+i+std::variant,i,d>),Cb(enum+RTcb_3+(std::pair)[4])) 3 6 10 11 12 0 0 7 diff --git a/SMDS_3/test/SMDS_3/test_c3t3_io.cpp b/SMDS_3/test/SMDS_3/test_c3t3_io.cpp index ef8d9e16d7a..7105303ee34 100644 --- a/SMDS_3/test/SMDS_3/test_c3t3_io.cpp +++ b/SMDS_3/test/SMDS_3/test_c3t3_io.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include @@ -48,7 +48,7 @@ struct MD_heterogeneous_types { typedef std::pair Surface_patch_index; typedef int Curve_index; typedef double Corner_index; - typedef boost::variant Index; @@ -63,7 +63,7 @@ struct MD_heterogeneous_types { static std::string reference_format_string() { - return "Triangulation_3(Weighted_point,Vb(Tvb_3+i+boost::variant,i,d>),Cb(enum+RTcb_3+(std::pair)[4]))"; + return "Triangulation_3(Weighted_point,Vb(Tvb_3+i+std::variant,i,d>),Cb(enum+RTcb_3+(std::pair)[4]))"; } }; diff --git a/STL_Extension/doc/STL_Extension/CGAL/Object.h b/STL_Extension/doc/STL_Extension/CGAL/Object.h index c75541b0ae9..4c843935996 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Object.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Object.h @@ -19,7 +19,7 @@ this is done with the global function `make_object()`. This encapsulation mechanism requires the use of `assign` or `object_cast` to use the functionality of the encapsulated class. -This class is similar in spirit to `boost::any`. +This class is similar in spirit to `std::any`. \cgalHeading{Example} @@ -110,16 +110,16 @@ Object(const Object &o); /*! Implicit converting constructor for compatibility with -`boost::variant`. +`std::variant`. */ -Object(boost::variant); +Object(std::variant); /*! Implicit converting constructor for compatibility with -`boost::optional` and `boost::variant`. +`std::optional` and `std::variant`. */ -Object(boost::optional< boost::variant >); +Object(std::optional< std::variant >); /// @} diff --git a/STL_Extension/doc/STL_Extension/CGAL/iterator.h b/STL_Extension/doc/STL_Extension/CGAL/iterator.h index fdc82bb1ffd..2ba1736893d 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/iterator.h +++ b/STL_Extension/doc/STL_Extension/CGAL/iterator.h @@ -106,10 +106,10 @@ The class `Dispatch_or_drop_output_iterator` defines an `OutputIterator` that contains a tuple of output iterators, and dispatches among those based on the type of the value type which is put in it. Besides defining assignment for all parameters of `V` -and for a tuple of type `V`, it is also defined for the types `boost::variant` and -`boost::optional >`, where `T...` +and for a tuple of type `V`, it is also defined for the types `std::variant` and +`std::optional >`, where `T...` must be a subset of the parameters of `V`. Should the -`boost::optional` be empty, it will be discarded. +`std::optional` be empty, it will be discarded. \cgalHeading{Parameters} @@ -194,8 +194,8 @@ dispatches among those based on the type of the value type which is put in it. Other types are also accepted, and the object is discarded in this case. Besides defining assignment for all parameters of `V` and for a tuple of type `V`, it is also defined for the types -`boost::variant` and -`boost::optional >`, where `T...` +`std::variant` and +`std::optional >`, where `T...` can be a list of arbitrary types. It also inherits from `O`, which makes it easy to treat like a diff --git a/STL_Extension/doc/STL_Extension/STL_Extension.txt b/STL_Extension/doc/STL_Extension/STL_Extension.txt index b793a86550a..b37ecb282e8 100644 --- a/STL_Extension/doc/STL_Extension/STL_Extension.txt +++ b/STL_Extension/doc/STL_Extension/STL_Extension.txt @@ -142,7 +142,7 @@ For handles and indices of vertices, halfedges, faces, etc., we provide speciali The class `Object` can store an object of whatever other type. It can be used by a function to return objects of different types. A mechanism to extract the stored object based on its type is also provided. -This class is similar to `boost::any`. +This class is similar to `std::any`. \section stl_uncertainty Uncertainty Management diff --git a/STL_Extension/examples/STL_Extension/Dispatch_output_iterator.cpp b/STL_Extension/examples/STL_Extension/Dispatch_output_iterator.cpp index f55d06db392..89abf64fbcc 100644 --- a/STL_Extension/examples/STL_Extension/Dispatch_output_iterator.cpp +++ b/STL_Extension/examples/STL_Extension/Dispatch_output_iterator.cpp @@ -1,7 +1,7 @@ #include #include -#include -#include +#include +#include int main() { @@ -21,7 +21,7 @@ int main() std::back_inserter(b), std::back_inserter(c)); - typedef boost::variant var; + typedef std::variant var; var va = 23; var vb = 4.2; var vc = 'x'; // goes to a diff --git a/STL_Extension/include/CGAL/Modifiable_priority_queue.h b/STL_Extension/include/CGAL/Modifiable_priority_queue.h index 2f24c67cd77..e4fe97cda41 100644 --- a/STL_Extension/include/CGAL/Modifiable_priority_queue.h +++ b/STL_Extension/include/CGAL/Modifiable_priority_queue.h @@ -12,7 +12,7 @@ #define CGAL_MODIFIABLE_PRIORITY_QUEUE_H #include // Needed by the following Boost header for CHAR_BIT. -#include +#include #include #include @@ -66,14 +66,14 @@ public: bool contains ( value_type const& v ) { return mHeap.contains(v) ; } - boost::optional extract_top() + std::optional extract_top() { - boost::optional r ; + std::optional r ; if ( !empty() ) { value_type v = top(); pop(); - r = boost::optional(v) ; + r = std::optional(v) ; } return r ; } @@ -238,14 +238,14 @@ public: return (mHandles[vid] != handle_type()); } - boost::optional extract_top() + std::optional extract_top() { - boost::optional r; + std::optional r; if(!empty()) { value_type v = top(); pop(); - r = boost::optional(v); + r = std::optional(v); } return r; diff --git a/STL_Extension/include/CGAL/Object.h b/STL_Extension/include/CGAL/Object.h index e0efd971006..765b5e70e3f 100644 --- a/STL_Extension/include/CGAL/Object.h +++ b/STL_Extension/include/CGAL/Object.h @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -39,7 +39,7 @@ class Object std::shared_ptr obj; // returns an any pointer from a variant - struct Any_from_variant : public boost::static_visitor { + struct Any_from_variant { template boost::any* operator()(const T& t) const { return new boost::any(t); @@ -62,14 +62,14 @@ class Object Object(T && t, private_tag) : obj(new boost::any(std::forward(t))) { } // implicit constructor from optionals containing variants - template - Object(const boost::optional< boost::variant >& t) - : obj( t ? boost::apply_visitor(Any_from_variant(), *t) : nullptr) { } + template + Object(const std::optional< std::variant >& t) + : obj( t ? std::visit(Any_from_variant(), *t) : nullptr) { } // implicit constructor from variants - template - Object(const boost::variant& v) - : obj(boost::apply_visitor(Any_from_variant(), v)) { } + template + Object(const std::variant& v) + : obj(std::visit(Any_from_variant(), v)) { } template bool assign(T &t) const diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp index a02a831f044..96f9f2aa08c 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp +++ b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include // for CHAR_BIT #include @@ -79,13 +79,13 @@ private: /** The value associated with this group. This value is only valid * when @c kind!=largest_key (which indicates a deleted - * element). Note that the use of boost::optional increases the + * element). Note that the use of std::optional increases the * memory requirements slightly but does not result in extraneous * memory allocations or deallocations. The optional could be * eliminated when @c value_type is a model of * DefaultConstructible. */ - ::boost::optional< value_type > value; + ::std::optional< value_type > value; /** * The kind of key stored at this group. This may be @c @@ -205,14 +205,14 @@ public: value_type& top() { find_smallest(); - CGAL_assertion(smallest_value->value != boost::none); + CGAL_assertion(smallest_value->value != std::nullopt); return *smallest_value->value; } const value_type& top() const { find_smallest(); - CGAL_assertion(smallest_value->value != boost::none); + CGAL_assertion(smallest_value->value != std::nullopt); return *smallest_value->value; } @@ -238,7 +238,7 @@ public: rank_type r = x->rank; group* p = x->parent; { - CGAL_assertion(x->value != boost::none); + CGAL_assertion(x->value != std::nullopt); // Find x's group size_type start = get(id, *x->value) - get(id, *x->value) % log_n; @@ -727,7 +727,7 @@ private: * are each log_n long, with the last group potentially being * smaller. */ - std::vector< ::boost::optional< value_type > > groups; + std::vector< ::std::optional< value_type > > groups; /** The list of active groups, indexed by rank. When A[r] is null, * there is no active group of rank r. Otherwise, A[r] is the active diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index 0ac9fcf11ae..326557344a6 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -1262,7 +1262,7 @@ filter_output_iterator(I e, const P& p) namespace internal { template -struct Output_visitor : boost::static_visitor { +struct Output_visitor { Output_visitor(OutputIterator* it) : out(it) {} OutputIterator* out; @@ -1380,17 +1380,17 @@ public: return *this; } - template - Self& operator=(const boost::variant& t) { + template + Self& operator=(const std::variant< T ... >& t) { internal::Output_visitor visitor(this); - t.apply_visitor(visitor); + std::visit(visitor, t); return *this; } - template - Self& operator=(const boost::optional< boost::variant >& t) { + template + Self& operator=(const std::optional< std::variant< T ... > >& t) { internal::Output_visitor visitor(this); - if(t) boost::apply_visitor(visitor, *t); + if(t) std::visit(visitor, *t); return *this; } @@ -1457,6 +1457,19 @@ public: template Self& operator=(const T&) { return *this; } + template + Self& operator=(const std::variant< T ... >& t) { + internal::Output_visitor visitor(this); + std::visit(visitor, t); + return *this; + } + + template + Self& operator=(const std::optional< std::variant< T ... > >& t) { + internal::Output_visitor visitor(this); + if(t) std::visit(visitor, *t); + return *this; + } }; diff --git a/STL_Extension/include/CGAL/variant.h b/STL_Extension/include/CGAL/variant.h new file mode 100644 index 00000000000..41bd836d8cc --- /dev/null +++ b/STL_Extension/include/CGAL/variant.h @@ -0,0 +1,87 @@ +// Copyright (c) 2023 GeometryFactory Sarl (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Sébastien Loriot +// + +#ifndef CGAL_VARIANT_H +#define CGAL_VARIANT_H + +#include + +namespace CGAL +{ + +template +struct Is_in_variant; + +template +struct Is_in_variant> +{ + inline static constexpr bool value = + std::is_same_v || Is_in_variant>::value; +}; + +template +struct Is_in_variant> +{ + inline static constexpr bool value = std::is_same_v; +}; + +/// equals true iif `T` is a possible type in `Variant` with `Variant` being a `std::variant` +template +inline constexpr bool Is_in_variant_v = Is_in_variant::value; + +// -- +template +struct Add_to_variant; + +template +struct Add_to_variant> +{ + using type = std::variant; +}; + +/// a `std::variant` with `T` appended to the types of the `std::variant` `Variant` +template< class T, class Variant > +using Add_to_variant_t = typename Add_to_variant::type; + +namespace internal{ +template +struct Get_variant_impl +{ + using type = typename Get_variant_impl< + std::conditional_t, + Variant, + Add_to_variant_t>, + Tn...>::type; +}; + +template +struct Get_variant_impl +{ + using type = std::conditional_t, + Variant, + Add_to_variant_t>; +}; +} // end of internal namespace + +template +struct Variant_with_no_duplicate +{ + using type = typename internal::Get_variant_impl, Tn ...>::type; +}; + +/// a `std::variant` with types being all different +template< class ... Tn > +using Variant_with_no_duplicate_t = typename Variant_with_no_duplicate::type; + +} //end of CGAL namespace + +#endif diff --git a/STL_Extension/test/STL_Extension/test_Object.cpp b/STL_Extension/test/STL_Extension/test_Object.cpp index 705779bee86..1e65bf5cf97 100644 --- a/STL_Extension/test/STL_Extension/test_Object.cpp +++ b/STL_Extension/test/STL_Extension/test_Object.cpp @@ -3,15 +3,15 @@ #include #include -#include -#include +#include +#include #include void from_opt_var() { int i = 0; double j = 0.0; - boost::optional< boost::variant > v(23); + std::optional< std::variant > v(23); CGAL::Object o = v; assert(!o.empty()); assert(CGAL::assign(i, o)); @@ -23,7 +23,7 @@ void from_opt_var() { assert(CGAL::assign(j, o)); assert(j == 2.0); //empty optional - boost::optional< boost::variant > v2; + std::optional< std::variant > v2; CGAL::Object o2 = v2; assert(o2.empty()); } @@ -31,7 +31,7 @@ void from_opt_var() { void from_var() { int i = 0; - boost::variant v(23); + std::variant v(23); CGAL::Object o = v; assert(!o.empty()); assert(CGAL::assign(i, o)); diff --git a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp index 9dffd636b51..250fe0a57ca 100644 --- a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp +++ b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp @@ -7,8 +7,8 @@ #include #include -#include -#include +#include +#include struct A{}; struct B{}; @@ -91,8 +91,8 @@ void complete_test(std::vector data1,std::list data2){ } void variant_test() { - typedef boost::variant var; - typedef boost::optional< var > ovar; + typedef std::variant var; + typedef std::optional< var > ovar; std::vector a; std::vector b; std::vector c; diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp index f4e5a859bca..34abf4d8049 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp @@ -99,7 +99,7 @@ int main(int argc, char** argv) { Efficient_ransac::Shape_range::iterator it = shapes.begin(); while (it != shapes.end()) { - boost::shared_ptr shape = *it; + std::shared_ptr shape = *it; // Use Shape_base::info() to print the parameters of the detected shape. std::cout << (*it)->info(); diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h index 53331b8d709..88089e89e01 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h @@ -37,7 +37,7 @@ // boost -------------- #include -#include +#include #include //--------------------- @@ -104,36 +104,36 @@ public: #ifdef DOXYGEN_RUNNING typedef unspecified_type Shape_range; - ///< `Iterator_range` with a bidirectional constant iterator type with value type `boost::shared_ptr`. + ///< `Iterator_range` with a bidirectional constant iterator type with value type `std::shared_ptr`. typedef unspecified_type Plane_range; - ///< `Iterator_range` with a bidirectional constant iterator type with value type `boost::shared_ptr`. + ///< `Iterator_range` with a bidirectional constant iterator type with value type `std::shared_ptr`. #else struct Shape_range : public Iterator_range< - typename std::vector >::const_iterator> { + typename std::vector >::const_iterator> { typedef Iterator_range< - typename std::vector >::const_iterator> Base; + typename std::vector >::const_iterator> Base; - Shape_range(boost::shared_ptr > > + Shape_range(std::shared_ptr > > extracted_shapes) : Base(make_range(extracted_shapes->begin(), extracted_shapes->end())), m_extracted_shapes(extracted_shapes) {} private: - boost::shared_ptr > > + std::shared_ptr > > m_extracted_shapes; // keeps a reference to the shape vector }; struct Plane_range : public Iterator_range< - typename std::vector >::const_iterator> { + typename std::vector >::const_iterator> { typedef Iterator_range< - typename std::vector >::const_iterator> Base; + typename std::vector >::const_iterator> Base; - Plane_range(boost::shared_ptr > > + Plane_range(std::shared_ptr > > extracted_shapes) : Base(make_range(extracted_shapes->begin(), extracted_shapes->end())), m_extracted_shapes(extracted_shapes) {} private: - boost::shared_ptr > > + std::shared_ptr > > m_extracted_shapes; // keeps a reference to the shape vector }; @@ -291,7 +291,7 @@ public: clear(); m_extracted_shapes = - boost::make_shared > >(); + std::make_shared > >(); m_num_available_points = m_num_total_points = std::distance( m_input_iterator_first, m_input_iterator_beyond); @@ -435,7 +435,7 @@ public: std::vector().swap(m_shape_index); m_extracted_shapes = - boost::make_shared > >(); + std::make_shared > >(); m_num_available_points = m_num_total_points; @@ -488,7 +488,7 @@ public: // Reset data structures possibly used by former search m_extracted_shapes = - boost::make_shared > >(); + std::make_shared > >(); m_num_available_points = m_num_total_points; for (std::size_t i = 0; i < m_num_subsets; i++) { @@ -755,7 +755,7 @@ public: //1. add best candidate to final result. m_extracted_shapes->push_back( - boost::shared_ptr(best_candidate)); + std::shared_ptr(best_candidate)); if (callback && !callback(num_invalid / double(m_num_total_points))) { clear(num_invalid, candidates); @@ -874,7 +874,7 @@ public: /// @{ /*! Returns an `Iterator_range` with a bidirectional iterator with value type - `boost::shared_ptr` over the detected shapes in the order of detection. + `std::shared_ptr` over the detected shapes in the order of detection. Depending on the chosen probability for the detection, the shapes are ordered with decreasing size. */ @@ -884,21 +884,21 @@ public: /*! Returns an `Iterator_range` with a bidirectional iterator with - value type `boost::shared_ptr` over only the + value type `std::shared_ptr` over only the detected planes in the order of detection. Depending on the chosen probability for the detection, the planes are ordered with decreasing size. */ Plane_range planes() const { - boost::shared_ptr > > planes - = boost::make_shared > >(); + std::shared_ptr > > planes + = std::make_shared > >(); for (std::size_t i = 0; i < m_extracted_shapes->size(); ++i) { - boost::shared_ptr pshape - = boost::dynamic_pointer_cast((*m_extracted_shapes)[i]); + std::shared_ptr pshape + = std::dynamic_pointer_cast((*m_extracted_shapes)[i]); // Ignore all shapes other than plane - if (pshape != boost::shared_ptr()) + if (pshape != std::shared_ptr()) planes->push_back(pshape); } return Plane_range(planes); @@ -1218,7 +1218,7 @@ private: //give the index of the subset of point i std::vector m_index_subsets; - boost::shared_ptr > > m_extracted_shapes; + std::shared_ptr > > m_extracted_shapes; std::vector m_shape_factories; diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h index 3fb4ecea249..774a21437cc 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h @@ -31,7 +31,7 @@ namespace Shape_detection { class Point_to_shape_index_map { typedef CGAL::Shape_detection::Shape_base Shape; - boost::shared_ptr > m_indices; + std::shared_ptr > m_indices; public: typedef std::size_t key_type; ///< %Index of the point in the random access point range. @@ -50,7 +50,7 @@ namespace Shape_detection { \tparam ShapeRange must be an `Iterator_range` with a bidirectional constant iterator type with value type - `boost::shared_ptr >`. + `std::shared_ptr >`. */ template Point_to_shape_index_map (const PointRange& points, @@ -85,7 +85,7 @@ namespace Shape_detection { { public: typedef CGAL::Shape_detection::Plane Plane_shape; - typedef boost::shared_ptr key_type; + typedef std::shared_ptr key_type; typedef typename Traits::Plane_3 value_type; typedef value_type reference; typedef boost::read_write_property_map_tag category; diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp index 39ac55d03fc..5d995f6faa3 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cone_parameters.cpp @@ -74,7 +74,7 @@ bool test_cone_parameters() { if (shapes.size() != 1) continue; - boost::shared_ptr cone = boost::dynamic_pointer_cast((*shapes.first)); + std::shared_ptr cone = std::dynamic_pointer_cast((*shapes.first)); // Check: shape detected is a cone. if (!cone) diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cylinder_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cylinder_parameters.cpp index 67cbbf24958..8c3780e0368 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cylinder_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_cylinder_parameters.cpp @@ -73,7 +73,7 @@ bool test_cylinder_parameters() { if (shapes.size() != 1) continue; - boost::shared_ptr cyl = boost::dynamic_pointer_cast((*shapes.first)); + std::shared_ptr cyl = std::dynamic_pointer_cast((*shapes.first)); // Check: shape detected is a cylinder. if (!cyl) diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_plane_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_plane_parameters.cpp index b963ed1e636..f0a8e772baa 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_plane_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_plane_parameters.cpp @@ -67,7 +67,7 @@ bool test_plane_parameters() { if (shapes.size() != 1) continue; - boost::shared_ptr pl = boost::dynamic_pointer_cast((*shapes.first)); + std::shared_ptr pl = std::dynamic_pointer_cast((*shapes.first)); if (!pl) continue; diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_scene.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_scene.cpp index fbe007b13c7..e78e2e3ca5a 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_scene.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_scene.cpp @@ -75,7 +75,7 @@ bool test_scene(int argc, char** argv) { // Iterate through all shapes and access each point. while (it != shapes.end()) { - boost::shared_ptr shape = *it; + std::shared_ptr shape = *it; // Sum distances of points to detected shapes. FT sum_distances = 0; diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_sphere_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_sphere_parameters.cpp index 0dbc63bb9de..88f78d5326a 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_sphere_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_sphere_parameters.cpp @@ -70,7 +70,7 @@ bool test_sphere_parameters() { if (shapes.size() != 1) continue; - boost::shared_ptr sphere = boost::dynamic_pointer_cast((*shapes.first)); + std::shared_ptr sphere = std::dynamic_pointer_cast((*shapes.first)); // Check: shape detected is a cylinder. if (!sphere) diff --git a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_torus_parameters.cpp b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_torus_parameters.cpp index 42138f178ff..3d39f70b473 100644 --- a/Shape_detection/test/Shape_detection/test_efficient_RANSAC_torus_parameters.cpp +++ b/Shape_detection/test/Shape_detection/test_efficient_RANSAC_torus_parameters.cpp @@ -72,8 +72,8 @@ bool test_torus_parameters() { if (shapes.size() != 1) continue; - boost::shared_ptr torus = - boost::dynamic_pointer_cast((*shapes.first)); + std::shared_ptr torus = + std::dynamic_pointer_cast((*shapes.first)); // Check: shape detected is a torus. if (!torus) diff --git a/Shape_regularization/include/CGAL/Shape_regularization/internal/Contour_base_2.h b/Shape_regularization/include/CGAL/Shape_regularization/internal/Contour_base_2.h index 1f8a5b8aafd..bbd1a13132e 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/internal/Contour_base_2.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/internal/Contour_base_2.h @@ -755,10 +755,10 @@ namespace internal { typename CGAL::cpp11::result_of::type result = CGAL::intersection(line_1, line_2); if (result) { - if (const Line_2* line = boost::get(&*result)) { + if (const Line_2* line = std::get_if(&*result)) { return false; } else { - const Point_2* point = boost::get(&*result); + const Point_2* point = std::get_if(&*result); in_point = *point; return true; } } diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h index b36cc8fb973..0d6141ea2f0 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h @@ -188,7 +188,7 @@ The types `FuzzyQueryItem::Point_d` and `Point_d` must be equivalent. To use this function `Traits` must be a model of the concept `RangeSearchTraits`. */ template -boost::optional search_any_point(FuzzyQueryItem q) const; +std::optional search_any_point(FuzzyQueryItem q) const; /*! Reports the points that are approximately contained by `q`. diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree_node.h b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree_node.h index 8d7d50f373e..3d92ae2dc36 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree_node.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree_node.h @@ -45,7 +45,7 @@ OutputIterator search(OutputIterator it, FuzzyQueryItem q) const; Reports any point from the subtree of the node, that is approximately contained by `q`. */ template -boost::optional search_any_point(OutputIterator it, FuzzyQueryItem q) const; +std::optional search_any_point(OutputIterator it, FuzzyQueryItem q) const; /*! Reports all the points contained by the subtree of the node. diff --git a/Spatial_searching/doc/Spatial_searching/Concepts/OrthogonalDistance.h b/Spatial_searching/doc/Spatial_searching/Concepts/OrthogonalDistance.h index d2a398589d8..d5b2af664e8 100644 --- a/Spatial_searching/doc/Spatial_searching/Concepts/OrthogonalDistance.h +++ b/Spatial_searching/doc/Spatial_searching/Concepts/OrthogonalDistance.h @@ -4,7 +4,7 @@ Requirements of an orthogonal distance class supporting incremental distance updates. To optimize distance computations transformed distances are used. -E.g., for an Euclidean distance the transformed distance is the squared Euclidean distance. +E.g., for a Euclidean distance the transformed distance is the squared Euclidean distance. \cgalRefines{GeneralDistance} diff --git a/Spatial_searching/doc/Spatial_searching/Spatial_searching.txt b/Spatial_searching/doc/Spatial_searching/Spatial_searching.txt index afa3a3eb0ca..b6f06106069 100644 --- a/Spatial_searching/doc/Spatial_searching/Spatial_searching.txt +++ b/Spatial_searching/doc/Spatial_searching/Spatial_searching.txt @@ -282,7 +282,7 @@ scenarios for different splitter types. \subsection Spatial_searchingExampleforKNeighborSearching Example for K Neighbor Searching -The first example illustrates k neighbor searching with an Euclidean +The first example illustrates k neighbor searching with a Euclidean distance and 2-dimensional points. The generated random data points are inserted in a search tree. We then initialize the k neighbor search object with the origin as query. Finally, we diff --git a/Spatial_searching/examples/Spatial_searching/searching_with_circular_query.cpp b/Spatial_searching/examples/Spatial_searching/searching_with_circular_query.cpp index 3f08f1278a4..de8f75f57db 100644 --- a/Spatial_searching/examples/Spatial_searching/searching_with_circular_query.cpp +++ b/Spatial_searching/examples/Spatial_searching/searching_with_circular_query.cpp @@ -30,7 +30,7 @@ int main() Point center(0.2, 0.2); Fuzzy_circle default_range(center, 0.2); - boost::optional any = tree.search_any_point(default_range); + std::optional any = tree.search_any_point(default_range); if(any) std::cout << *any << " is in the query circle\n"; else diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index 4ee61cb9214..7d79f7b6670 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -31,7 +31,7 @@ #include #include -#include +#include #ifdef CGAL_HAS_THREADS #include @@ -594,7 +594,7 @@ public: template - boost::optional + std::optional search_any_point(const FuzzyQueryItem& q) const { if(! pts.empty()){ @@ -605,7 +605,7 @@ public: Kd_tree_rectangle b(*bbox); return tree_root->search_any_point(q,b,begin(),cache_begin(),dim_); } - return boost::none; + return std::nullopt; } diff --git a/Spatial_searching/include/CGAL/Kd_tree_node.h b/Spatial_searching/include/CGAL/Kd_tree_node.h index c6af70495a2..b90068bf2ba 100644 --- a/Spatial_searching/include/CGAL/Kd_tree_node.h +++ b/Spatial_searching/include/CGAL/Kd_tree_node.h @@ -175,14 +175,14 @@ namespace CGAL { } - boost::optional + std::optional any_tree_item() const { - boost::optional result = boost::none; + std::optional result = std::nullopt; if (is_leaf()) { Leaf_node_const_handle node = static_cast(this); if (node->size()>0){ - return boost::make_optional(*(node->begin())); + return std::make_optional(*(node->begin())); } } else { @@ -273,14 +273,14 @@ namespace CGAL { template - boost::optional + std::optional search_any_point(const FuzzyQueryItem& q, Kd_tree_rectangle& b, typename Kdt::const_iterator tree_points_begin, typename std::vector::const_iterator cache_begin, int dim) const { - boost::optional result = boost::none; + std::optional result = std::nullopt; if (is_leaf()) { Leaf_node_const_handle node = static_cast(this); @@ -376,7 +376,7 @@ namespace CGAL { // With cache template - boost::optional search_any_point_in_leaf( + std::optional search_any_point_in_leaf( Leaf_node_const_handle node, const FuzzyQueryItem &q, typename Kdt::const_iterator tree_points_begin, @@ -384,7 +384,7 @@ namespace CGAL { int dim, Tag_true /*has_points_cache*/) const { - boost::optional result = boost::none; + std::optional result = std::nullopt; typename Kdt::iterator it_node_point = node->begin(), it_node_point_end = node->end(); typename std::vector::const_iterator cache_point_it = cache_begin + dim*(it_node_point - tree_points_begin); for (; it_node_point != it_node_point_end; ++it_node_point, cache_point_it += dim) @@ -401,7 +401,7 @@ namespace CGAL { // Without cache template - boost::optional search_any_point_in_leaf( + std::optional search_any_point_in_leaf( Leaf_node_const_handle node, const FuzzyQueryItem &q, typename Kdt::const_iterator /*tree_points_begin*/, @@ -409,7 +409,7 @@ namespace CGAL { int /*dim*/, Tag_false /*has_points_cache*/) const { - boost::optional result = boost::none; + std::optional result = std::nullopt; for (iterator i = node->begin(); i != node->end(); ++i) { if (q.contains(*i)) diff --git a/Spatial_searching/include/CGAL/Point_container.h b/Spatial_searching/include/CGAL/Point_container.h index eb96024348e..4c2b180b6ba 100644 --- a/Spatial_searching/include/CGAL/Point_container.h +++ b/Spatial_searching/include/CGAL/Point_container.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace CGAL { @@ -45,8 +45,8 @@ public: private: Traits traits; // the iterator range of the Point_container - boost::optional m_b ; - boost::optional m_e ; + std::optional m_b ; + std::optional m_e ; int built_coord; // a coordinate for which the pointer list is built Kd_tree_rectangle bbox; // bounding box, i.e. rectangle of node diff --git a/Straight_skeleton_2/benchmark/Straight_skeleton_2/compare_kernels_simple_polygon_skeleton.cpp b/Straight_skeleton_2/benchmark/Straight_skeleton_2/compare_kernels_simple_polygon_skeleton.cpp index c75bc824e4b..45b78c18a09 100644 --- a/Straight_skeleton_2/benchmark/Straight_skeleton_2/compare_kernels_simple_polygon_skeleton.cpp +++ b/Straight_skeleton_2/benchmark/Straight_skeleton_2/compare_kernels_simple_polygon_skeleton.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -97,7 +97,7 @@ void build_skeleton(const char* fname) time.start(); SsBuilder ssb; ssb.enter_contour(pgn.vertices_begin(), pgn.vertices_end()); - boost::shared_ptr straight_ske = ssb.construct_skeleton(); + std::shared_ptr straight_ske = ssb.construct_skeleton(); time.stop(); std::cout << "Time spent to build skeleton " << time.time() << "\n"; diff --git a/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton.cpp b/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton.cpp index c12cba7eae3..d3079e31211 100644 --- a/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton.cpp +++ b/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -13,8 +11,8 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; diff --git a/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton_tweaking_skeleton.cpp b/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton_tweaking_skeleton.cpp index 95a3bdd544e..ddde78f3327 100644 --- a/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton_tweaking_skeleton.cpp +++ b/Straight_skeleton_2/benchmark/Straight_skeleton_2/create_exterior_skeleton_tweaking_skeleton.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -13,8 +11,8 @@ typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; typedef Ss::Halfedge_const_iterator Halfedge_const_iterator ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; @@ -56,7 +54,7 @@ int main() if ( i->opposite()->vertex()->has_infinite_time() ) { - boost::optional op= + std::optional op= builder.Construct_offset_point(offset , i->opposite()); if(!op) continue; p=*op; @@ -66,7 +64,7 @@ int main() if( i->vertex()->has_infinite_time() ) { - boost::optional op= + std::optional op= builder.Construct_offset_point(offset , i); if(!op) continue; q=*op; diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Polygon_offset_builder_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Polygon_offset_builder_2.h index 3f4db57e881..65cbf5cbb71 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Polygon_offset_builder_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Polygon_offset_builder_2.h @@ -91,12 +91,12 @@ or external angle approaches `0`, numerical overflow may prevent some of the pol If that happens, the failed contour just won't be added into the resulting sequence. \tparam OutputIterator must be a model of the OutputIterator category whose `value_type` - is a `boost::shared_ptr` holding the dynamically allocated instances of type `Container`. + is a `std::shared_ptr` holding the dynamically allocated instances of type `Container`. \param t the offset value \param out an output iterator. For each resulting offset contour, a default constructed instance of `Container` type, is dynamically allocated and each offset vertex is added to it. - A `boost::shared_ptr` holding onto the dynamically allocated container is inserted + A `std::shared_ptr` holding onto the dynamically allocated container is inserted into the output sequence via the OutputIterator `out`. \returns an `OutputIterator` past-the-end of the resulting sequence, which contains each offset contour generated. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h index 9b69d3cc9f7..e1b3801f262 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h @@ -154,7 +154,7 @@ typedef Traits::Point_2 Point_2; /*! constructs the builder class. */ -Straight_skeleton_builder_2(boost::optional max_time = boost::none, +Straight_skeleton_builder_2(std::optional max_time = std::nullopt, const Traits& traits = Traits(), const Visitor& visitor = Visitor()); @@ -209,7 +209,7 @@ must be entered before calling `construct_skeleton()`. After `construct_skeleton()` completes, you cannot enter more contours and/or call `construct_skeleton()` again. If you need another straight skeleton for another polygon you must instantiate and use another builder. -The result is a dynamically allocated instance of the `Ss` class, wrapped in a `boost::shared_ptr`. +The result is a dynamically allocated instance of the `Ss` class, wrapped in a `std::shared_ptr`. If the construction process fails for whatever reason (such as a nearly-degenerate vertex whose internal or external angle is almost zero), the return value will be null, represented @@ -218,7 +218,7 @@ by a default constructed `shared_ptr`. The algorithm automatically checks the consistency of the result, thus, if it is not nullptr, it is guaranteed to be valid. */ -boost::shared_ptr construct_skeleton(); +std::shared_ptr construct_skeleton(); /// @} diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h index d3ff08ad9f4..a5ea28252e2 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h @@ -14,7 +14,7 @@ using the items converter `ic` to convert the geometric embedding to the types o \sa `CGAL::Straight_skeleton_converter_2` */ template -boost::shared_ptr +std::shared_ptr convert_straight_skeleton_2( Source_skeleton const& s, Items_converted const& ic = Items_converter() ); @@ -77,7 +77,7 @@ Straight_skeleton_converter_2( const Items_converter& c = Items_converter() ); /*! returns a new straight skeleton data structure with the same combinatorial and geometric data as `s` using the items converter to convert the geometric embeeding to the types of the target traits. */ -boost::shared_ptr operator()( const Source_skeleton& s) const; +std::shared_ptr operator()( const Source_skeleton& s) const; /// @} diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/arrange_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/arrange_offset_polygons_2.h index 5aabf233690..ce178e72d38 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/arrange_offset_polygons_2.h @@ -8,7 +8,7 @@ by `create_offset_polygons_2()` into 2D polygons with holes by determining geome relationships using a simple algorithm based on the particular characteristics of offset polygons. The function determines parent-hole relationships among the polygons given by `[begin,end]` creating -`boost::shared_ptr< GeneralPolygonWithHoles_2 >` objects added to the output sequence given `out`. +`std::shared_ptr< GeneralPolygonWithHoles_2 >` objects added to the output sequence given `out`. A `CLOCKWISE` oriented polygon `H` is a hole of a `COUNTERCLOCKWISE` polygon `P`, iff at least one vertex of `H` is `ON_BOUNDED_SIDE` of `P`. This function should not be used to arrange arbitrary polygons into polygons with holes unless they meet the requirements specified below. @@ -20,9 +20,9 @@ bounded or unbounded side of `Q` (but not both). \tparam K must be a model of `Kernel`. \tparam InputPolygonPtrIterator must be a model of `InputIterator` whose `value_type` is a smart pointer -(such as `boost::shared_ptr`) whose `element_type` is a model of `SequenceContainer` with value type `K::Point_2`. +(such as `std::shared_ptr`) whose `element_type` is a model of `SequenceContainer` with value type `K::Point_2`. \tparam OutputPolygonWithHolesPtrIterator must be a model of `OutputIterator` whose `value_type` is a smart pointer -(such as `boost::shared_ptr`) whose `element_type` is a model of `GeneralPolygonWithHoles_2`. +(such as `std::shared_ptr`) whose `element_type` is a model of `GeneralPolygonWithHoles_2`. \return `true` if no error was encountered, and `false` otherwise. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/compute_outer_frame_margin.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/compute_outer_frame_margin.h index 050c6dfba90..7db792ad14e 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/compute_outer_frame_margin.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/compute_outer_frame_margin.h @@ -47,7 +47,7 @@ the kernel in which the type `InputIterator::value_type` is defined. \sa `CGAL::Polygon_offset_builder_traits_2` */ template -boost::optional< typename Traits::FT > +std::optional< typename Traits::FT > compute_outer_frame_margin( InputIterator first, InputIterator beyond, typename Traits::FT offset, const Traits& traits = Default_traits ); diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h index 18362fb362a..551215202ae 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h @@ -25,7 +25,7 @@ will be generated in its exterior. \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_offset_polygons_2(FT offset, const StraightSkeleton& ss, OfK k = Exact_predicates_inexact_constructions_kernel()); @@ -66,7 +66,7 @@ the skeleton only once, and then call `create_offset_polygons_2()` for each dist \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_interior_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& outer_boundary, HoleIterator holes_begin, @@ -104,7 +104,7 @@ the skeleton only once, and then call `create_offset_polygons_2()` for each dist \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_interior_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& poly, OfK ofk = CGAL::Exact_predicates_inexact_constructions_kernel, @@ -145,7 +145,7 @@ therefore, to construct offsets at more than one single distance, use the separa \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_exterior_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& poly, OfK ofk = Exact_predicates_inexact_constructions_kernel(), diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index cdba6f53874..839612ff6f3 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -25,7 +25,7 @@ This is equivalent to `arrange_offset_polygons_2(create_interior_skeleton_and_of \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr< OfKPolygon > > +std::vector< std::shared_ptr< OfKPolygon > > create_interior_skeleton_and_offset_polygons_with_holes_2(FT offset, const InKPolygon& poly_with_holes, OfK ofk = CGAL::Exact_predicates_inexact_constructions_kernel, @@ -63,7 +63,7 @@ having reversed the orientation of all other polygons. \sa `Polygon_offset_builder_2` */ template -std::vector > +std::vector > create_exterior_skeleton_and_offset_polygons_with_holes_2(FT offset, const InKPolygon& poly_with_holes, OfK ofk = Exact_predicates_inexact_constructions_kernel(), diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_straight_skeleton_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_straight_skeleton_2.h index 9c1368732b3..c564807bffc 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_straight_skeleton_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_straight_skeleton_2.h @@ -26,7 +26,7 @@ and its holes given by `[holes_begin, holes_end[`. \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, HoleIterator holes_begin, @@ -52,7 +52,7 @@ The outer boundary of the polygon is given by the point sequence `[outer_contour \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, SsK k = CGAL::Exact_predicates_inexact_constructions_kernel()); @@ -79,7 +79,7 @@ create_interior_straight_skeleton_2(PointIterator outer_contour_vertices_begin, \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2(const Polygon& polygon, SsK k = CGAL::Exact_predicates_inexact_constructions_kernel()); @@ -110,7 +110,7 @@ from this exterior skeleton, as computed by the function `compute_outer_frame_ma \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_exterior_straight_skeleton_2(FT max_offset, PointIterator vertices_begin, PointIterator vertices_end, @@ -144,7 +144,7 @@ from this exterior skeleton, as computed by the function `compute_outer_frame_ma \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_exterior_straight_skeleton_2(FT max_offset, const Polygon& P, SsK k = CGAL::Exact_predicates_inexact_constructions_kernel()); diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h index 5627709d22b..e08f4d7b1d2 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h @@ -42,7 +42,7 @@ and `create_offset_polygons_2()` instead. */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_interior_weighted_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& outer_boundary, const InKWeights& outer_boundary_weights, @@ -84,7 +84,7 @@ and `create_offset_polygons_2()` instead. \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_interior_weighted_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& poly, const InKWeights& weights, @@ -130,7 +130,7 @@ therefore, to construct offsets at more than one single distance, use the separa \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_exterior_weighted_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& poly, const InKWeights& weights, diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index 3f68ff59b7e..e2f4f109648 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -25,7 +25,7 @@ This is equivalent to `arrange_offset_polygons_2(create_interior_weighted_skelet \sa `Polygon_offset_builder_2` */ template -std::vector< boost::shared_ptr< OfKPolygon > > +std::vector< std::shared_ptr< OfKPolygon > > create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, const InKPolygon& poly_with_holes, OfK ofk = CGAL::Exact_predicates_inexact_constructions_kernel, @@ -63,7 +63,7 @@ having reversed the orientation of all other polygons. \sa `Polygon_offset_builder_2` */ template -std::vector > +std::vector > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, const InKPolygon& poly_with_holes, OfK ofk = Exact_predicates_inexact_constructions_kernel(), diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h index ca9c472deeb..f036609721f 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h @@ -38,7 +38,7 @@ the `i`-th weight in the range is associated to the contour edge between the `i- template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, HoleIterator holes_begin, @@ -75,7 +75,7 @@ to the contour edge between the `i-1`-th and `i`-th vertices. \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, WeightIterator outer_contour_weights_begin, @@ -109,7 +109,7 @@ the `i`-th weight in the range is associated to the contour edge between the `i- \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_weighted_straight_skeleton_2(const InKPolygon& polygon, const InKWeights& weights, SsK k = CGAL::Exact_predicates_inexact_constructions_kernel()); @@ -147,7 +147,7 @@ is associated to the contour edge between the `i-1`-th and `i`-th vertices. \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_exterior_weighted_straight_skeleton_2(FT max_offset, PointIterator vertices_begin, PointIterator vertices_end, @@ -192,7 +192,7 @@ is associated to the contour edge between the `i-1`-th and `i`-th vertices. \sa `CGAL::Straight_skeleton_builder_2` */ template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_exterior_weighted_straight_skeleton_2(FT max_offset, const InKPolygon& P, const InKWeights& weights, diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/PolygonOffsetBuilderTraits_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/PolygonOffsetBuilderTraits_2.h index d0c364262cb..facdc0e6f83 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/PolygonOffsetBuilderTraits_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/PolygonOffsetBuilderTraits_2.h @@ -38,10 +38,10 @@ A construction object type. Must provide -`boost::optional operator()(const FT& t, const Segment_2& e0, const Segment_2& e1, const Trisegment_2_ptr& et) const`, +`std::optional operator()(const FT& t, const Segment_2& e0, const Segment_2& e1, const Trisegment_2_ptr& et) const`, which constructs the point of intersection of the lines obtained by offsetting -the oriented lines given by `e0` and `e0` an Euclidean distance `t`. +the oriented lines given by `e0` and `e0` a Euclidean distance `t`. If `e0` and `e1` are collinear, if `et` is not specified (`nullptr`), then the midpoint should be returned, otherwise, the event point of `et` should be returned. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonBuilderTraits_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonBuilderTraits_2.h index f971c1c880c..067b6e02c32 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonBuilderTraits_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonBuilderTraits_2.h @@ -64,11 +64,11 @@ A predicate object type. Must provide -`bool operator()( const Trisegment_2_ptr& tri_segment, boost::optional max_time ) const`, +`bool operator()( const Trisegment_2_ptr& tri_segment, std::optional max_time ) const`, which determines if, given the three oriented lines defined by the three input edges, -there exists an Euclidean distance `t >= 0` and `t <= max_time` for which the corresponding three -offset lines at `t` (parallel lines at an Euclidean distance of `t`) intersect in a single point. +there exists a Euclidean distance `t >= 0` and `t <= max_time` for which the corresponding three +offset lines at `t` (parallel lines at a Euclidean distance of `t`) intersect in a single point. \pre Each edge in the triple must properly define an oriented line, that is, its points cannot be coincident. */ @@ -109,7 +109,7 @@ A construction object type. Must provide -`boost::optional< boost::tuple > operator()( const Trisegment_2_ptr& e)`, +`std::optional< std::tuple > operator()( const Trisegment_2_ptr& e)`, which returns the Euclidean distance `t >= 0` and the intersection point at which the corresponding three offset lines at `t` intersect if they do. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonVertex_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonVertex_2.h index 7a26285dccf..1b66e17ee69 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonVertex_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/Concepts/StraightSkeletonVertex_2.h @@ -26,7 +26,7 @@ The type of the 2D point being the geometric embedding of the vertex typedef unspecified_type Point_2; /*! -A model of the `FieldWithSqrt` concept representing the time of a vertex (an Euclidean distance) +A model of the `FieldWithSqrt` concept representing the time of a vertex (a Euclidean distance) */ typedef unspecified_type FT; diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/Straight_skeleton_2.txt b/Straight_skeleton_2/doc/Straight_skeleton_2/Straight_skeleton_2.txt index b9a2ddb1de7..c771bf8929e 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/Straight_skeleton_2.txt +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/Straight_skeleton_2.txt @@ -467,11 +467,11 @@ To construct a set of inward offset contours the user must:
  • Construct the straight skeleton of the source polygon.
  • Instantiate the polygon offset builder passing in the straight skeleton as a parameter.
  • Call `Polygon_offset_builder_2::construct_offset_contours()` passing the desired offset - distance and an output iterator that can store a `boost::shared_ptr` of `Container` instances + distance and an output iterator that can store a `std::shared_ptr` of `Container` instances into a resulting sequence (typically, a back insertion iterator)
  • -Each element in the resulting sequence is an offset contour, given by a `boost::shared_ptr` +Each element in the resulting sequence is an offset contour, given by a `std::shared_ptr` holding a dynamically allocated instance of the Container type. Such a container can be any model of the `SequenceContainer` concept, for example, a `CGAL::Polygon_2`, or just a `std::vector` of 2D points. diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp index 5c38ea1223b..1d2967419e0 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -15,8 +15,8 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp index 1a4ed1ac668..61e71343578 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -16,8 +16,8 @@ typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp index 70d6f788217..1c3c5d8e3cc 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -16,8 +16,8 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp index f6906ab27b7..a751533ae55 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -15,7 +15,7 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Polygon_with_holes_2 PolygonWithHoles ; -typedef boost::shared_ptr PolygonWithHolesPtr ; +typedef std::shared_ptr PolygonWithHolesPtr ; typedef std::vector PolygonWithHolesPtrVector; diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp index 5aae2d904f1..84ecf3669ee 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K ; @@ -15,7 +13,7 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr SsPtr ; int main() { diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp index 00c8dab1181..84274655d63 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include @@ -15,7 +15,7 @@ typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr SsPtr ; int main() { diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Low_level_API.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Low_level_API.cpp index 387ea9647c1..675a25ff22e 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Low_level_API.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Low_level_API.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -22,7 +22,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_2 Point_2; typedef CGAL::Polygon_2 Contour; -typedef boost::shared_ptr ContourPtr; +typedef std::shared_ptr ContourPtr; typedef std::vector ContourSequence ; typedef CGAL::Straight_skeleton_2 Ss; @@ -66,7 +66,7 @@ int main() // First we need to determine the proper separation between the polygon and the frame. // We use this helper function provided in the package. - boost::optional margin = CGAL::compute_outer_frame_margin(star.begin(),star.end(),offset); + std::optional margin = CGAL::compute_outer_frame_margin(star.begin(),star.end(),offset); // Proceed only if the margin was computed (an extremely sharp corner might cause overflow) if ( margin ) @@ -97,7 +97,7 @@ int main() ssb.enter_contour(star.rbegin(),star.rend()); // Construct the skeleton - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); // Proceed only if the skeleton was correctly constructed. if ( ss ) diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_offset_polygon.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_offset_polygon.cpp index 296d721cc40..8a35567dafd 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_offset_polygon.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_offset_polygon.cpp @@ -4,7 +4,7 @@ #include #include "dump_to_eps.h" -#include +#include #include #include @@ -16,7 +16,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K ; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes ; -typedef boost::shared_ptr Polygon_with_holes_ptr ; +typedef std::shared_ptr Polygon_with_holes_ptr ; typedef std::vector Polygon_with_holes_ptr_vector ; diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp index 6f7bbd32443..a4e07d6dd2e 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp @@ -8,8 +8,6 @@ #include -#include - #include #include #include @@ -23,7 +21,7 @@ typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes ; typedef CGAL::Straight_skeleton_2 Straight_skeleton ; -typedef boost::shared_ptr Straight_skeleton_ptr ; +typedef std::shared_ptr Straight_skeleton_ptr ; int main( int argc, char* argv[] ) { diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/draw_straight_skeleton_2.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/draw_straight_skeleton_2.cpp index 2e87c323695..96f3da42c1d 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/draw_straight_skeleton_2.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/draw_straight_skeleton_2.cpp @@ -4,8 +4,6 @@ #include #include -#include - #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K ; @@ -14,7 +12,7 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr SsPtr ; int main() { diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/dump_to_eps.h b/Straight_skeleton_2/examples/Straight_skeleton_2/dump_to_eps.h index 5e94bf72b3d..efc8694a921 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/dump_to_eps.h +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/dump_to_eps.h @@ -84,11 +84,11 @@ void dump_to_eps( CGAL::Straight_skeleton_2 const& aSkeleton, char const* aTy template void dump_to_eps ( CGAL::Polygon_with_holes_2 const& aInput - , std::vector< boost::shared_ptr< CGAL::Polygon_with_holes_2 > > const& aOutput + , std::vector< std::shared_ptr< CGAL::Polygon_with_holes_2 > > const& aOutput , std::ostream& rOut ) { - typedef std::vector< boost::shared_ptr< CGAL::Polygon_with_holes_2 > > PolyWH_vector ; + typedef std::vector< std::shared_ptr< CGAL::Polygon_with_holes_2 > > PolyWH_vector ; CGAL::Bbox_2 lBbox = CGAL::bbox_2(aInput); diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/exterior_offset_of_multiple_polygons_with_holes.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/exterior_offset_of_multiple_polygons_with_holes.cpp index a3655becfe6..563fd207ef3 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/exterior_offset_of_multiple_polygons_with_holes.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/exterior_offset_of_multiple_polygons_with_holes.cpp @@ -3,9 +3,9 @@ #include #include -#include +#include -#include +#include #include #include @@ -16,8 +16,8 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Polygon_with_holes_2 PolygonWithHoles ; -typedef boost::shared_ptr PolygonWithHolesPtr ; -typedef boost::shared_ptr PolygonPtr ; +typedef std::shared_ptr PolygonWithHolesPtr ; +typedef std::shared_ptr PolygonPtr ; typedef std::vector PolygonWithHolesPtrVector; typedef std::vector PolygonPtrVector; @@ -30,7 +30,7 @@ exterior_offset_of_disjoint_polygons_with_holes(double lOffset, const std::vecto outer_vertices.insert(outer_vertices.end(), pwh.outer_boundary().container().begin(), pwh.outer_boundary().container().end()); - boost::optional margin = compute_outer_frame_margin(outer_vertices.begin(), + std::optional margin = compute_outer_frame_margin(outer_vertices.begin(), outer_vertices.end(), lOffset); diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/extrude_skeleton.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/extrude_skeleton.cpp index 073b50964c0..c4f4cf92a27 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/extrude_skeleton.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/extrude_skeleton.cpp @@ -13,11 +13,10 @@ #include #include -#include - #include #include #include +#include namespace SS = CGAL::CGAL_SS_i; namespace PMP = CGAL::Polygon_mesh_processing; @@ -42,7 +41,7 @@ using Polygon_2 = CGAL::Polygon_2; using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; using Straight_skeleton_2 = CGAL::Straight_skeleton_2; -using Straight_skeleton_2_ptr = boost::shared_ptr; +using Straight_skeleton_2_ptr = std::shared_ptr; using Mesh = CGAL::Surface_mesh; diff --git a/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_2.h b/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_2.h index bf5e9cfb78d..19ae42d71b3 100644 --- a/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_2.h @@ -16,8 +16,8 @@ #include #include -#include -#include +#include +#include #include @@ -69,9 +69,9 @@ public : typedef typename Traits::FT FT ; typedef typename Traits::Point_2 Point_2 ; - typedef boost::optional OptionalPoint_2 ; + typedef std::optional OptionalPoint_2 ; - typedef boost::shared_ptr ContainerPtr ; + typedef std::shared_ptr ContainerPtr ; Polygon_offset_builder_2( Ss const& aSs, Traits const& aTraits = Traits(), Visitor const& aVisitor = Visitor() ) ; @@ -150,7 +150,7 @@ public: return r ; } - boost::optional Construct_offset_point( FT aT, Halfedge_const_handle aBisector ) const + std::optional Construct_offset_point( FT aT, Halfedge_const_handle aBisector ) const { CGAL_assertion(aBisector->is_bisector()); CGAL_assertion(handle_assigned(aBisector->opposite())); diff --git a/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_traits_2.h b/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_traits_2.h index ec2950f74b5..a6d0571e9b9 100644 --- a/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_traits_2.h +++ b/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_traits_2.h @@ -18,7 +18,7 @@ #include #include -#include +#include namespace CGAL { @@ -50,7 +50,7 @@ struct Construct_offset_point_2 : Functor_base_2 typedef typename Base::Segment_2_with_ID Segment_2_with_ID ; typedef typename Base::Trisegment_2_ptr Trisegment_2_ptr ; - typedef boost::optional result_type ; + typedef std::optional result_type ; result_type operator() ( FT const& aT , Segment_2_with_ID const& aE0 diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/IO/print.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/IO/print.h index 33953f24ce3..a36df07b51e 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/IO/print.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/IO/print.h @@ -50,9 +50,9 @@ void print_polygon ( CGAL::Polygon_2 const& poly ) } template -void print_polygons ( std::vector< boost::shared_ptr< CGAL::Polygon_2 > > const& polies ) +void print_polygons ( std::vector< std::shared_ptr< CGAL::Polygon_2 > > const& polies ) { - typedef std::vector< boost::shared_ptr< CGAL::Polygon_2 > > PolygonVector ; + typedef std::vector< std::shared_ptr< CGAL::Polygon_2 > > PolygonVector ; std::cout << "Polygon list with " << polies.size() << " polygons" << std::endl ; @@ -74,10 +74,10 @@ void print_polygon_with_holes ( CGAL::Polygon_with_holes_2 const& polywh ) } template -void print_polygons_with_holes ( std::vector< boost::shared_ptr< CGAL::Polygon_with_holes_2 > > const& polies ) +void print_polygons_with_holes ( std::vector< std::shared_ptr< CGAL::Polygon_with_holes_2 > > const& polies ) { - typedef std::vector< boost::shared_ptr< CGAL::Polygon_with_holes_2 > > PolygonWithHolesVector ; + typedef std::vector< std::shared_ptr< CGAL::Polygon_with_holes_2 > > PolygonWithHolesVector ; std::cout << "Polygon_with_holes list with " << polies.size() << " element" << std::endl ; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h index 01328936363..c2b1c014482 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h @@ -15,7 +15,7 @@ #include -#include +#include #include @@ -37,13 +37,13 @@ vertices_end(const Poly& aPoly, template inline typename Poly::const_iterator -vertices_begin(const boost::shared_ptr& aPoly, +vertices_begin(const std::shared_ptr& aPoly, std::enable_if_t::value>* = nullptr) { return aPoly->begin(); } template inline typename Poly::const_iterator -vertices_end(const boost::shared_ptr & aPoly, +vertices_end(const std::shared_ptr & aPoly, std::enable_if_t::value>* = nullptr) { return aPoly->end(); } @@ -62,13 +62,13 @@ vertices_end(const PolyWithHoles& aPoly, template inline typename PolyWithHoles::Polygon_2::const_iterator -vertices_begin(const boost::shared_ptr& aPoly, +vertices_begin(const std::shared_ptr& aPoly, std::enable_if_t::value>* = nullptr) { return aPoly->outer_boundary().begin(); } template inline typename PolyWithHoles::Polygon_2::const_iterator -vertices_end(const boost::shared_ptr& aPoly, +vertices_end(const std::shared_ptr& aPoly, std::enable_if_t::value>* = nullptr) { return aPoly->outer_boundary().end(); } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h index c6d8ac62e72..1f18410c47a 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h @@ -308,7 +308,7 @@ OutputIterator Polygon_offset_builder_2::construct_offset_co mVisitor.on_construction_started(aTime); - mLastPoint = boost::none ; + mLastPoint = std::nullopt ; ResetBisectorData(); diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h index 8e5bdfdd6d2..a799eccda60 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h @@ -22,8 +22,7 @@ #include #include #include -#include -#include +#include #include #include diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h index 4ff69066a3a..5470ad13717 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h @@ -34,7 +34,7 @@ namespace CGAL { template -Straight_skeleton_builder_2::Straight_skeleton_builder_2 ( boost::optional aMaxTime, Traits const& aTraits, Visitor const& aVisitor ) +Straight_skeleton_builder_2::Straight_skeleton_builder_2 ( std::optional aMaxTime, Traits const& aTraits, Visitor const& aVisitor ) : mTraits(aTraits) ,mVisitor(aVisitor) @@ -1194,7 +1194,7 @@ void Straight_skeleton_builder_2::HandleSplitEvent( EventPtr aEvent, Ve Halfedge_handle lOppBorder = lEvent.triedge().e2() ; Vertex_handle lNewNode_L, lNewNode_R ; - boost::tie(lNewNode_L,lNewNode_R) = ConstructSplitEventNodes(lEvent,lOppR); + std::tie(lNewNode_L,lNewNode_R) = ConstructSplitEventNodes(lEvent,lOppR); // Triedge lTriedge = aEvent->triedge(); @@ -1419,7 +1419,7 @@ void Straight_skeleton_builder_2::HandlePseudoSplitEvent( EventPtr aEve CGAL_STSKEL_BUILDER_TRACE( 4, "LReed = " << v2str(*lRSeed) ); Vertex_handle lNewNode_L, lNewNode_R ; - boost::tie(lNewNode_L,lNewNode_R) = ConstructPseudoSplitEventNodes(lEvent); + std::tie(lNewNode_L,lNewNode_R) = ConstructPseudoSplitEventNodes(lEvent); Halfedge_handle lNBisector_LO = SSkelEdgesPushBack( Halfedge(mEdgeID ),Halfedge(mEdgeID+1) ); Halfedge_handle lNBisector_RO = SSkelEdgesPushBack( Halfedge(mEdgeID+2),Halfedge(mEdgeID+3) ); @@ -1622,7 +1622,7 @@ template void Straight_skeleton_builder_2::MergeSplitNodes ( Vertex_handle_pair aSplitNodes ) { Vertex_handle lLNode, lRNode ; - boost::tie(lLNode,lRNode)=aSplitNodes; + std::tie(lLNode,lRNode)=aSplitNodes; Halfedge_handle lIBisectorL1 = lLNode->primary_bisector()->opposite(); Halfedge_handle lIBisectorR1 = lRNode->primary_bisector()->opposite(); diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h index d521dc4257c..93048c58c45 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h @@ -27,22 +27,20 @@ #include #include -#include -#include -#include #include #include #include #include #include +#include namespace CGAL { namespace CGAL_SS_i { template -T const& validate ( boost::optional const& o ) +T const& validate ( std::optional const& o ) { if ( !o ) throw std::overflow_error("Arithmetic overflow"); @@ -57,17 +55,16 @@ NT const& validate( NT const& n ) return n ; } -// boost::make_optional is provided in Boost >= 1.34, but not before, so we define our own versions here. template -boost::optional cgal_make_optional( T const& v ) +std::optional cgal_make_optional( T const& v ) { - return boost::optional(v) ; + return std::optional(v) ; } template -boost::optional cgal_make_optional( bool cond, T const& v ) +std::optional cgal_make_optional( bool cond, T const& v ) { - return cond ? boost::optional(v) : boost::optional() ; + return cond ? std::optional(v) : std::optional() ; } template @@ -115,10 +112,10 @@ private: has_smaller_relative_precision(point.y(), precision); } - bool has_enough_precision(const boost::tuple& time_and_point, double precision) const + bool has_enough_precision(const std::tuple& time_and_point, double precision) const { - return has_smaller_relative_precision(boost::get<0>(time_and_point), precision) && - has_enough_precision(boost::get<1>(time_and_point), precision); + return has_smaller_relative_precision(std::get<0>(time_and_point), precision) && + has_enough_precision(std::get<1>(time_and_point), precision); } bool has_enough_precision(const CGAL::Trisegment_2 >& trisegment, double precision) const @@ -209,7 +206,7 @@ template struct FPU_checker; template -struct FPU_checker > > +struct FPU_checker > > { static bool is_valid() { @@ -219,7 +216,7 @@ struct FPU_checker > > }; template -struct FPU_checker > > +struct FPU_checker > > { static bool is_valid() { @@ -229,7 +226,7 @@ struct FPU_checker > > }; template -struct FPU_checker > > +struct FPU_checker > > { static bool is_valid() { @@ -277,20 +274,20 @@ struct SS_converter : Converter typedef Trisegment_2 Source_trisegment_2 ; typedef Trisegment_2 Target_trisegment_2 ; - typedef boost::tuple Source_time_and_point_2 ; - typedef boost::tuple Target_time_and_point_2 ; + typedef std::tuple Source_time_and_point_2 ; + typedef std::tuple Target_time_and_point_2 ; - typedef boost::optional Source_opt_FT ; - typedef boost::optional Target_opt_FT ; + typedef std::optional Source_opt_FT ; + typedef std::optional Target_opt_FT ; - typedef boost::optional Source_opt_point_2 ; - typedef boost::optional Target_opt_point_2 ; + typedef std::optional Source_opt_point_2 ; + typedef std::optional Target_opt_point_2 ; - typedef boost::optional Source_opt_time_and_point_2 ; - typedef boost::optional Target_opt_time_and_point_2 ; + typedef std::optional Source_opt_time_and_point_2 ; + typedef std::optional Target_opt_time_and_point_2 ; - typedef boost::optional Source_opt_segment_2 ; - typedef boost::optional Target_opt_segment_2 ; + typedef std::optional Source_opt_segment_2 ; + typedef std::optional Target_opt_segment_2 ; typedef typename Source_trisegment_2::Self_ptr Source_trisegment_2_ptr ; typedef typename Target_trisegment_2::Self_ptr Target_trisegment_2_ptr ; @@ -324,7 +321,7 @@ struct SS_converter : Converter { Source_FT t ; Source_point_2 p ; - boost::tie(t,p) = v ; + std::tie(t,p) = v ; return Target_time_and_point_2(cvt_n(t),cvt_p(p)); } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_caches.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_caches.h index 05733500bd1..640a078953a 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_caches.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_caches.h @@ -83,13 +83,13 @@ struct Info_cache }; template -using Coeff_cache = Info_cache > ; +using Coeff_cache = Info_cache > ; template -using Time_cache = Info_cache > > ; +using Time_cache = Info_cache > > ; template -using Point_cache = Info_cache > ; +using Point_cache = Info_cache > ; template struct Caches @@ -118,9 +118,9 @@ struct No_caches { void Reset ( std::size_t ) { } - No_cache > mCoeff_cache; - No_cache > > mTime_cache; - No_cache > mPoint_cache; + No_cache > mCoeff_cache; + No_cache > > mTime_cache; + No_cache > mPoint_cache; }; } // namespace CGAL_SS_i diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h index f6a2396d049..f66dad79690 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h @@ -20,14 +20,15 @@ #endif #include -#include +#include #include #include #include +#include template -inline std::string o2str( boost::optional const& o ) +inline std::string o2str( std::optional const& o ) { std::ostringstream ss ; ss << std::setprecision(17) ; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h index d6177f02e4c..90110820a36 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -22,9 +22,6 @@ #include #include -#include -#include -#include #include #include @@ -111,7 +108,7 @@ public: typedef SSkel_ SSkel ; typedef Visitor_ Visitor ; - typedef boost::shared_ptr SSkelPtr ; + typedef std::shared_ptr SSkelPtr ; private : @@ -220,7 +217,7 @@ private : public: - Straight_skeleton_builder_2 ( boost::optional aMaxTime = boost::none, Traits const& = Traits(), Visitor const& aVisitor = Visitor() ) ; + Straight_skeleton_builder_2 ( std::optional aMaxTime = std::nullopt, Traits const& = Traits(), Visitor const& aVisitor = Visitor() ) ; SSkelPtr construct_skeleton( bool aNull_if_failed = true ) ; @@ -1067,9 +1064,9 @@ private : } } - boost::tuple ConstructEventTimeAndPoint( Trisegment_2_ptr const& aS ) const + std::tuple ConstructEventTimeAndPoint( Trisegment_2_ptr const& aS ) const { - boost::optional< boost::tuple > r = mTraits.construct_ss_event_time_and_point_2_object()( aS ) ; + std::optional< std::tuple > r = mTraits.construct_ss_event_time_and_point_2_object()( aS ) ; CGAL_postcondition_msg(!!r, "Unable to compute skeleton node coordinates"); return *r ; } @@ -1078,7 +1075,7 @@ private : { FT lTime ; Point_2 lP ; - boost::tie(lTime,lP) = ConstructEventTimeAndPoint(aE.trisegment()); + std::tie(lTime,lP) = ConstructEventTimeAndPoint(aE.trisegment()); aE.SetTimeAndPoint(lTime,lP); } @@ -1237,7 +1234,7 @@ private: int mEventID ; int mStepID ; - boost::optional mMaxTime ; + std::optional mMaxTime ; PQ mPQ ; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h index 50266d6a27d..2568caa16bc 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h @@ -23,8 +23,7 @@ #include #include -#include -#include +#include #include #include @@ -80,7 +79,7 @@ struct Do_ss_event_exist_2 : Functor_base_2 : mCaches(aCaches) {} - Uncertain operator() ( Trisegment_2_ptr const& aTrisegment, boost::optional aMaxTime ) const + Uncertain operator() ( Trisegment_2_ptr const& aTrisegment, std::optional aMaxTime ) const { Uncertain rResult = exist_offset_lines_isec2(aTrisegment, aMaxTime, mCaches); @@ -241,9 +240,9 @@ struct Construct_ss_event_time_and_point_2 : Functor_base_2 typedef typename Base::Segment_2_with_ID Segment_2_with_ID ; typedef typename Base::Trisegment_2_ptr Trisegment_2_ptr ; - typedef boost::tuple rtype ; + typedef std::tuple rtype ; - typedef boost::optional result_type ; + typedef std::optional result_type ; Construct_ss_event_time_and_point_2(Caches& aCaches) : mCaches(aCaches) @@ -256,13 +255,13 @@ struct Construct_ss_event_time_and_point_2 : Functor_base_2 FT t(0) ; Point_2 i = ORIGIN ; - boost::optional< Rational > ot = compute_offset_lines_isec_timeC2(aTrisegment, mCaches); + std::optional< Rational > ot = compute_offset_lines_isec_timeC2(aTrisegment, mCaches); if ( !!ot && certainly( CGAL_NTS certified_is_not_zero(ot->d()) ) ) { t = ot->n() / ot->d(); - boost::optional oi = construct_offset_lines_isecC2(aTrisegment, mCaches); + std::optional oi = construct_offset_lines_isecC2(aTrisegment, mCaches); if ( oi ) { i = *oi ; @@ -272,7 +271,7 @@ struct Construct_ss_event_time_and_point_2 : Functor_base_2 CGAL_STSKEL_ASSERT_CONSTRUCTION_RESULT(lOK,K,"Construct_ss_event_time_and_point_2",aTrisegment); - return cgal_make_optional(lOK,boost::make_tuple(t,i)) ; + return cgal_make_optional(lOK,std::make_tuple(t,i)) ; } private: @@ -406,7 +405,7 @@ public: if(mCaches.mCoeff_cache.Get(aOtherID)) mCaches.mCoeff_cache.Set(aID, CGAL_SS_i::cgal_make_optional(*(mCaches.mCoeff_cache.Get(aOtherID)))); else - mCaches.mCoeff_cache.Set(aID, boost::none); + mCaches.mCoeff_cache.Set(aID, std::nullopt); } // functions and tag for filtering split events @@ -420,7 +419,7 @@ public: return false; typename Base::Trisegment_2_ptr tri = lEvent->trisegment() ; - boost::optional > lOptTime = + std::optional > lOptTime = CGAL_SS_i::compute_offset_lines_isec_timeC2(tri, mCaches); if ( lOptTime && lOptTime->to_nt() > *mFilteringBound ) @@ -450,7 +449,7 @@ public: CGAL_STSKEL_TRAITS_TRACE("Computing filtering bound of V" << aNode->id() << " [" << typeid(FT).name() << "]" ); - mFilteringBound = boost::none; + mFilteringBound = std::nullopt; // No gain observed on norway while doing it for more than contour nodes if(!aNode->is_contour()) @@ -468,8 +467,8 @@ public: lHR->vertex()->point(), lHR->id()); - boost::optional< Line_2 > lL = CGAL_SS_i::compute_weighted_line_coeffC2(lSL, lHL->weight(), mCaches); - boost::optional< Line_2 > lR = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lHR->weight(), mCaches); + std::optional< Line_2 > lL = CGAL_SS_i::compute_weighted_line_coeffC2(lSL, lHL->weight(), mCaches); + std::optional< Line_2 > lR = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lHR->weight(), mCaches); Vector_2 lVL( lL->b(), - lL->a()) ; Vector_2 lVR(- lR->b(), lR->a()) ; @@ -497,7 +496,7 @@ public: // See the other function for the equations CGAL_SS_i::Segment_2_with_ID lSh (s_h, (*h)->id()); - boost::optional< Line_2 > lh = CGAL_SS_i::compute_normalized_line_coeffC2(lSh, mCaches); + std::optional< Line_2 > lh = CGAL_SS_i::compute_normalized_line_coeffC2(lSh, mCaches); FT lLambda = - ( lh->a()*laP.x() + lh->b()*laP.y() + lh->c() ) / ( lh->a()*lVLR.x() + lh->b()*lVLR.y() ) ; @@ -523,7 +522,7 @@ public: public: mutable std::size_t mTrisegment_ID = 0 ; mutable CGAL_SS_i::Caches mCaches ; - mutable boost::optional< typename K::FT > mFilteringBound ; + mutable std::optional< typename K::FT > mFilteringBound ; } ; template @@ -723,7 +722,7 @@ public: try { - boost::optional > lOptTime = + std::optional > lOptTime = CGAL_SS_i::compute_offset_lines_isec_timeC2(tri, mApproximate_traits.mCaches); if ( lOptTime && lOptTime->to_nt() > *mApproximate_traits.mFilteringBound ) @@ -759,7 +758,7 @@ public: CGAL_STSKEL_TRAITS_TRACE("Computing approximate filtering bound of V" << aNode->id() << " [" << typeid(Target_FT).name() << "]" ); - mApproximate_traits.mFilteringBound = boost::none; + mApproximate_traits.mFilteringBound = std::nullopt; // No gain observed on norway while doing it for more than contour nodes if(!aNode->is_contour()) @@ -781,8 +780,8 @@ public: lToFiltered(lHR->vertex()->point()), lHR->id()); - boost::optional lL = CGAL_SS_i::compute_weighted_line_coeffC2(lSL, lToFiltered(lHL->weight()), mApproximate_traits.mCaches); - boost::optional lR = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lToFiltered(lHR->weight()), mApproximate_traits.mCaches); + std::optional lL = CGAL_SS_i::compute_weighted_line_coeffC2(lSL, lToFiltered(lHL->weight()), mApproximate_traits.mCaches); + std::optional lR = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lToFiltered(lHR->weight()), mApproximate_traits.mCaches); Target_Point_2 laP = lToFiltered(aNode->point()); @@ -834,7 +833,7 @@ public: // lambda = - T / (d0 + d1) * n2 Target_Segment_with_ID_2 lSh (s_h, (*h)->id()); - boost::optional lh = CGAL_SS_i::compute_normalized_line_coeffC2(lSh, mApproximate_traits.mCaches); + std::optional lh = CGAL_SS_i::compute_normalized_line_coeffC2(lSh, mApproximate_traits.mCaches); Target_FT lLambda = - ( lh->a()*laP.x() + lh->b()*laP.y() + lh->c() ) / ( lh->a()*lVLR.x() + lh->b()*lVLR.y() ) ; @@ -860,7 +859,7 @@ public: std::cout << "lAP+v " << laP + lVLR << std::endl; std::cout << "Inter pt: " << *ip << std::endl; - boost::optional lh1 = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lToFiltered(lHR->weight()), mApproximate_traits.mCaches); + std::optional lh1 = CGAL_SS_i::compute_weighted_line_coeffC2(lSR, lToFiltered(lHR->weight()), mApproximate_traits.mCaches); std::cout << "lh0 check" << square(lh0->a()) + square(lh0->b()) << std::endl; std::cout << "lh1 check" << square(lh1->a()) + square(lh1->b()) << std::endl; @@ -870,7 +869,7 @@ public: std::cout << "l1 time at aNode + lVLR: " << lh1->a()*(laP + lVLR).x() + lh1->b()*(laP + lVLR).y() + lh1->c() << std::endl; auto ipp = FK().intersect_2_object()(s_h, bisect_ray); - Target_Point_2* ip = boost::get(&*ipp); + Target_Point_2* ip = std::get(&*ipp); std::cout << "l0 time at inter pt: " << lh0->a()*ip->x() + lh0->b()*ip->y() + lh0->c() << std::endl; std::cout << "l1 time at inter pt: " << lh1->a()*ip->x() + lh1->b()*ip->y() + lh1->c() << std::endl; std::cout << "lh-> " << lh->a() << " " << lh->b() << " " << square(lh->a()) + square(lh->b()) << std::endl; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_converter_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_converter_2.h index dc04a7a0dad..443c5a227db 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_converter_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_converter_2.h @@ -19,7 +19,8 @@ #include #include -#include +#include + #include @@ -179,7 +180,7 @@ struct Straight_skeleton_converter_2 typedef typename Source_skeleton::Traits Source_traits ; typedef typename Target_skeleton::Traits Target_traits ; - typedef boost::shared_ptr Target_skeleton_ptr ; + typedef std::shared_ptr Target_skeleton_ptr ; typedef typename Source_skeleton::Vertex_const_iterator Source_vertex_const_iterator ; typedef typename Source_skeleton::Halfedge_const_iterator Source_halfedge_const_iterator ; @@ -349,7 +350,7 @@ private : } ; template -boost::shared_ptr +std::shared_ptr convert_straight_skeleton_2 ( Source_skeleton const& aSrc, Items_converter const& ic ) { typedef Straight_skeleton_converter_2 Skeleton_converter ; @@ -361,7 +362,7 @@ convert_straight_skeleton_2 ( Source_skeleton const& aSrc, Items_converter const } template -boost::shared_ptr +std::shared_ptr convert_straight_skeleton_2 ( Source_skeleton const& aSrc ) { typedef Straight_skeleton_items_converter_2 Items_converter ; diff --git a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h index da2b6560fea..cd63666e9e7 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -49,7 +49,7 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin typedef typename std::iterator_traits::difference_type difference_type ; typedef typename std::iterator_traits::value_type PolygonPtr ; - typedef boost::shared_ptr PolygonWithHolesPtr ; + typedef std::shared_ptr PolygonWithHolesPtr ; difference_type lSize = std::distance(aBegin,aEnd); @@ -108,18 +108,18 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin } template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline -arrange_offset_polygons_2 ( std::vector > const& aPolygons, +arrange_offset_polygons_2 ( std::vector > const& aPolygons, bool& no_error) { - typedef std::vector< boost::shared_ptr > result_type ; + typedef std::vector< std::shared_ptr > result_type ; typedef std::back_insert_iterator Back_inserter; typedef typename PolygonWithHoles::General_polygon_2 Polygon_2 ; typedef typename Kernel_traits::type>::Kernel K ; - typedef typename std::vector >::const_iterator PolygonIterator ; + typedef typename std::vector >::const_iterator PolygonIterator ; result_type rResult ; no_error = arrange_offset_polygons_2( @@ -129,9 +129,9 @@ arrange_offset_polygons_2 ( std::vector > const& aPol } template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline -arrange_offset_polygons_2 ( std::vector > const& aPolygons) +arrange_offset_polygons_2 ( std::vector > const& aPolygons) { bool no_error; return arrange_offset_polygons_2(aPolygons, no_error); diff --git a/Straight_skeleton_2/include/CGAL/compute_outer_frame_margin.h b/Straight_skeleton_2/include/CGAL/compute_outer_frame_margin.h index 235589bd93f..941c7e3ca1e 100644 --- a/Straight_skeleton_2/include/CGAL/compute_outer_frame_margin.h +++ b/Straight_skeleton_2/include/CGAL/compute_outer_frame_margin.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -25,7 +25,7 @@ namespace CGAL { template -boost::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPointIterator aBegin +std::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPointIterator aBegin , ForwardPointIterator aEnd , WeightIterator aWBegin , WeightIterator CGAL_assertion_code(aWEnd) @@ -46,7 +46,7 @@ boost::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPoint typename Kernel::Compute_squared_distance_2 squared_distance = kernel.compute_squared_distance_2_object(); typename Kernel::Construct_segment_2 construct_segment = kernel.construct_segment_2_object(); - typedef boost::optional OptionalPoint_2 ; + typedef std::optional OptionalPoint_2 ; CGAL_STSKEL_BUILDER_TRACE(2, "Computing outer frame margin..." ); @@ -101,16 +101,16 @@ boost::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPoint // Add a %5 gap, and ceil to get simpler values CGAL_STSKEL_BUILDER_TRACE(4, "outer frame margin: " << approx ); - return boost::optional ( approx ) ; + return std::optional ( approx ) ; } - return boost::none; + return std::nullopt; } // `Traits` first is to help overload resolution in the 3-argument version (see below) template -boost::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPointIterator aBegin +std::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPointIterator aBegin , ForwardPointIterator aEnd , typename Traits::FT aOffset , Traits const& aTraits @@ -122,7 +122,7 @@ boost::optional< typename Traits::FT > compute_outer_frame_margin ( ForwardPoint } template -boost::optional compute_outer_frame_margin(ForwardPointIterator aBegin, +std::optional compute_outer_frame_margin(ForwardPointIterator aBegin, ForwardPointIterator aEnd, WeightIterator aWBegin, WeightIterator aWEnd, @@ -138,7 +138,7 @@ boost::optional compute_outer_frame_margin(ForwardPointIterator aBegin, } template -boost::optional compute_outer_frame_margin(ForwardPointIterator aBegin, +std::optional compute_outer_frame_margin(ForwardPointIterator aBegin, ForwardPointIterator aEnd, const FT aOffset) { diff --git a/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h b/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h index 78ff0b0368e..4a76f705eb7 100644 --- a/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h @@ -15,7 +15,7 @@ #include -#include +#include namespace CGAL { @@ -31,7 +31,7 @@ namespace CGAL_SS_i { // POSTCONDITION: In case of overflow an empty optional is returned. // template -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_offset_pointC2 ( typename K::FT const& t, Segment_2_with_ID const& e0, typename K::FT const& w0, @@ -45,8 +45,8 @@ construct_offset_pointC2 ( typename K::FT const& t, typedef typename K::Point_2 Point_2 ; typedef typename K::Line_2 Line_2 ; - typedef boost::optional Optional_point_2 ; - typedef boost::optional Optional_line_2 ; + typedef std::optional Optional_point_2 ; + typedef std::optional Optional_line_2 ; FT x(0.0),y(0.0) ; diff --git a/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h b/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h index b968c287195..9d04a209e26 100644 --- a/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include @@ -60,9 +60,9 @@ Trisegment_collinearity trisegment_collinearity_no_exact_constructions(const Seg // we could also have that are_edges_orderly_collinear() returns false, but the computed coefficients // are identical. In that case, we want to return that there is a collinearity, otherwise the internal // computations (even the exact ones) will fail. - boost::optional l0 = compute_normalized_line_coeffC2(e0, caches); - boost::optional l1 = compute_normalized_line_coeffC2(e1, caches); - boost::optional l2 = compute_normalized_line_coeffC2(e2, caches); + std::optional l0 = compute_normalized_line_coeffC2(e0, caches); + std::optional l1 = compute_normalized_line_coeffC2(e1, caches); + std::optional l2 = compute_normalized_line_coeffC2(e2, caches); bool is_01 = (l0->a() == l1->a()) && (l0->b() == l1->b()) && (l0->c() == l1->c()); bool is_02 = (l0->a() == l2->a()) && (l0->b() == l2->b()) && (l0->c() == l2->c()); @@ -141,7 +141,7 @@ inexact_sqrt(const Lazy_exact_nt& lz) // POSTCONDITION: [a,b] is the leftward normal vector. // POSTCONDITION: In case of overflow, an empty optional<> is returned. template -boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2 const& e ) +std::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2 const& e ) { typedef typename K::FT FT ; @@ -222,7 +222,7 @@ boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2< } template -boost::optional< typename K::Line_2> compute_normalized_line_coeffC2(const Segment_2_with_ID& e) +std::optional< typename K::Line_2> compute_normalized_line_coeffC2(const Segment_2_with_ID& e) { typedef typename K::Segment_2 Segment_2 ; @@ -232,7 +232,7 @@ boost::optional< typename K::Line_2> compute_normalized_line_coeffC2(const Segme } template -boost::optional< typename K::Line_2 > +std::optional< typename K::Line_2 > compute_normalized_line_coeffC2( Segment_2_with_ID const& e, Caches& aCaches ) { @@ -241,7 +241,7 @@ compute_normalized_line_coeffC2( Segment_2_with_ID const& e, if(aCaches.mCoeff_cache.IsCached(e.mID) ) return aCaches.mCoeff_cache.Get(e.mID) ; - boost::optional< Line_2 > rRes = compute_normalized_line_coeffC2 ( e ) ; + std::optional< Line_2 > rRes = compute_normalized_line_coeffC2 ( e ) ; aCaches.mCoeff_cache.Set(e.mID, rRes) ; @@ -251,18 +251,18 @@ compute_normalized_line_coeffC2( Segment_2_with_ID const& e, // @todo weightless coefficients are stored because we use them sometimes weighted, and sometimes // inversely weighted (filtering bound). Should we store them weighted also for speed reasons? template -boost::optional< typename K::Line_2 > compute_weighted_line_coeffC2( Segment_2_with_ID const& e, - typename K::FT const& aWeight, - Caches& aCaches ) +std::optional< typename K::Line_2 > compute_weighted_line_coeffC2( Segment_2_with_ID const& e, + typename K::FT const& aWeight, + Caches& aCaches ) { typedef typename K::FT FT ; typedef typename K::Line_2 Line_2 ; CGAL_precondition( CGAL_NTS is_finite(aWeight) && CGAL_NTS is_positive(aWeight) ) ; - boost::optional< Line_2 > l = compute_normalized_line_coeffC2(e, aCaches); + std::optional< Line_2 > l = compute_normalized_line_coeffC2(e, aCaches); if( ! l ) - return boost::none ; + return std::nullopt ; FT a = l->a() * aWeight ; FT b = l->b() * aWeight ; @@ -274,7 +274,7 @@ boost::optional< typename K::Line_2 > compute_weighted_line_coeffC2( Segment_2_w ) ; if ( !CGAL_NTS is_finite(a) || !CGAL_NTS is_finite(b) || !CGAL_NTS is_finite(c) ) - return boost::none; + return std::nullopt; return cgal_make_optional( K().construct_line_2_object()(a,b,c) ) ; } @@ -328,7 +328,7 @@ construct_trisegment ( Segment_2_with_ID const& e0, // If the lines do not intersect, for example, for collinear edges, or parallel edges but with the same orientation, // returns 0 (the actual distance is undefined in this case, but 0 is a useful return) // -// NOTE: The result is a explicit rational number returned as a tuple (num,den); the caller must check that den!=0 manually +// NOTE: The result is an explicit rational number returned as a tuple (num,den); the caller must check that den!=0 manually // (a predicate for instance should return indeterminate in this case) // // PRECONDITION: None of e0, e1 and e2 are collinear (but two of them can be parallel) @@ -338,14 +338,14 @@ construct_trisegment ( Segment_2_with_ID const& e0, // NOTE: The segments (e0,e1,e2) are stored in the argument as the trisegment st.event() // template -boost::optional< Rational< typename K::FT> > +std::optional< Rational< typename K::FT> > compute_normal_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { typedef typename K::FT FT ; typedef typename K::Line_2 Line_2 ; - typedef boost::optional Optional_line_2 ; + typedef std::optional Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec time [" << typeid(FT).name() << "]") ; CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); @@ -416,7 +416,7 @@ compute_normal_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > compute_oriented_midpoint ( Segment_2_with_ID const& e0, Segment_2_with_ID const& e1 ) { @@ -482,12 +482,12 @@ compute_oriented_midpoint ( Segment_2_with_ID const& e0, // If you request the point of such degenerate pseudo seed the oriented midpoint between e0 and e2 is returned. // template -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > compute_seed_pointC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, typename Trisegment_2 >::SEED_ID sid, Caches& aCaches) { - boost::optional< typename K::Point_2 > p ; + std::optional< typename K::Point_2 > p ; typedef Trisegment_2 > Trisegment_2 ; @@ -521,7 +521,7 @@ compute_seed_pointC2 ( Trisegment_2_ptr< Trisegment_2 > // of the degenerate seed. // A normal collinearity occurs when e0,e1 or e1,e2 are collinear. template -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_degenerate_seed_pointC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -529,7 +529,7 @@ construct_degenerate_seed_pointC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< Rational< typename K::FT> > +std::optional< Rational< typename K::FT> > compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -541,7 +541,7 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 Optional_line_2 ; + typedef std::optional Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing artificial isec time [" << typeid(FT).name() << "]"); CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); @@ -551,15 +551,15 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2e0(), tri->w0(), aCaches) ; if( !l0 ) - return boost::none ; + return std::nullopt; const Segment_2& contour_seg = tri->e0(); Direction_2 perp_dir ( contour_seg.source().y() - contour_seg.target().y() , contour_seg.target().x() - contour_seg.source().x() ) ; - boost::optional< typename K::Point_2 > seed = construct_offset_lines_isecC2(tri->child_l(), aCaches ) ; + std::optional< typename K::Point_2 > seed = construct_offset_lines_isecC2(tri->child_l(), aCaches ) ; if(!seed) - return boost::none; + return std::nullopt; const Ray_2 ray(*seed, perp_dir); const Segment_2& opp_seg = tri->e2(); @@ -572,7 +572,7 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2(&*inter_res)) + if(const Segment_2* seg = std::get_if(&*inter_res)) { // get the segment extremity closest to the seed Boolean res = (K().compare_distance_2_object()(*seed, seg->source(), seg->target()) == CGAL::SMALLER); @@ -581,9 +581,9 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2(&*inter_res); + const Point_2* inter_pt = std::get_if(&*inter_res); if(!CGAL_NTS is_finite(inter_pt->x()) || !CGAL_NTS is_finite(inter_pt->y())) - return boost::none; + return std::nullopt; t = l0->a() * inter_pt->x() + l0->b() * inter_pt->y() + l0->c() ; } @@ -596,13 +596,13 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< Rational< typename K::FT> > +std::optional< Rational< typename K::FT> > compute_degenerate_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -611,8 +611,8 @@ compute_degenerate_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 Optional_point_2 ; - typedef boost::optional Optional_line_2 ; + typedef std::optional Optional_point_2 ; + typedef std::optional Optional_line_2 ; if(tri->e0() == tri->e1()) // marker for artificial bisectors: they have the same face on both sides return compute_artifical_isec_timeC2(tri, aCaches) ; @@ -752,19 +752,18 @@ compute_degenerate_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 Returning 0/0 (no event)"); - // if we return boost::none, exist_offset_lines_isec2() will think it's a numerical error return cgal_make_optional(Rational(FT(0),FT(0))) ; } } - return boost::none; + return std::nullopt; } // // Calls the appropriate function depending on the collinearity of the edges. // template -boost::optional< Rational< typename K::FT > > +std::optional< Rational< typename K::FT > > compute_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -776,7 +775,7 @@ compute_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2collinearity() != TRISEGMENT_COLLINEARITY_ALL ) ; - boost::optional< Rational > rRes = + std::optional< Rational > rRes = tri->collinearity() == TRISEGMENT_COLLINEARITY_NONE ? compute_normal_offset_lines_isec_timeC2 (tri, aCaches) : compute_degenerate_offset_lines_isec_timeC2(tri, aCaches); @@ -797,7 +796,7 @@ compute_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_normal_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches) { @@ -805,7 +804,7 @@ construct_normal_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 Optional_line_2 ; + typedef std::optional Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec point [" << typeid(FT).name() << "]"); CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); @@ -851,7 +850,7 @@ construct_normal_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_artifical_isecC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -869,23 +868,23 @@ construct_artifical_isecC2 ( Trisegment_2_ptr< Trisegment_2e0(); Direction_2 perp_dir ( contour_seg.source().y() - contour_seg.target().y() , contour_seg.target().x() - contour_seg.source().x() ) ; - boost::optional< typename K::Point_2 > seed = construct_offset_lines_isecC2(tri->child_l(), aCaches) ; + std::optional< typename K::Point_2 > seed = construct_offset_lines_isecC2(tri->child_l(), aCaches) ; if(!seed) - return boost::none; + return std::nullopt; const Ray_2 ray(*seed, perp_dir); const Segment_2& opp_seg = tri->e2(); auto inter_res = K().intersect_2_object()(ray, opp_seg); if (!inter_res) // shouldn't be here if there is no intersection - return boost::none; + return std::nullopt; - if(const Point_2* inter_pt = boost::get(&*inter_res)) + if(const Point_2* inter_pt = std::get_if(&*inter_res)) { bool ok = CGAL_NTS is_finite(inter_pt->x()) && CGAL_NTS is_finite(inter_pt->y()) ; return cgal_make_optional(ok, *inter_pt) ; } - else if(const Segment_2* seg = boost::get(&*inter_res)) + else if(const Segment_2* seg = std::get_if(&*inter_res)) { // get the segment extremity closest to the seed const Point_2& pt = (K().compare_distance_2_object()(*seed, @@ -895,7 +894,7 @@ construct_artifical_isecC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_degenerate_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches) { @@ -920,8 +919,8 @@ construct_degenerate_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 Optional_point_2 ; - typedef boost::optional Optional_line_2 ; + typedef std::optional Optional_point_2 ; + typedef std::optional Optional_line_2 ; if(tri->e0() == tri->e1()) // marker for artificial bisectors: they have the same face on both sides return construct_artifical_isecC2(tri, aCaches) ; @@ -1021,7 +1020,7 @@ construct_degenerate_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 -boost::optional< typename K::Point_2 > +std::optional< typename K::Point_2 > construct_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, Caches& aCaches ) { @@ -1034,7 +1033,7 @@ construct_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2collinearity() != TRISEGMENT_COLLINEARITY_ALL ) ; - boost::optional< Point_2 > rRes = + std::optional< Point_2 > rRes = tri->collinearity() == TRISEGMENT_COLLINEARITY_NONE ? construct_normal_offset_lines_isecC2 (tri, aCaches) : construct_degenerate_offset_lines_isecC2(tri, aCaches); diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h index 5e1401c12c8..bbdf0d15853 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -29,9 +29,9 @@ #include #include -#include +#include #include -#include +#include #include #include @@ -44,7 +44,7 @@ namespace CGAL { namespace CGAL_SS_i { template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_partial_interior_straight_skeleton_2 ( FT const& aMaxTime , PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd @@ -67,7 +67,7 @@ create_partial_interior_straight_skeleton_2 ( FT const& aMaxTime Cartesian_converter conv ; typename InputKernel::FT lMaxTime = aMaxTime; - boost::optional lOptMaxTime(conv(lMaxTime)) ; + std::optional lOptMaxTime(conv(lMaxTime)) ; SsBuilder ssb( lOptMaxTime ) ; @@ -80,7 +80,7 @@ create_partial_interior_straight_skeleton_2 ( FT const& aMaxTime } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset , PointIterator aVerticesBegin , PointIterator aVerticesEnd @@ -93,7 +93,7 @@ create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset typedef typename Kernel_traits::Kernel IK; typedef typename IK::FT IFT; - boost::shared_ptr > rSkeleton; + std::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) // Note that we can also have IK != K (e.g. `Simple_cartesian` and `EPICK`) @@ -101,7 +101,7 @@ create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset // @todo This likely should be done in the kernel K rather than the input kernel (i.e. the same // converter stuff that is done in `create_partial_exterior_straight_skeleton_2`?). - boost::optional margin = compute_outer_frame_margin(aVerticesBegin, + std::optional margin = compute_outer_frame_margin(aVerticesBegin, aVerticesEnd, lOffset); @@ -139,10 +139,10 @@ create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset // Kernel != Skeleton::kernel. The skeleton is converted to Straight_skeleton_2 // template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false ) { - typedef boost::shared_ptr OutPolygonPtr ; + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Straight_skeleton_2 OfSkeleton ; @@ -152,7 +152,7 @@ create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Ta OutPolygonPtrVector rR ; - boost::shared_ptr lConvertedSs = convert_straight_skeleton_2(aSs); + std::shared_ptr lConvertedSs = convert_straight_skeleton_2(aSs); OffsetBuilder ob( *lConvertedSs ); ob.construct_offset_contours(aOffset, std::back_inserter(rR) ) ; @@ -163,10 +163,10 @@ create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Ta // Kernel == Skeleton::kernel, no conversion // template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true ) { - typedef boost::shared_ptr OutPolygonPtr ; + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Polygon_offset_builder_traits_2 OffsetBuilderTraits; @@ -182,7 +182,7 @@ create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k* // Allow failure due to invalid straight skeletons to go through the users template -Skeleton const& dereference ( boost::shared_ptr const& ss ) +Skeleton const& dereference ( std::shared_ptr const& ss ) { CGAL_precondition(ss.get() != 0); return *ss; @@ -191,7 +191,7 @@ Skeleton const& dereference ( boost::shared_ptr const& ss ) } // namespace CGAL_SS_i template -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_offset_polygons_2(const FT& aOffset, const Skeleton& aSs, @@ -203,7 +203,7 @@ create_offset_polygons_2(const FT& aOffset, template, class FT, class Skeleton> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_offset_polygons_2(const FT& aOffset, const Skeleton& aSs) @@ -218,7 +218,7 @@ create_offset_polygons_2(const FT& aOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -242,7 +242,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -259,7 +259,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, // Overload where Polygon actually is a simple polygon (no holes) template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -277,7 +277,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, // Overloads common to both polygons with and without holes, a simple polygon is returned in any case template::type> -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -290,7 +290,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly) @@ -309,7 +309,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, // Overload where Polygon actually is a simple polygon (no holes) template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -332,7 +332,7 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, // Overloads common to both polygons with and without holes, a simple polygons is returned in any case template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -345,7 +345,7 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly) diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index 09e77e732d5..ccedabda0b5 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace CGAL { // overload where PolygonWithHoles actually is a type of Polygon that supports holes template::type> // Hole-less polygon type -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, @@ -57,7 +57,7 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes template::type> -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -70,7 +70,7 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -83,7 +83,7 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly) @@ -102,7 +102,7 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes template::type> -std::vector > +std::vector > inline create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -110,14 +110,14 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const SsK& ssk) { typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = + std::vector > raw_output = create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for (boost::shared_ptr ptr : raw_output) + for (std::shared_ptr ptr : raw_output) ptr->reverse_orientation(); return arrange_offset_polygons_2(raw_output); @@ -128,7 +128,7 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, // overload where PolygonWithHoles actually is a type of Polygon that supports holes template::type> -std::vector > +std::vector > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, @@ -137,14 +137,14 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { - std::vector > polygons = + std::vector > polygons = create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk); for (typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit) { typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); - std::vector > hole_polygons = + std::vector > hole_polygons = create_interior_skeleton_and_offset_polygons_2(aOffset, hole, ofk,ssk); @@ -156,7 +156,7 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -169,7 +169,7 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly) diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h index 8ef95ed7564..c65e61ffc8c 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -33,7 +33,7 @@ namespace CGAL { template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd , HoleIterator aHolesBegin @@ -63,7 +63,7 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin } template -boost::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > +std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > inline create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd @@ -80,7 +80,7 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd @@ -100,7 +100,7 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd @@ -113,7 +113,7 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( Polygon const& aOutContour, K const& k, @@ -127,7 +127,7 @@ create_interior_straight_skeleton_2 ( Polygon const& aOutContour, } template -boost::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > +std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > inline create_interior_straight_skeleton_2 ( Polygon const& aOutContour ) { @@ -140,7 +140,7 @@ create_interior_straight_skeleton_2 ( Polygon const& aOutContour ) /// EXTERIOR template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_exterior_straight_skeleton_2 ( FT const& aMaxOffset , PointIterator aVerticesBegin , PointIterator aVerticesEnd @@ -153,7 +153,7 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset typedef typename Kernel_traits::Kernel IK; typedef typename IK::FT IFT; - boost::shared_ptr > rSkeleton; + std::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) // Note that we can also have IK != K (e.g. `Simple_cartesian` and `EPICK`) @@ -161,7 +161,7 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset // @todo This likely should be done in the kernel K rather than the input kernel (i.e. the same // converter stuff that is done in `create_partial_exterior_straight_skeleton_2`?). - boost::optional margin = compute_outer_frame_margin( aVerticesBegin, + std::optional margin = compute_outer_frame_margin( aVerticesBegin, aVerticesEnd, lOffset ); @@ -196,7 +196,7 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_exterior_straight_skeleton_2 ( FT const& aMaxOffset , PointIterator aVerticesBegin @@ -211,7 +211,7 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly, K const& k ) { @@ -223,7 +223,7 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly ) { diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h index 490ca07788a..ae229d32e44 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h @@ -20,14 +20,14 @@ #include -#include +#include #include namespace CGAL { template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( Polygon const& aPolyWithHoles, K const& k, diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h index 19852c88904..d2553849475 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h @@ -30,9 +30,7 @@ #include #include -#include #include -#include #include #include @@ -62,7 +60,7 @@ namespace CGAL_SS_i { template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_partial_interior_weighted_straight_skeleton_2 ( const FT& aMaxTime, PointIterator aOuterContour_VerticesBegin, PointIterator aOuterContour_VerticesEnd, @@ -94,7 +92,7 @@ create_partial_interior_weighted_straight_skeleton_2 ( const FT& aMaxTime, NT_converter wconv; InputFT lMaxTime = aMaxTime; - boost::optional lOptMaxTime(conv(lMaxTime)) ; + std::optional lOptMaxTime(conv(lMaxTime)) ; SsBuilder ssb( lOptMaxTime ) ; @@ -113,7 +111,7 @@ create_partial_interior_weighted_straight_skeleton_2 ( const FT& aMaxTime, } template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, PointIterator aVerticesBegin, PointIterator aVerticesEnd, @@ -129,7 +127,7 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, typedef typename Kernel_traits::Kernel IK; typedef typename IK::FT IFT; - boost::shared_ptr > rSkeleton; + std::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) // Note that we can also have IK != K (e.g. `Simple_cartesian` and `EPICK`) @@ -137,7 +135,7 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, // @todo This likely should be done in the kernel K rather than the input kernel (i.e. the same // converter stuff that is done in `create_partial_exterior_straight_skeleton_2`?). - boost::optional margin = compute_outer_frame_margin(aVerticesBegin, + std::optional margin = compute_outer_frame_margin(aVerticesBegin, aVerticesEnd, aWeightsBegin, aWeightsEnd, @@ -205,7 +203,7 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -256,7 +254,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -275,7 +273,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, // Overload where Polygon actually is a simple polygon (no holes) template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -295,7 +293,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, // Overloads common to both polygons with and without holes, a simple polygon is returned in any case template::type> -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -309,7 +307,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -329,7 +327,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, // Overload where Polygon actually is a simple polygon (no holes) template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -355,7 +353,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, // Overloads common to both polygons with and without holes, a simple polygons is returned in any case template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, @@ -369,7 +367,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector< boost::shared_ptr > +std::vector< std::shared_ptr > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index 24420366e9b..51e1fd3752e 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -21,10 +21,9 @@ #include -#include - #include #include +#include namespace CGAL { @@ -38,7 +37,7 @@ namespace CGAL { // overload where PolygonWithHoles actually is a type of Polygon that supports holes template::type> // Hole-less polygon type -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, @@ -61,7 +60,7 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes template::type> -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -75,7 +74,7 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf template::type> -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -89,7 +88,7 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf template::type> -std::vector > +std::vector > inline create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -109,7 +108,7 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes template::type> -std::vector > +std::vector > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, const Weights& aWeights, @@ -117,14 +116,14 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf const SsK& ssk) { typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = + std::vector > raw_output = create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for(boost::shared_ptr ptr : raw_output) + for(std::shared_ptr ptr : raw_output) ptr->reverse_orientation(); return arrange_offset_polygons_2(raw_output); @@ -135,7 +134,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf // overload where PolygonWithHoles actually is a type of Polygon that supports holes template::type> -std::vector > +std::vector > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, @@ -147,7 +146,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, { CGAL_precondition(aWeights.size() == aPoly.number_of_holes() + 1); - std::vector > polygons = + std::vector > polygons = create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), {aWeights[0]}, ofk, ssk); std::size_t weight_pos = 1; @@ -155,7 +154,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, { typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); - std::vector > hole_polygons = + std::vector > hole_polygons = create_interior_skeleton_and_offset_polygons_2(aOffset, hole, {aWeights[weight_pos]}, @@ -168,7 +167,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, template::type> -std::vector > +std::vector > inline create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, @@ -182,7 +181,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf template::type> -std::vector > +std::vector > inline create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h index 660cb8cb317..85c4cd6b99e 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h @@ -22,9 +22,8 @@ #include #include -#include -#include - +#include +#include #include #include #include @@ -34,7 +33,7 @@ namespace CGAL { template -boost::shared_ptr > +std::shared_ptr > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, HoleIterator holes_begin, @@ -80,7 +79,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice template -boost::shared_ptr > +std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -101,7 +100,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice template -boost::shared_ptr > +std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -129,7 +128,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice template -boost::shared_ptr > +std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -146,7 +145,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice template -boost::shared_ptr > +std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, const Weights& weights, @@ -162,7 +161,7 @@ create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, template -boost::shared_ptr > +std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, const Weights& weights) @@ -181,7 +180,7 @@ template -boost::shared_ptr > +std::shared_ptr > create_exterior_weighted_straight_skeleton_2(const FT& max_offset, PointIterator vertices_begin, PointIterator vertices_end, @@ -196,7 +195,7 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, using IK = typename Kernel_traits::Kernel; using IFT = typename IK::FT; - boost::shared_ptr > skeleton; + std::shared_ptr > skeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) // Note that we can also have IK != K (e.g. `Simple_cartesian` and `EPICK`) @@ -204,7 +203,7 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, // @todo This likely should be done in the kernel K rather than the input kernel(i.e. the same // converter stuff that is done in `create_partial_exterior_straight_skeleton_2`?). - boost::optional margin = compute_outer_frame_margin(vertices_begin, + std::optional margin = compute_outer_frame_margin(vertices_begin, vertices_end, weights_begin, weights_end, @@ -262,7 +261,7 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, template -boost::shared_ptr > +std::shared_ptr > inline create_exterior_weighted_straight_skeleton_2(const FT& max_offset, PointIterator vertices_begin, @@ -282,7 +281,7 @@ template -boost::shared_ptr > +std::shared_ptr > inline create_exterior_weighted_straight_skeleton_2(const FT& max_offset, const Polygon& aPoly, @@ -300,7 +299,7 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, template -boost::shared_ptr > +std::shared_ptr > inline create_exterior_weighted_straight_skeleton_2(const FT& max_offset, Weights& weights, diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h index e6a2fea13b1..acc2046f2a6 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h @@ -20,8 +20,6 @@ #include -#include - #include namespace CGAL { @@ -29,7 +27,7 @@ namespace CGAL { template -boost::shared_ptr< Straight_skeleton_2 > +std::shared_ptr< Straight_skeleton_2 > inline create_interior_weighted_straight_skeleton_2(const Polygon& poly_with_holes, const Weights& weights, diff --git a/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h b/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h index 2d5da206dd6..15833558170 100644 --- a/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h @@ -17,7 +17,7 @@ #include #include -#include +#include namespace CGAL { @@ -37,7 +37,7 @@ compare_offset_against_isec_timeC2 ( typename K::FT const& t, typedef Rational Rational ; typedef Quotient Quotient ; - typedef boost::optional Optional_rational ; + typedef std::optional Optional_rational ; Uncertain rResult = Uncertain::indeterminate(); diff --git a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h index bdd371ea370..30578659b4a 100644 --- a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include @@ -129,12 +129,12 @@ Uncertain certified_side_of_oriented_lineC2(const FT &a, const FT &b, cons // template Uncertain exist_offset_lines_isec2 ( Trisegment_2_ptr< Trisegment_2 > > const& tri, - boost::optional const& aMaxTime, + std::optional const& aMaxTime, Caches& aCaches ) { typedef Rational Rational ; - typedef boost::optional Optional_rational ; + typedef std::optional Optional_rational ; typedef Quotient Quotient ; Uncertain rResult = Uncertain::indeterminate(); @@ -203,7 +203,7 @@ compare_offset_lines_isec_timesC2 ( Trisegment_2_ptr< Trisegment_2 Rational ; typedef Quotient Quotient ; - typedef boost::optional Optional_rational ; + typedef std::optional Optional_rational ; CGAL_STSKEL_TRAITS_TRACE("compare_offset_lines_isec_timesC2(\n" << m << "\n" << n << "\n) [" << typeid(FT).name() << "]" ); @@ -259,7 +259,7 @@ Uncertain compare_isec_anglesC2 ( Vector_2 const& aBV1 // Returns true if the point aP is on the positive side of the line supporting the edge // template -Uncertain is_edge_facing_pointC2 ( boost::optional< typename K::Point_2 > const& aP, +Uncertain is_edge_facing_pointC2 ( std::optional< typename K::Point_2 > const& aP, Segment_2_with_ID const& aEdge ) { typedef typename K::FT FT ; @@ -486,8 +486,8 @@ Uncertain are_events_simultaneousC2 ( Trisegment_2_ptr< Trisegment_2 Rational ; typedef Quotient Quotient ; - typedef boost::optional Optional_rational ; - typedef boost::optional Optional_point_2 ; + typedef std::optional Optional_rational ; + typedef std::optional Optional_point_2 ; Uncertain rResult = Uncertain::indeterminate(); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_offset_builder_types.h b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_offset_builder_types.h index e4470f20366..7f6217477a8 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_offset_builder_types.h +++ b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_offset_builder_types.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; @@ -29,10 +29,10 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; typedef CGAL::Aff_transformation_2 Transformation; typedef std::vector Polygon_2; -typedef boost::shared_ptr PolygonPtr; +typedef std::shared_ptr PolygonPtr; typedef CGAL::Segment_2 Segment; typedef std::vector Region ; -typedef boost::shared_ptr RegionPtr ; +typedef std::shared_ptr RegionPtr ; typedef std::vector Regions ; typedef std::vector Doubles ; @@ -51,7 +51,7 @@ typedef Sls::Vertex_const_handle Vertex_const_handle ; typedef CGAL::HalfedgeDS_const_decorator Sls_const_decorator ; -typedef boost::shared_ptr SlsPtr ; +typedef std::shared_ptr SlsPtr ; #endif diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_builder_types.h b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_builder_types.h index f41d7f30f81..7a77342eba1 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_builder_types.h +++ b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_builder_types.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include //typedef CGAL::Simple_cartesian K ; @@ -30,10 +30,10 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; typedef CGAL::Aff_transformation_2 Transformation; typedef std::vector Polygon_2; -typedef boost::shared_ptr PolygonPtr; +typedef std::shared_ptr PolygonPtr; typedef CGAL::Segment_2 Segment; typedef std::vector Region ; -typedef boost::shared_ptr RegionPtr ; +typedef std::shared_ptr RegionPtr ; typedef std::vector Regions ; typedef std::vector Doubles ; @@ -50,7 +50,7 @@ typedef Sls::Vertex_const_handle Vertex_const_handle ; typedef CGAL::HalfedgeDS_const_decorator Sls_const_decorator ; -typedef boost::shared_ptr SlsPtr ; +typedef std::shared_ptr SlsPtr ; #endif diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_traits_aux.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_traits_aux.cpp index d0e20ac5195..8d2fca8ccb1 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_traits_aux.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_traits_aux.cpp @@ -36,7 +36,7 @@ void report( int idx, bool ok, std::string const& info = std::string("") ) bool exist_event( Traits const& aTraits, triple const& aTriple ) { - boost::optional lMaxTime ; + std::optional lMaxTime ; return aTraits.do_ss_event_exist_2_object()(aTriple.trisegment(), lMaxTime ); } diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_types.h b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_types.h index 6d45351087d..ab345149ecf 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_types.h +++ b/Straight_skeleton_2/test/Straight_skeleton_2/include/CGAL/test_sls_types.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -50,16 +50,16 @@ typedef std::vector Doubles ; typedef CGAL::Segment_2 ISegment; typedef std::vector IPolygon; -typedef boost::shared_ptr IPolygonPtr; +typedef std::shared_ptr IPolygonPtr; typedef std::vector IRegion ; -typedef boost::shared_ptr IRegionPtr ; +typedef std::shared_ptr IRegionPtr ; typedef std::vector IRegions ; typedef CGAL::Segment_2 OSegment; typedef std::vector OPolygon; -typedef boost::shared_ptr OPolygonPtr; +typedef std::shared_ptr OPolygonPtr; typedef std::vector ORegion ; -typedef boost::shared_ptr ORegionPtr ; +typedef std::shared_ptr ORegionPtr ; typedef std::vector ORegions ; typedef CGAL::Straight_skeleton_2 ISls; @@ -157,8 +157,8 @@ public: typedef CGAL::HalfedgeDS_const_decorator Sls_const_decorator ; -typedef boost::shared_ptr ISlsPtr ; -typedef boost::shared_ptr OSlsPtr ; +typedef std::shared_ptr ISlsPtr ; +typedef std::shared_ptr OSlsPtr ; typedef CGAL::Straight_skeleton_items_converter_2 SlsItemsConverter ; diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/issue4533.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/issue4533.cpp index 6ff6900890b..a007bba554e 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/issue4533.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/issue4533.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include @@ -15,7 +15,7 @@ typedef K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Straight_skeleton_2 Ss; -typedef boost::shared_ptr SsPtr; +typedef std::shared_ptr SsPtr; int main() { diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/issue4684.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/issue4684.cpp index 560d8c01403..47dd764e525 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/issue4684.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/issue4684.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -13,7 +13,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; -typedef boost::shared_ptr PolygonPtr; +typedef std::shared_ptr PolygonPtr; void low_precision_run() { diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/issue7149.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/issue7149.cpp index 8737bd07748..62f7b6afef9 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/issue7149.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/issue7149.cpp @@ -83,7 +83,7 @@ void test(const PointRange& points, K()); assert(ss_ptr); - std::vector > offset_polygons_ptrs = + std::vector > offset_polygons_ptrs = CGAL::create_offset_polygons_2(FT(offset), CGAL::CGAL_SS_i::dereference(ss_ptr), K()); std::cout << offset_polygons_ptrs.size() << " polygon(s)" << std::endl; diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/issue7284.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/issue7284.cpp index cce6771f7a5..5d1fd32522a 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/issue7284.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/issue7284.cpp @@ -10,8 +10,6 @@ #include #include -#include - #include #include #include @@ -183,7 +181,7 @@ void test(const std::vector& x, CGAL::draw(ipoly); - boost::shared_ptr< CGAL::Straight_skeleton_2 > skeleton = CGAL::create_interior_straight_skeleton_2(ipoly, I_Kernel()); + std::shared_ptr< CGAL::Straight_skeleton_2 > skeleton = CGAL::create_interior_straight_skeleton_2(ipoly, I_Kernel()); if(!skeleton) { diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls.cpp index fc31a362ca4..a3806b61235 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls.cpp @@ -312,7 +312,7 @@ IRegionPtr load_region( string file, int aShift, int& rStatus ) return rRegion ; } -void update_bbox ( IRegionPtr const& aRegion, boost::optional& rBBox ) +void update_bbox ( IRegionPtr const& aRegion, std::optional& rBBox ) { if ( aRegion ) { @@ -393,7 +393,7 @@ string change_extension ( string aFilename, string aNewExt ) void dump_to_eps ( TestCase const& aCase ) { - boost::optional lBBox ; + std::optional lBBox ; update_bbox(aCase.Inner.Input, lBBox ) ; update_bbox(aCase.Outer.Input, lBBox ) ; @@ -574,7 +574,7 @@ IPolygonPtr create_outer_frame ( IPolygon const& aOuter ) IFT lOffset = s * 0.3 ; - boost::optional lOptMargin = compute_outer_frame_margin(aOuter.begin(),aOuter.end(),lOffset) ; + std::optional lOptMargin = compute_outer_frame_margin(aOuter.begin(),aOuter.end(),lOffset) ; if ( lOptMargin ) { @@ -664,7 +664,7 @@ bool is_skeleton_valid( IRegion const& aRegion, ISls const& aSkeleton, bool is_p } -int create_skeleton ( Zone& rZone, boost::optional const& aMaxTime = boost::optional() ) +int create_skeleton ( Zone& rZone, std::optional const& aMaxTime = std::optional() ) { int rStatus = cUnknown ; @@ -739,7 +739,7 @@ int test_zone ( Zone& rZone ) if ( sMaxTime > 0 ) { - boost::optional lMaxTime = static_cast(sMaxTime) ; + std::optional lMaxTime = static_cast(sMaxTime) ; rStatus = create_skeleton(rZone,lMaxTime) ; } else diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp index 48f92c02c14..298b612fa79 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -44,10 +44,10 @@ void test_API() Polygon_2 p; Polygon_with_holes_2 pwh; - std::vector< boost::shared_ptr > res; - std::vector< boost::shared_ptr > res_EPICK; - std::vector< boost::shared_ptr > res_w; - std::vector< boost::shared_ptr > res_w_EPICK; + std::vector< std::shared_ptr > res; + std::vector< std::shared_ptr > res_EPICK; + std::vector< std::shared_ptr > res_w; + std::vector< std::shared_ptr > res_w_EPICK; // First kernel is the offset construction (and thus output kernel), second kernel is the skeleton construction @@ -119,7 +119,7 @@ void test_API() } template -bool is_valid(const boost::shared_ptr& ss) +bool is_valid(const std::shared_ptr& ss) { typedef typename StraightSkeleton::Traits::Point_2 Point; @@ -160,7 +160,7 @@ void test_offset_square() typedef typename K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; - typedef boost::shared_ptr Polygon_ptr; + typedef std::shared_ptr Polygon_ptr; typedef std::vector Polygon_ptr_container; typedef CGAL::Straight_skeleton_2 Ss; @@ -177,7 +177,7 @@ void test_offset_square() Skeleton_builder ssb; ssb.enter_contour(square.begin(), square.end()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); Polygon_ptr_container offset_polys = @@ -200,7 +200,7 @@ void test_offset_four_square_holes() typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_2_ptr; + typedef std::shared_ptr Polygon_with_holes_2_ptr; typedef std::vector Polygon_with_holes_2_ptr_container; Polygon_2 outer, hole1, hole2, hole3, hole4; @@ -259,7 +259,7 @@ void test_offset_L() typedef typename K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; - typedef boost::shared_ptr Polygon_ptr; + typedef std::shared_ptr Polygon_ptr; typedef std::vector Polygon_ptr_container; typedef CGAL::Straight_skeleton_2 Ss; @@ -280,7 +280,7 @@ void test_offset_L() Skeleton_builder ssb; ssb.enter_contour(L.begin(), L.end()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); Polygon_ptr_container offset_polys = @@ -304,7 +304,7 @@ void test_offset_polygon_with_hole() typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_2_ptr; + typedef std::shared_ptr Polygon_with_holes_2_ptr; typedef std::vector Polygon_with_holes_2_ptr_container; // Square with a non-centered square hole @@ -393,7 +393,7 @@ void test_offset_pinched() typedef typename K::FT FT; typedef typename K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; - typedef boost::shared_ptr Polygon_ptr; + typedef std::shared_ptr Polygon_ptr; typedef std::vector Polygon_ptrs; typedef CGAL::Straight_skeleton_2 Ss; @@ -431,7 +431,7 @@ void test_offset_pinched() Skeleton_builder ssb; ssb.enter_contour(input.begin(), input.end()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); // The two splitting fronts meet in the middle, and at that time, @@ -474,7 +474,7 @@ void test_offset_multiple_CCs() typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef CGAL::Polygon_2 Contour; - typedef boost::shared_ptr ContourPtr; + typedef std::shared_ptr ContourPtr; typedef std::vector Contour_sequence; typedef CGAL::Straight_skeleton_2 Ss; @@ -501,7 +501,7 @@ void test_offset_multiple_CCs() std::vector input(pts, pts+12); const FT offset = 50; - boost::optional margin = CGAL::compute_outer_frame_margin(input.begin(), input.end(), offset); + std::optional margin = CGAL::compute_outer_frame_margin(input.begin(), input.end(), offset); assert(margin); // Get the bbox of the polygon @@ -526,7 +526,7 @@ void test_offset_multiple_CCs() ssb.enter_contour(frame, frame+4); ssb.enter_contour(input.rbegin(), input.rend()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); Contour_sequence offset_contours; @@ -548,7 +548,7 @@ void test_offset_non_manifold() typedef typename K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_ptr; + typedef std::shared_ptr Polygon_with_holes_ptr; typedef std::vector Polygon_with_holes_ptrs; typedef CGAL::Straight_skeleton_2 Ss; @@ -572,7 +572,7 @@ void test_offset_non_manifold() ssb.enter_contour(outer.begin(), outer.end()); ssb.enter_contour(hole.begin(), hole.end()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); // The two splitting fronts meet in the middle, and at that time, @@ -631,7 +631,7 @@ void test_offset_non_manifold_2() typedef typename K::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_ptr; + typedef std::shared_ptr Polygon_with_holes_ptr; typedef std::vector Polygon_with_holes_ptrs; typedef CGAL::Straight_skeleton_2 Ss; @@ -663,7 +663,7 @@ void test_offset_non_manifold_2() ssb.enter_contour(outer.begin(), outer.end()); ssb.enter_contour(hole.begin(), hole.end()); - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); // Similar to the previous function, a split event happens and at that particular time, @@ -717,7 +717,7 @@ void test_offset_polygon_exterior() typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_2_ptr; + typedef std::shared_ptr Polygon_with_holes_2_ptr; typedef std::vector Polygon_with_holes_2_ptr_container; Polygon_2 poly; @@ -799,7 +799,7 @@ void test_offset_polygon_with_holes_exterior() typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_2_ptr; + typedef std::shared_ptr Polygon_with_holes_2_ptr; typedef std::vector Polygon_with_holes_2_ptr_container; Polygon_2 outer ; @@ -840,7 +840,7 @@ void test_offset(const char* filename, typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - typedef boost::shared_ptr Polygon_with_holes_2_ptr; + typedef std::shared_ptr Polygon_with_holes_2_ptr; typedef std::vector Polygon_with_holes_2_ptr_container; typedef CGAL::Straight_skeleton_2 Ss; @@ -905,7 +905,7 @@ void test_offset(const char* filename, ssb.enter_contour(polys[i+1].begin(), polys[i+1].end()); } - boost::shared_ptr ss = ssb.construct_skeleton(); + std::shared_ptr ss = ssb.construct_skeleton(); assert(is_valid(ss)); if(skeleton_only) diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_previous_issues.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_previous_issues.cpp index b1702cd881f..bd12f9b3c91 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_previous_issues.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_previous_issues.cpp @@ -5,15 +5,13 @@ #include #include -#include - typedef CGAL::Exact_predicates_inexact_constructions_kernel K ; typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr SsPtr ; // Issue #39 on CB Polygon_2 data_0() diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp index c6ed9f99dc2..d90bc8adf5f 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp @@ -34,7 +34,7 @@ void Straight_skeleton_traits_external_trace(std::string m) #include #include -#include +#include #include #include @@ -53,10 +53,10 @@ void test_API() typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef CGAL::Straight_skeleton_2 Straight_skeleton_EPICK; - typedef boost::shared_ptr Straight_skeleton_Ptr_EPICK; + typedef std::shared_ptr Straight_skeleton_Ptr_EPICK; typedef CGAL::Straight_skeleton_2 Straight_skeleton; - typedef boost::shared_ptr Straight_skeleton_Ptr; + typedef std::shared_ptr Straight_skeleton_Ptr; Polygon_2 p; Straight_skeleton_Ptr_EPICK ss0 = CGAL::create_interior_straight_skeleton_2(p); @@ -72,7 +72,7 @@ void test_API() } template -bool is_valid(const boost::shared_ptr& ss) +bool is_valid(const std::shared_ptr& ss) { typedef typename StraightSkeleton::Traits::Point_2 Point; typedef CGAL::Polygon_2 Polygon_2; @@ -136,7 +136,7 @@ void test_skeleton(const char* filename, typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef CGAL::Straight_skeleton_2 Straight_skeleton; - typedef boost::shared_ptr Straight_skeleton_Ptr; + typedef std::shared_ptr Straight_skeleton_Ptr; std::ifstream in(filename); assert(in); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp index 30fda42afd3..c2736dd490a 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp @@ -18,8 +18,6 @@ #include #include -#include - #include namespace SS = CGAL::CGAL_SS_i; @@ -34,7 +32,7 @@ using Polygon_2 = CGAL::Polygon_2; using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; using Straight_skeleton_2 = CGAL::Straight_skeleton_2; -using Straight_skeleton_2_ptr = boost::shared_ptr; +using Straight_skeleton_2_ptr = std::shared_ptr; using Mesh = CGAL::Surface_mesh; diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_straight_skeleton_copy.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_straight_skeleton_copy.cpp index e189b587921..bd96b88b86b 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_straight_skeleton_copy.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_straight_skeleton_copy.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -12,8 +10,8 @@ typedef K::Point_2 Point ; typedef CGAL::Polygon_2 Polygon_2 ; typedef CGAL::Straight_skeleton_2 Ss ; -typedef boost::shared_ptr PolygonPtr ; -typedef boost::shared_ptr SsPtr ; +typedef std::shared_ptr PolygonPtr ; +typedef std::shared_ptr SsPtr ; typedef std::vector PolygonPtrVector ; diff --git a/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h b/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h index 38e178d7222..6d9c0286d0b 100644 --- a/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h +++ b/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h @@ -51,9 +51,7 @@ #include #include -#include #include -#include #include #include @@ -61,6 +59,8 @@ #include #include #include +#include +#include namespace CGAL { namespace Straight_skeleton_extrusion { @@ -124,7 +124,7 @@ snap_point_to_contour_halfedge_plane(const typename GeomTraits::Point_2& op, // Project orthogonally onto the halfedge // @todo should the projection be along the direction of the other offset edge sharing this point? Segment_2 s { sv->point(), tv->point() }; - boost::optional line = CGAL_SS_i::compute_normalized_line_coeffC2(s); + std::optional line = CGAL_SS_i::compute_normalized_line_coeffC2(s); CGAL_assertion(bool(line)); // otherwise the skeleton would have failed already FT px, py; @@ -278,11 +278,11 @@ class Extrusion_builder using Polygon_2 = CGAL::Polygon_2; using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; - using Offset_polygons = std::vector >; - using Offset_polygons_with_holes = std::vector >; + using Offset_polygons = std::vector >; + using Offset_polygons_with_holes = std::vector >; using Straight_skeleton_2 = CGAL::Straight_skeleton_2; - using Straight_skeleton_2_ptr = boost::shared_ptr; + using Straight_skeleton_2_ptr = std::shared_ptr; using SS_Vertex_const_handle = typename Straight_skeleton_2::Vertex_const_handle; using SS_Halfedge_const_handle = typename Straight_skeleton_2::Halfedge_const_handle; @@ -850,7 +850,7 @@ public: // the outer boundary into a hole. Hence, it needs to be reversed back to proper orientation // - the exterior offset of the holes is built by reversing the holes and computing an internal // skeleton. Hence, the result also needs to be reversed. - for(boost::shared_ptr ptr : raw_output) + for(std::shared_ptr ptr : raw_output) ptr->reverse_orientation(); Offset_polygons_with_holes output = CGAL::arrange_offset_polygons_2(raw_output); diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index 1034f74abff..e57d4327bac 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -32,6 +32,8 @@ #include #include #include +#include +#include namespace CGAL { @@ -186,6 +188,34 @@ public: std::ostream& operator()( std::ostream& os) const { return (os << t); } }; +template +class Output_rep, F> +{ + const std::optional& t; + +public: + Output_rep( const std::optional& tt) : t(tt) {} + std::ostream& operator()( std::ostream& os) const + { + if (t==std::nullopt) return (os << "--"); + return (os << t.value()); + } +}; + +template +class Output_rep, F> +{ + const std::variant& t; + +public: + Output_rep( const std::variant& tt) : t(tt) {} + std::ostream& operator()( std::ostream& os) const + { + std::visit([&os](auto&& v) { os << v; }, t); + return os; + } +}; + /*! \relates Output_rep \brief stream output of the \c Output_rep calls its \c operator(). @@ -241,6 +271,19 @@ public: std::istream& operator()( std::istream& is) const { return (is >> t); } }; +template +class Input_rep> +{ + std::optional& t; + +public: + //! initialize with a reference to \a t. + Input_rep( std::optional& tt) : t(tt) {} + + //! perform the input, calls \c operator\>\> by default. + std::istream& operator()( std::istream& is) const { return (is >> t.value()); } +}; + #if CGAL_FORCE_IFORMAT_DOUBLE || \ ( ( _MSC_VER > 1600 ) && ( _MSC_VER < 1910 ) && (! defined( CGAL_NO_IFORMAT_DOUBLE )) ) diff --git a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h index e5be891d9b2..e3e26fe8b61 100644 --- a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h +++ b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h @@ -16,7 +16,7 @@ #define GEOMETRY_CONTAINER_H #include #include -#include +#include struct Dummy_deleter{ template @@ -45,7 +45,7 @@ struct Geometry_container{ typedef typename Range::const_reverse_iterator const_reverse_iterator; typedef typename Range::size_type size_type; typedef typename Range::value_type value_type; - boost::shared_ptr range; + std::shared_ptr range; bool must_delete; // // Default constructor. diff --git a/Surface_mesh/examples/Surface_mesh/sm_aabbtree.cpp b/Surface_mesh/examples/Surface_mesh/sm_aabbtree.cpp index 6fe14b01e7a..eba06f7b578 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_aabbtree.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_aabbtree.cpp @@ -16,8 +16,8 @@ typedef CGAL::Surface_mesh Mesh; typedef CGAL::AABB_face_graph_triangle_primitive Primitive; typedef CGAL::AABB_traits Traits; typedef CGAL::AABB_tree Tree; -typedef boost::optional< Tree::Intersection_and_primitive_id::Type > Segment_intersection; -typedef boost::optional< Tree::Intersection_and_primitive_id::Type > Plane_intersection; +typedef std::optional< Tree::Intersection_and_primitive_id::Type > Segment_intersection; +typedef std::optional< Tree::Intersection_and_primitive_id::Type > Plane_intersection; typedef Tree::Primitive_id Primitive_id; int main() @@ -53,8 +53,8 @@ int main() tree.any_intersection(segment_query); if(intersection){ // gets intersection object - if(boost::get(&(intersection->first))){ - Point* p = boost::get(&(intersection->first)); + if(std::get_if(&(intersection->first))){ + Point* p = std::get_if(&(intersection->first)); std::cout << "intersection object is a point " << *p << std::endl; std::cout << "with face "<< intersection->second << std::endl; } @@ -77,8 +77,8 @@ int main() // (generally a segment) Plane_intersection plane_intersection = tree.any_intersection(plane_query); if(plane_intersection){ - if(boost::get(&(plane_intersection->first))){ - Segment* s = boost::get(&(plane_intersection->first)); + if(std::get_if(&(plane_intersection->first))){ + Segment* s = std::get_if(&(plane_intersection->first)); std::cout << "one intersection object is the segment " << s << std::endl; std::cout << "with face "<< intersection->second << std::endl; } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h index 31eea166ee5..5e8733a87f8 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h @@ -67,7 +67,7 @@ public: /// Return a deep copy of self. virtual Base_property_array* clone () const = 0; - /// Return a empty copy of self. + /// Return an empty copy of self. virtual Base_property_array* empty_clone () const = 0; /// Return the type_info of the property diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index 222a99f77e7..b42e28707b5 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -581,9 +581,9 @@ public: return num_teleported; // find the best merge pair - boost::optional< std::pair > best_proxies = + std::optional< std::pair > best_proxies = find_best_merge(!no_threshold_test); - if (best_proxies==boost::none) + if (best_proxies==std::nullopt) return num_teleported; if (px_worst == best_proxies->first || px_worst == best_proxies->second) return num_teleported; @@ -662,7 +662,7 @@ public: * it is returned only if the error change after the merge is lower than the half of the maximum proxy error. * @return if the best merge pair is found the optional returned contains the proxy indices, and is empty otherwise. */ - boost::optional< std::pair > + std::optional< std::pair > find_best_merge(const bool use_threshold_test) { typedef std::pair Proxy_pair; typedef std::set Pair_set; @@ -705,7 +705,7 @@ public: } if (merged_set.empty()) - return boost::none; + return std::nullopt; // test if merge worth it if (use_threshold_test) { @@ -715,7 +715,7 @@ public: max_error = m_proxies[i].err; } if (min_error_change > max_error / FT(2.0)) - return boost::none; + return std::nullopt; } return std::make_pair(px0, px1); diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp index 40e6885e5ec..4e671737489 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp @@ -69,8 +69,8 @@ bool test_shape(const Mesh &mesh, const std::size_t target_num_proxies) approx.run(num_iterations); // eliminate redundant area (local minima) by merging - boost::optional > best_pair = boost::none; - while ((best_pair = approx.find_best_merge(true)) != boost::none) { + std::optional > best_pair = std::nullopt; + while ((best_pair = approx.find_best_merge(true)) != std::nullopt) { approx.merge(best_pair->first, best_pair->second); approx.run(num_iterations); } diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp index 2ea7139f548..13a43f96557 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp @@ -153,7 +153,7 @@ int main() } // force teleportation test - if ( approx.find_best_merge(true) != boost::none ) + if ( approx.find_best_merge(true) != std::nullopt ) { std::cout << "Failed: should be no possible merge with test." << std::endl; return EXIT_FAILURE; diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h index a10cdd1f09c..bdc14cee74e 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index 3a876b5977a..c4be5d3c0fb 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -441,7 +441,7 @@ Orbifold-Tutte Planar Embedding was introduced by Aigerman and Lipman \cgalCite{ and is a generalization of Tutte’s embedding to other topologies, and in particular spheres, which we consider here. The orbifold-Tutte embedding bijectively maps the original surface, that is required to be a topological ball, to a canonical, -topologically equivalent, two-dimensional flat surface called an Euclidean orbifold. +topologically equivalent, two-dimensional flat surface called a Euclidean orbifold. There are 17 Euclidean orbifolds, of which only the 4 sphere orbifolds are currently implemented in CGAL. diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/AABB_traversal_traits.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/AABB_traversal_traits.h index 18a7c1f2fa7..13216a31fdc 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/AABB_traversal_traits.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/AABB_traversal_traits.h @@ -54,7 +54,7 @@ public: if ( GeomTraits().do_intersect_3_object()(query, primitive.datum(m_traits.shared_data())) ) { - boost::optional intersection + std::optional intersection = m_traits.intersection_object()(query, primitive); if(intersection) { *m_out_it++ = *intersection; diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h index 2f361642acf..7afb29eecf2 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include @@ -63,8 +63,8 @@ public: void operator()(const Polyhedron& mesh, std::size_t window_size, ValuePropertyMap values, - boost::optional spatial_parameter = boost::optional(), - boost::optional range_parameter = boost::optional() + std::optional spatial_parameter = std::optional(), + std::optional range_parameter = std::optional() ) const { typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::graph_traits::face_iterator face_iterator; diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h index 9ccde9421a5..5709694f491 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h @@ -26,7 +26,7 @@ #include #include -#include +#include #define CGAL_NUMBER_OF_MAD 1.5 @@ -200,7 +200,7 @@ public: disk_sampler(number_of_rays, std::back_inserter(disk_samples)); for( ; facet_begin != facet_end; ++facet_begin) { - boost::optional sdf_value = calculate_sdf_value_of_facet(*facet_begin, + std::optional sdf_value = calculate_sdf_value_of_facet(*facet_begin, cone_angle, true, disk_samples); if(sdf_value) { @@ -233,7 +233,7 @@ public: * \note: normal should have unit length */ template - boost::optional calculate_sdf_value_of_point( + std::optional calculate_sdf_value_of_point( Point center, Vector normal, SkipPrimitiveFunctor skip, @@ -250,7 +250,7 @@ public: * Overload for taking DiskSampling as template parameter */ template - boost::optional calculate_sdf_value_of_point( + std::optional calculate_sdf_value_of_point( Point center, Vector normal, SkipPrimitiveFunctor skip, @@ -270,7 +270,7 @@ public: * Overload for directly taking sampled points from disk as parameter */ template - boost::optional calculate_sdf_value_of_point( + std::optional calculate_sdf_value_of_point( const Point& center, const Vector& normal, SkipPrimitiveFunctor skip, @@ -346,10 +346,10 @@ public: } if(ray_distances.empty()) { - return boost::none; + return std::nullopt; } - return boost::optional(remove_outliers_and_calculate_sdf_value( + return std::optional(remove_outliers_and_calculate_sdf_value( ray_distances)); } @@ -369,7 +369,7 @@ private: * @param samples sampled points from a unit-disk which are corresponds to rays picked from cone * @return calculated SDF value */ - boost::optional calculate_sdf_value_of_facet( + std::optional calculate_sdf_value_of_facet( face_handle facet, double cone_angle, bool accept_if_acute, @@ -379,11 +379,11 @@ private: const Point p2 = get(vertex_point_map,target(next(halfedge(facet,mesh),mesh),mesh)); const Point p3 = get(vertex_point_map,target(prev(halfedge(facet,mesh),mesh),mesh)); const Point center = centroid_functor(p1, p2, p3); - if (collinear_functor(p1, p2, p3)) return boost::none; + if (collinear_functor(p1, p2, p3)) return std::nullopt; Vector normal = normal_functor(p2, p1, p3); normal=scale_functor(normal, FT(1.0/std::sqrt(to_double(normal.squared_length())))); - if (normal!=normal) return boost::none; + if (normal!=normal) return std::nullopt; CGAL::internal::SkipPrimitiveFunctor skip(facet); CGAL::internal::FirstIntersectionVisitor @@ -434,7 +434,7 @@ private: } const Point* i_point; - if(!(i_point = boost::get(&object))) { + if(!(i_point = std::get_if(&object))) { continue; // continue in case of segment. } @@ -478,12 +478,12 @@ private: boost::tuple ray_casting( const Ray& query, SkipFunctor s, bool accept_if_acute) const { - const boost::optional< typename Tree::template Intersection_and_primitive_id::Type > + const std::optional< typename Tree::template Intersection_and_primitive_id::Type > min_intersection = tree.first_intersection(query, s); if(!min_intersection) return boost::make_tuple(false, false, 0.0, Primitive_id()); - const Point* i_point = boost::get( &min_intersection->first ); + const Point* i_point = std::get_if( &min_intersection->first ); if (!i_point) //segment case ignored return boost::make_tuple(false, false, 0.0, Primitive_id()); diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h index eaad25fb19e..e80cd6f6b28 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h @@ -661,7 +661,7 @@ private: DBlock *nodeptr_block; void (*error_function)(const char - *); /* this function is called if a error occurs, + *); /* this function is called if an error occurs, with a corresponding error message (or exit(1) is called if it's nullptr) */ diff --git a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h index 652c3457496..2095e338943 100644 --- a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h +++ b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h @@ -152,7 +152,7 @@ public: /*! Function object type. Must provide - `boost::optional< boost::variant< T... > > operator()(A obj1, B obj2)` + `std::optional< std::variant< T... > > operator()(A obj1, B obj2)` to compute the intersection between `obj1` and `obj2`, where `A` and `B` can be any type amongst `Line_2`, `Ray_2`, `Segment_2`. */ diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp index 98340eb0000..857321096b2 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -26,10 +26,10 @@ typedef Graph_traits::face_descriptor face_descriptor; typedef Graph_traits::halfedge_descriptor halfedge_descriptor; // A model of SurfacemeshShortestPathVisitor storing simplicies -// using boost::variant +// using std::variant struct Sequence_collector { - typedef boost::variant< vertex_descriptor, + typedef std::variant< vertex_descriptor, std::pair, std::pair > Simplex; std::vector< Simplex > sequence; @@ -50,9 +50,8 @@ struct Sequence_collector } }; -// A visitor to print what a variant contains using boost::apply_visitor +// A visitor to print what a variant contains using std::visit struct Print_visitor - : public boost::static_visitor<> { int i; Triangle_mesh& g; @@ -123,7 +122,7 @@ int main(int argc, char** argv) // print the sequence using the visitor pattern Print_visitor print_visitor(tmesh); for (size_t i = 0; i < sequence_collector.sequence.size(); ++i) - boost::apply_visitor(print_visitor, sequence_collector.sequence[i]); + std::visit(print_visitor, sequence_collector.sequence[i]); return 0; } diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index 189bf48e16d..df10bd113e2 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -1082,7 +1082,7 @@ private: { const auto cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); - if (!cgalIntersection || !boost::get(&*cgalIntersection)) + if (!cgalIntersection || !std::get_if(&*cgalIntersection)) { if (m_debugOutput) { @@ -1092,7 +1092,7 @@ private: } else { - const Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = std::get_if(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); if (t0 >= FT(1)) @@ -1140,7 +1140,7 @@ private: { const auto cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); - if (!cgalIntersection || !boost::get(&*cgalIntersection)) + if (!cgalIntersection || !std::get_if(&*cgalIntersection)) { if (m_debugOutput) { @@ -1150,7 +1150,7 @@ private: } else { - const Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = std::get_if(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); if (t0 <= FT(0)) @@ -1778,7 +1778,7 @@ private: CGAL_assertion(bool(cgalIntersection)); - const Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = std::get_if(&*cgalIntersection); if (!result) result = ¤tSourceImage; @@ -3049,7 +3049,7 @@ public: typename Traits::Construct_barycentric_coordinates cbc(traits.construct_barycentric_coordinates_object()); typename Traits::Compute_squared_distance_3 csd3(traits.compute_squared_distance_3_object()); typedef typename AABB_face_graph_tree::template Intersection_and_primitive_id::Type Intersection_type; - typedef boost::optional Ray_intersection; + typedef std::optional Ray_intersection; std::vector intersections; @@ -3064,7 +3064,7 @@ public: { if (intersections[i]) { - Point_3* intersectionPoint = boost::get(&(intersections[i]->first)); + Point_3* intersectionPoint = std::get_if(&(intersections[i]->first)); if (intersectionPoint) { diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h index 19a2ed5105b..227d20833c4 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h @@ -465,7 +465,7 @@ public: CGAL_assertion(bool(intersectResult1)); if (!intersectResult1) return CGAL::SMALLER; - const Point_2* p1_ptr = boost::get(&*intersectResult1); + const Point_2* p1_ptr = std::get_if(&*intersectResult1); CGAL_assertion(p1_ptr && "Intersection should have been a point"); if (!p1_ptr) return CGAL::SMALLER; @@ -477,7 +477,7 @@ public: CGAL_assertion(bool(intersectResult2)); if (!intersectResult2) return CGAL::SMALLER; - const Point_2* p2_ptr = boost::get(&*intersectResult2); + const Point_2* p2_ptr = std::get_if(&*intersectResult2); CGAL_assertion(p2_ptr && "Intersection should have been a point"); if (!p2_ptr) return CGAL::SMALLER; diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h index 5fa7e3c3395..9e62e74917f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h @@ -46,7 +46,7 @@ public: // Returns the placement computed by `base_placement`, provided the distance between the input // and this placement is smaller than `d`. Otherwise, nothing is returned. - boost::optional operator()(const Edge_profile& profile) const; + std::optional operator()(const Edge_profile& profile) const; // @} }; diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h index 53cfb706bd6..adc991a675e 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h @@ -44,8 +44,8 @@ public: returns the placement, if it does not get filtered by the wrapped filter and if no triangle in the profile has its normal changed by more than 90 degrees. */ - boost::optional operator()(const Edge_profile& profile, - boost::optional op) const; + std::optional operator()(const Edge_profile& profile, + std::optional op) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h index 8f08e9a071c..90e68a5320d 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h @@ -46,7 +46,7 @@ public: Returns the placement computed by `get_placement`, if no triangle in the profile has its normal changed by more than 90 degree. */ - boost::optional operator()(const Edge_profile& profile) const; + std::optional operator()(const Edge_profile& profile) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h index f9b904bfb3f..814c64f2793 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h @@ -32,7 +32,7 @@ public: const Get_placement_& get_placement = Get_placement_()); /// @} - boost::optional operator()(const Edge_profile& profile) const + std::optional operator()(const Edge_profile& profile) const }; diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h index 52c7c54dee8..8c908055492 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h @@ -36,8 +36,8 @@ public: The argument `placement` is unused. */ - boost::optional operator()(const Edge_profile& profile, - const boost::optional& placement) const; + std::optional operator()(const Edge_profile& profile, + const std::optional& placement) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h index 36e68f95263..433a8a64755 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h @@ -36,9 +36,9 @@ LindstromTurk_cost(const FT factor = FT(0.5)); Returns the cost of collapsing the edge (represented by its profile) considering the new `placement` computed for it. */ -boost::optional +std::optional operator()(const Edge_profile& edge_profile, - const boost::optional& placement) const; + const std::optional& placement) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h index 20ae3890439..8471efae84d 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h @@ -38,7 +38,7 @@ public: Returns the new position for the remaining vertex after collapsing the edge (represented by its profile). */ - boost::optional + std::optional operator()(const Edge_profile& profile) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h index 2cd81de679e..11fda0b9f25 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h @@ -36,7 +36,7 @@ public: the points of the source and target vertices (`profile.p0()` and `profile.p1()`) */ - boost::optional operator()(const Edge_profile& profile) const; + std::optional operator()(const Edge_profile& profile) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h index dadccaa8e4d..61440bec09e 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h @@ -50,8 +50,8 @@ public: returns the placement, if it does not get filtered by the wrapped filter, and if all triangles in the profile are inside the polyhedral envelope. */ - boost::optional operator()(const Edge_profile& profile, - boost::optional op) const; + std::optional operator()(const Edge_profile& profile, + std::optional op) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h index 264f56319c7..0bbb8e88078 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h @@ -47,7 +47,7 @@ for each edge collected. */ void OnCollected(const Edge_profile& profile, - boost::optional cost); + std::optional cost); /*! Called during the processing phase (when edges are collapsed), @@ -63,7 +63,7 @@ the edge will not be collapsed. */ void OnSelected(const Edge_profile& profile, - boost::optional cost, + std::optional cost, const Edge_profile::edges_size_type initial_edge_count, const Edge_profile::edges_size_type current_edge_count); @@ -76,7 +76,7 @@ the edge will not be collapsed. */ void OnCollapsing(const Edge_profile& profile, - boost::optional placement); + std::optional placement); /*! Called when an edge has been collapsed and replaced by the vertex `vd` diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetCost.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetCost.h index 24a05f636c2..d07a362bb19 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetCost.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetCost.h @@ -5,7 +5,7 @@ The concept `GetCost` describes the requirements for the policy function object which gets the collapse cost of an edge. -The cost returned is a `boost::optional` value (i.e.\ it can be absent). +The cost returned is a `std::optional` value (i.e.\ it can be absent). An absent cost indicates that the edge should not be collapsed. This could be the result of a computational limitation (such as an overflow), or can be intentionally returned to prevent the edge from being collapsed. @@ -31,8 +31,8 @@ public: Computes and returns the cost of collapsing the edge (represented by its profile), using the calculated placement. */ - boost::optional operator()(const Edge_profile& edge_profile, - const boost::optional& placement) const; + std::optional operator()(const Edge_profile& edge_profile, + const std::optional& placement) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetPlacement.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetPlacement.h index e576472cb34..fa9347cdd28 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetPlacement.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/GetPlacement.h @@ -7,7 +7,7 @@ function object which gets the collapse placement of an edge, that is, the new position of the vertex that remains after a halfedge-collapse operation. -The placement returned is a `boost::optional` value (i.e., it can +The placement returned is a `std::optional` value (i.e., it can be absent). An absent result indicates that the edge should not be collapsed. This could be the result of a computational limitation (such as an overflow), or can be intentionally returned to prevent the edge from being collapsed. @@ -36,7 +36,7 @@ public: Computes and returns the placement, that is, the position of the vertex which replaces the collapsing edge (represented by its profile). */ - boost::optionaloperator()(const Edge_profile& profile) const; + std::optionaloperator()(const Edge_profile& profile) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/PlacementFilter.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/PlacementFilter.h index 324c87f45ee..a2a493e904d 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/PlacementFilter.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/PlacementFilter.h @@ -9,8 +9,8 @@ an edge is taken from the priority queue in order to get collapsed, and neither when the edge is inserted nor when it is updated in the priority queue. -The placement returned is a `boost::optional` value (i.e., it can -be absent). The value `boost::none` indicates that the edge should not be collapsed. +The placement returned is a `std::optional` value (i.e., it can +be absent). The value `std::nullopt` indicates that the edge should not be collapsed. \cgalRefines{DefaultConstructible,CopyConstructible} @@ -33,7 +33,7 @@ public: filters the placement. */ - boost::optional operator()(const Edge_profile& profile, boost::optional placement) const; + std::optional operator()(const Edge_profile& profile, std::optional placement) const; /// @} diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 7ca5146ab1f..8ef4268e07f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -369,7 +369,7 @@ Simple mesh before and after the collapse of edge `v-w` into vertex `w`. While t The class `Surface_mesh_simplification::Bounded_normal_change_filter` checks if a placement would invert the normal of a face around the stars of the two vertices of an edge that is candidate for an edge collapse. It then -rejects this placement by returning `boost::none`. +rejects this placement by returning `std::nullopt`. \note This filter class replaces the usage of the class `Surface_mesh_simplification::Bounded_normal_change_placement`. Using the filter is faster as it is only performed on the edge to be collapsed next, diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp index bc89a3b77aa..04561d2239c 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp @@ -19,13 +19,13 @@ namespace SMS = CGAL::Surface_mesh_simplification; struct Dummy_placement { template - boost::optional operator()(const Profile&) const + std::optional operator()(const Profile&) const { - return boost::none; + return std::nullopt; } template - boost::optional operator()(const Profile&, const boost::optional& op) const + std::optional operator()(const Profile&, const std::optional& op) const { return op; } diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp index 16427c55226..ec9993b87dd 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp @@ -44,7 +44,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base My_visitor(Stats* s) : stats(s) {} // Called during the collecting phase for each edge collected. - void OnCollected(const Profile&, const boost::optional&) + void OnCollected(const Profile&, const std::optional&) { ++(stats->collected); std::cerr << "\rEdges collected: " << stats->collected << std::flush; @@ -53,7 +53,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base // Called during the processing phase for each edge selected. // If cost is absent the edge won't be collapsed. void OnSelected(const Profile&, - boost::optional cost, + std::optional cost, std::size_t initial, std::size_t current) { @@ -69,7 +69,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base // Called during the processing phase for each edge being collapsed. // If placement is absent the edge is left uncollapsed. void OnCollapsing(const Profile&, - boost::optional placement) + std::optional placement) { if(!placement) ++(stats->placement_uncomputable); diff --git a/Surface_mesh_simplification/include/CGAL/Cartesian/MatrixC33.h b/Surface_mesh_simplification/include/CGAL/Cartesian/MatrixC33.h index 34a14497364..7cc2858020b 100644 --- a/Surface_mesh_simplification/include/CGAL/Cartesian/MatrixC33.h +++ b/Surface_mesh_simplification/include/CGAL/Cartesian/MatrixC33.h @@ -18,7 +18,7 @@ #include #include -#include +#include namespace CGAL { @@ -200,11 +200,11 @@ MatrixC33 adjoint_matrix(const MatrixC33& m) } template -boost::optional< MatrixC33 > inverse_matrix(const MatrixC33& m) +std::optional< MatrixC33 > inverse_matrix(const MatrixC33& m) { typedef typename R::RT RT; typedef MatrixC33 Matrix; - typedef boost::optional result_type; + typedef std::optional result_type; result_type rInverse; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h index 94870fb968c..87d24f3dd88 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h @@ -46,9 +46,9 @@ struct Edge_collapse_visitor_base void OnStarted(Triangle_mesh&) {} void OnFinished(Triangle_mesh&) {} void OnStopConditionReached(const Profile&) {} - void OnCollected(const Profile&, const boost::optional&) {} - void OnSelected(const Profile&, const boost::optional&, size_type, size_type) {} - void OnCollapsing(const Profile&, const boost::optional&) {} + void OnCollected(const Profile&, const std::optional&) {} + void OnSelected(const Profile&, const std::optional&, size_type, size_type) {} + void OnCollapsing(const Profile&, const std::optional&) {} void OnCollapsed(const Profile&, const vertex_descriptor&) {} void OnNonCollapsable(const Profile&) {} }; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h index 04303b90353..0e88fec1c8c 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -93,12 +93,12 @@ public: } template - boost::optional + std::optional operator()(const Profile& profile) const { typedef typename Profile::Point Point; - boost::optional op = m_base_placement(profile); + std::optional op = m_base_placement(profile); if(op) { if(m_tree_ptr == nullptr) @@ -121,7 +121,7 @@ public: m_tree_ptr->do_intersect(CGAL::Sphere_3(p, m_sq_threshold_dist))) return op; - return boost::optional(); + return std::optional(); } return op; @@ -153,13 +153,13 @@ public: { } template - boost::optional + std::optional operator()(const Profile& profile) const { typedef typename Profile::Geom_traits Geom_traits; typedef typename Profile::Point Point; - boost::optional op = m_base_placement(profile); + std::optional op = m_base_placement(profile); if(op) { CGAL_assertion(m_tree_ptr != nullptr); @@ -173,7 +173,7 @@ public: m_tree_ptr->do_intersect(CGAL::Sphere_3(p, m_sq_threshold_dist))) return op; - return boost::optional(); + return std::optional(); } return op; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h index 41e8af44337..036d5bb9b44 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h @@ -15,7 +15,7 @@ #include #include -#include +#include namespace CGAL { namespace Surface_mesh_simplification { @@ -31,8 +31,8 @@ public: template - boost::optional - operator()(const Profile& profile, boost::optional op) const + std::optional + operator()(const Profile& profile, std::optional op) const { typedef typename Profile::VertexPointMap Vertex_point_map; @@ -78,7 +78,7 @@ public: Vector n2 = gt.construct_cross_product_vector_3_object()(eq2p, eq2r); if(!is_positive(gt.compute_scalar_product_3_object()(n1, n2))) - return boost::optional(); + return std::optional(); ++it; } diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h index 379847d3ffe..1a1b9aafd12 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_placement.h @@ -15,7 +15,7 @@ #include -#include +#include namespace CGAL { namespace Surface_mesh_simplification { @@ -29,7 +29,7 @@ public: {} template - boost::optional + std::optional operator()(const Profile& profile) const { typedef typename Profile::VertexPointMap Vertex_point_map; @@ -43,7 +43,7 @@ public: const Geom_traits& gt = profile.geom_traits(); const Vertex_point_map& vpm = profile.vertex_point_map(); - boost::optional op = m_get_placement(profile); + std::optional op = m_get_placement(profile); if(op) { // triangles returns the triangles of the star of the vertices of the edge to collapse @@ -76,7 +76,7 @@ public: Vector n2 = gt.construct_cross_product_vector_3_object()(eq2p, eq2r); if(!is_positive(gt.compute_scalar_product_3_object()(n1, n2))) - return boost::optional(); + return std::optional(); ++it; } diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h index 07749bdc643..38f4b478ad3 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h @@ -31,7 +31,7 @@ public: {} template - boost::optional operator()(const Profile& profile) const + std::optional operator()(const Profile& profile) const { typedef typename Profile::TM TM; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h index 079f480076e..7b5cab2ba26 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h @@ -27,9 +27,9 @@ public: Edge_length_cost() {} template - boost::optional operator()(const Profile& profile, const T& /*placement*/) const + std::optional operator()(const Profile& profile, const T& /*placement*/) const { - typedef boost::optional result_type; + typedef std::optional result_type; return result_type(profile.geom_traits().compute_squared_distance_3_object()(profile.p0(), profile.p1())); } }; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h index 86fd7c87544..16c4581bafd 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -97,8 +97,8 @@ public: template - boost::optional - operator()(const Profile& profile, boost::optional op) const + std::optional + operator()(const Profile& profile, std::optional op) const { typedef typename Profile::Point Point; typedef typename Profile::vertex_descriptor_vector Link; @@ -116,7 +116,7 @@ public: if(m_fast_envelope->is_outside(vecp)){ // the new placement is outside envelope - return boost::none; + return std::nullopt; } const Link link = profile.link(); @@ -134,7 +134,7 @@ public: if(m_fast_envelope->is_outside(triangle)){ // the triangle intersects the envelope - return boost::none; + return std::nullopt; } vecv = vecw; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h index 8a3a11a1213..b1421d750fa 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h @@ -32,9 +32,9 @@ public: {} template - boost::optional + std::optional operator()(const Profile& profile, - const boost::optional& placement) const + const std::optional& placement) const { return internal::LindstromTurkCore(m_LT_params, profile).compute_cost(placement); } diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h index 9dc14adcf94..82bf9cc33ef 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h @@ -31,7 +31,7 @@ public: {} template - boost::optional operator()(const Profile& profile) const + std::optional operator()(const Profile& profile) const { return internal::LindstromTurkCore(m_LT_params, profile).compute_placement(); } diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h index 7429f670b5c..c76fb670318 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h @@ -29,9 +29,9 @@ public: Midpoint_placement() {} template - boost::optional operator()(const Profile& profile) const + std::optional operator()(const Profile& profile) const { - typedef boost::optional result_type; + typedef std::optional result_type; return result_type(profile.geom_traits().construct_midpoint_3_object()(profile.p0(), profile.p1())); } }; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h index d669e44f317..590747a252b 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h @@ -22,7 +22,7 @@ #include -#include +#include namespace CGAL { namespace Surface_mesh_simplification { @@ -199,14 +199,14 @@ public: public: // Cost template - boost::optional + std::optional operator()(const Profile& profile, - const boost::optional& placement) const + const std::optional& placement) const { - typedef boost::optional Optional_FT; + typedef std::optional Optional_FT; if(!placement) - return boost::optional(); + return std::optional(); CGAL_precondition(!get(vcm(), profile.v0()).isZero(0)); CGAL_precondition(!get(vcm(), profile.v1()).isZero(0)); @@ -222,7 +222,7 @@ public: public: // Placement template - boost::optional operator()(const Profile& profile) const + std::optional operator()(const Profile& profile) const { CGAL_precondition(!get(vcm(), profile.v0()).isZero(0)); CGAL_precondition(!get(vcm(), profile.v1()).isZero(0)); @@ -236,7 +236,7 @@ public: const Col_4 opt = construct_optimum(combined_matrix, p0, p1); - boost::optional pt = typename Profile::Point(opt(0) / opt(3), + std::optional pt = typename Profile::Point(opt(0) / opt(3), opt(1) / opt(3), opt(2) / opt(3)); diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h index b0fce64b6d9..59002f63681 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h @@ -55,9 +55,9 @@ public: typedef typename Geom_traits::FT FT; typedef typename Geom_traits::Vector_3 Vector; - typedef boost::optional Optional_FT; - typedef boost::optional Optional_point; - typedef boost::optional Optional_vector; + typedef std::optional Optional_FT; + typedef std::optional Optional_point; + typedef std::optional Optional_vector; typedef MatrixC33 Matrix; @@ -152,7 +152,7 @@ private : static bool is_finite(const Matrix& m) { return is_finite(m.r0()) && is_finite(m.r1()) && is_finite(m.r2()); } template - static boost::optional filter_infinity(const T& n) { return is_finite(n) ? boost::optional(n) : boost::optional(); } + static std::optional filter_infinity(const T& n) { return is_finite(n) ? std::optional(n) : std::optional(); } private: @@ -298,7 +298,7 @@ compute_placement() if(mConstraints_n == 3) { // If the matrix is singular it's inverse cannot be computed so an 'absent' value is returned. - boost::optional lOptional_Ai = inverse_matrix(mConstraints_A); + std::optional lOptional_Ai = inverse_matrix(mConstraints_A); if(lOptional_Ai) { const Matrix& lAi = *lOptional_Ai; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h index a11066435a3..4ed45a02d1e 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -40,8 +40,8 @@ namespace internal { struct Dummy_filter { template inline - const boost::optional - operator()(const Profile&, const boost::optional& op) const + const std::optional + operator()(const Profile&, const std::optional& op) const { return op; } @@ -94,7 +94,7 @@ inline std::string matrix_to_string(const Matrix& m) { } template -inline std::string optional_to_string(const boost::optional& o) { +inline std::string optional_to_string(const std::optional& o) { if(o) return boost::str(boost::format("%1%") % *o); else return std::string("NONE"); diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h index 612b9182046..5c23e83e94f 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h @@ -127,8 +127,8 @@ public: typedef typename Geom_traits::Vector_3 Vector; typedef typename Geom_traits::Equal_3 Equal_3; - typedef boost::optional Cost_type; - typedef boost::optional Placement_type; + typedef std::optional Cost_type; + typedef std::optional Placement_type; struct Compare_id { @@ -149,7 +149,7 @@ public: bool operator()(const halfedge_descriptor a, const halfedge_descriptor b) const { - // NOTE: A cost is a boost::optional<> value. + // NOTE: A cost is a std::optional<> value. // Absent optionals are ordered first; that is, "none < T" and "T > none" for any defined T != none. // In consequence, edges with undefined costs will be promoted to the top of the priority queue and popped out first. return m_algorithm->get_data(a).cost() < m_algorithm->get_data(b).cost(); @@ -333,9 +333,9 @@ private: CGAL_expensive_assertion(!mPQ->contains(h)); } - boost::optional pop_from_PQ() + std::optional pop_from_PQ() { - boost::optional opt_h = mPQ->extract_top(); + std::optional opt_h = mPQ->extract_top(); if(opt_h) { CGAL_assertion(is_primary_edge(*opt_h)); @@ -592,7 +592,7 @@ loop() // Pops and processes each edge from the PQ - boost::optional opt_h; + std::optional opt_h; #ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING int i_rm = 0; @@ -630,7 +630,7 @@ loop() std::cout << "step " << i_rm << " " << get(m_vpm, source(*h, m_tm)) << " " << get(m_vpm, target(*h, m_tm)) << "\n"; #endif - if(m_should_ignore(profile, placement)!= boost::none){ + if(m_should_ignore(profile, placement)!= std::nullopt){ collapse(profile, placement); } else diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp index 0f5c8e99109..f24432ba3ad 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp @@ -46,7 +46,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base My_visitor(Stats* s) : stats(s) {} // Called during the collecting phase for each edge collected. - void OnCollected(const Profile&, const boost::optional&) + void OnCollected(const Profile&, const std::optional&) { ++(stats->collected); std::cerr << "\rEdges collected: " << stats->collected << std::endl; @@ -55,7 +55,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base // Called during the processing phase for each edge selected. // If cost is absent the edge won't be collapsed. void OnSelected(const Profile&, - boost::optional cost, + std::optional cost, std::size_t /* initial */, std::size_t /* current */) { @@ -67,7 +67,7 @@ struct My_visitor : SMS::Edge_collapse_visitor_base // Called during the processing phase for each edge being collapsed. // If placement is absent the edge is left uncollapsed. void OnCollapsing(const Profile&, - boost::optional placement) + std::optional placement) { if(!placement) ++(stats->placement_uncomputable); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp index e1b27a66d55..00e6cf68501 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp @@ -198,7 +198,7 @@ void write (SurfaceSP aSurface, string aName) } template -string opt2str (const boost::optional& o) +string opt2str (const std::optional& o) { ostringstream ss; if(o) @@ -222,7 +222,7 @@ string point2str (const P& p) } template -string optpoint2str (const boost::optional

    & p) +string optpoint2str (const std::optional

    & p) { ostringstream ss; if(p) @@ -232,7 +232,7 @@ string optpoint2str (const boost::optional

    & p) return ss.str(); } template -string optfloat2str (const boost::optional& n) +string optfloat2str (const std::optional& n) { ostringstream ss; if(n) @@ -258,7 +258,7 @@ string edge2str (const E& e) return ss.str(); } -template ostream& operator << (ostream& os, const boost::optional& o) { return os << opt2str(o); } +template ostream& operator << (ostream& os, const std::optional& o) { return os << opt2str(o); } string normalize_EOL (string line) { @@ -304,12 +304,12 @@ public : CHECK(aSurface.is_valid()); } - virtual void OnCollected(const Profile& aProfile, const boost::optional& aCost) const + virtual void OnCollected(const Profile& aProfile, const std::optional& aCost) const { TEST_TRACE(str (boost::format("Collecting %1% : cost=%2%") % edge2str(aProfile.v0_v1()) % optfloat2str(aCost))); } - virtual void OnCollapsing(const Profile& aProfile, const boost::optional& aP) const + virtual void OnCollapsing(const Profile& aProfile, const std::optional& aP) const { TEST_TRACE(str (boost::format("S %1% - Collapsing %2% : placement=%3%") % mStep % edge2str(aProfile.v0_v1()) % optpoint2str(aP))); diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Curves_on_surface_topology.h b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Curves_on_surface_topology.h index d8fafdc0304..21a7c20ee0e 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Curves_on_surface_topology.h +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Curves_on_surface_topology.h @@ -91,7 +91,7 @@ namespace Surface_mesh_topology { /// Number type of the weights. using Weight_t=double; - /// creates an Euclidean_length_weight_functor given a mesh. + /// creates a Euclidean_length_weight_functor given a mesh. Euclidean_length_weight_functor(const Mesh& m); }; diff --git a/Surface_mesher/include/CGAL/AABB_polyhedral_oracle.h b/Surface_mesher/include/CGAL/AABB_polyhedral_oracle.h index a57dc122563..d03fe0b0fe5 100644 --- a/Surface_mesher/include/CGAL/AABB_polyhedral_oracle.h +++ b/Surface_mesher/include/CGAL/AABB_polyhedral_oracle.h @@ -84,7 +84,7 @@ namespace CGAL { Object operator()(const Surface_3& surface, const Segment_3& segment) const { - boost::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > + std::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > intersection = surface.tree()->any_intersection(segment); if ( intersection ) @@ -95,7 +95,7 @@ namespace CGAL { Object operator()(const Surface_3& surface, const Line_3& line) const { - boost::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > + std::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > intersection = surface.tree()->any_intersection(line); if ( intersection ) @@ -105,7 +105,7 @@ namespace CGAL { } Object operator()(const Surface_3& surface, const Ray_3& ray) const { - boost::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > + std::optional< typename AABB_traits::template Intersection_and_primitive_id::Type > intersection = surface.tree()->any_intersection(ray); if ( intersection ) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h index 82146be11f5..a816ba72255 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h @@ -102,7 +102,7 @@ public: typedef typename Base::Status_line_iterator Status_line_iterator; typedef std::pair Intersection_point; - typedef boost::variant + typedef std::variant Intersection_result; typedef std::vector Intersection_vector; typedef Random_access_output_iterator diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index 63ad21b4bc1..acc94c13abc 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -624,7 +624,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, intersector(xc, (*sc_it)->last_curve(), vector_inserter(xections)); CGAL_assertion(xections.size() == 1); auto& item = xections.front(); - xc = *boost::get(&item); + xc = *std::get_if(&item); } CGAL_assertion @@ -667,7 +667,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) { - if ((boost::get(&(*vi)) != nullptr) && + if ((std::get_if(&(*vi)) != nullptr) && this->m_traits->equal_2_object()(ctr_min(c1->last_curve()), ctr_min(c2->last_curve()))) { @@ -685,7 +685,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, vector_inserter vi_last = vi_end; --vi_last; - if (boost::get(&(*vi_last)) != nullptr) { + if (std::get_if(&(*vi_last)) != nullptr) { CGAL_SS_PRINT_TEXT("Skipping common right endpoint..."); CGAL_SS_PRINT_EOL(); --vi_end; @@ -712,7 +712,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, vector_inserter vi_last = vi_end; --vi_last; - if (boost::get(&(*vi_last)) != nullptr) { + if (std::get_if(&(*vi_last)) != nullptr) { CGAL_SS_PRINT_TEXT("Skipping common right endpoint on boundary..."); CGAL_SS_PRINT_EOL(); --vi_end; @@ -725,7 +725,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, // SL: curves are split and no event strictly before the current event should // be reported if (vi != vi_end) { - const Intersection_point* xp_point = boost::get(&(*vi)); + const Intersection_point* xp_point = std::get_if(&(*vi)); if (xp_point != nullptr) { // Skip the intersection point if it is not larger than the current event. // To correctly do so, we have to set the ps_x and ps_y for xp_point->first @@ -744,7 +744,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, bool first_i = true; for (; vi != vi_end; ++vi) { Multiplicity multiplicity = 0; - const Intersection_point* xp_point = boost::get(&(*vi)); + const Intersection_point* xp_point = std::get_if(&(*vi)); if (xp_point != nullptr) { Point_2 xp = xp_point->first; multiplicity = xp_point->second; @@ -753,7 +753,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, _create_intersection_point(xp, multiplicity, c1, c2); } else { - const X_monotone_curve_2 icv = *boost::get(&(*vi)); + const X_monotone_curve_2 icv = *std::get_if(&(*vi)); // CGAL_assertion(icv != nullptr); CGAL_SS_PRINT_TEXT("Found an overlap"); diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h index d3c785ea8f2..1fdbd1ab094 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h @@ -51,7 +51,7 @@ void make_x_monotone(CurveInputIter begin, CurveInputIter end, { typedef typename Traits::Point_2 Point_2; typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef boost::variant Make_x_monotone_result; + typedef std::variant Make_x_monotone_result; // Split the input curves into x-monotone objects. std::size_t num_of_curves = std::distance(begin, end); @@ -63,14 +63,14 @@ void make_x_monotone(CurveInputIter begin, CurveInputIter end, // Transform each object to either a point or an x-monotone curve. for (const auto& obj : object_vec) { - const X_monotone_curve_2* xcv = boost::get(&obj); + const X_monotone_curve_2* xcv = std::get_if(&obj); if (xcv != nullptr) { // The object is an x-monotone curve. *x_curves++ = *xcv; continue; } // The object is an isolated point. - const Point_2* pt = boost::get(&obj); + const Point_2* pt = std::get_if(&obj); CGAL_assertion(pt != nullptr); *iso_points++ = *pt; } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h index 4fbe1180756..798284fa04e 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -317,7 +317,7 @@ Sliver_removal_result flip_3_to_2(typename C3t3::Edge& edge, } ch->vertex(v)->set_cell(ch); - inc_cells[ch->vertex(v)] = boost::none; + inc_cells[ch->vertex(v)] = std::nullopt; ch->reset_cache_validity(); } } @@ -596,8 +596,8 @@ void find_best_flip_to_improve_dh(C3t3& c3t3, if(tr.is_infinite(vh)) continue; - boost::optional>& o_inc_vh = inc_cells[vh]; - if (o_inc_vh == boost::none) + std::optional>& o_inc_vh = inc_cells[vh]; + if (o_inc_vh == std::nullopt) { boost::container::small_vector inc_vec; tr.incident_cells(vh, std::back_inserter(inc_vec)); @@ -620,7 +620,7 @@ void find_best_flip_to_improve_dh(C3t3& c3t3, indices(facet_circulator->second, i)); if (curr_vertex != vh0 && curr_vertex != vh1) { - if (is_edge_uv(vh, curr_vertex, boost::get(o_inc_vh))) + if (is_edge_uv(vh, curr_vertex, o_inc_vh.value())) { is_edge = true; break; @@ -761,8 +761,8 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, facet_circulator++; facet_circulator++; - boost::optional>& o_inc_vh = inc_cells[vh]; - if (o_inc_vh == boost::none) + std::optional>& o_inc_vh = inc_cells[vh]; + if (o_inc_vh == std::nullopt) { boost::container::small_vector inc_vec; tr.incident_cells(vh, std::back_inserter(inc_vec)); @@ -778,7 +778,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, indices(facet_circulator->second, i)); if (curr_vertex != vh0 && curr_vertex != vh1) { - if (is_edge_uv(vh, curr_vertex, boost::get(o_inc_vh))) + if (is_edge_uv(vh, curr_vertex, o_inc_vh.value())) return NOT_FLIPPABLE; } } @@ -948,7 +948,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, } ch->vertex(v)->set_cell(ch); - inc_cells[ch->vertex(v)] = boost::none; + inc_cells[ch->vertex(v)] = std::nullopt; ch->reset_cache_validity(); } } @@ -1186,14 +1186,14 @@ std::size_t flip_all_edges(const std::vector& edges, Tr& tr = c3t3.triangulation(); std::unordered_map > > inc_cells; + std::optional > > inc_cells; std::size_t count = 0; for (const VertexPair& vp : edges) { - boost::optional>& + std::optional>& o_inc_vh = inc_cells[vp.first]; - if (o_inc_vh == boost::none) + if (o_inc_vh == std::nullopt) { boost::container::small_vector inc_vec; tr.incident_cells(vp.first, std::back_inserter(inc_vec)); @@ -1202,7 +1202,7 @@ std::size_t flip_all_edges(const std::vector& edges, Cell_handle ch; int i0, i1; - if (is_edge_uv(vp.first, vp.second, boost::get(o_inc_vh), ch, i0, i1)) + if (is_edge_uv(vp.first, vp.second, o_inc_vh.value(), ch, i0, i1)) { Edge edge(ch, i0, i1); diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 797fe36f45f..8c08f760387 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -92,7 +92,7 @@ private: } template - boost::optional + std::optional find_adjacent_facet_on_surface(const Facet& f, const Edge& edge, const C3t3& c3t3, @@ -212,7 +212,7 @@ private: for (const std::array& ei : edges) { Edge edge(ch, ei[0], ei[1]); - if (boost::optional neighbor + if (std::optional neighbor = find_adjacent_facet_on_surface(f, edge, c3t3, cell_selector)) { const Facet neigh = *neighbor; //already a canonical_facet @@ -308,7 +308,7 @@ private: #endif } - boost::optional project(const Surface_patch_index& si, + std::optional project(const Surface_patch_index& si, const Vector_3& gi) { CGAL_assertion(subdomain_FMLS_indices.find(si) != subdomain_FMLS_indices.end()); @@ -538,7 +538,7 @@ public: = project_on_tangent_plane(smoothed_position, current_pos, vertices_normals[v][si]); //Check if the mls surface exists to avoid degenerated cases - if (boost::optional mls_projection = project(si, normal_projection)) { + if (std::optional mls_projection = project(si, normal_projection)) { final_position = final_position + *mls_projection; } else { @@ -575,7 +575,7 @@ public: { //Check if the mls surface exists to avoid degenerated cases - if (boost::optional mls_projection = project(si, current_pos)) { + if (std::optional mls_projection = project(si, current_pos)) { final_position = final_position + *mls_projection; } else { @@ -661,7 +661,7 @@ public: current_pos, vertices_normals[v][si]); - if (boost::optional mls_projection = project(si, normal_projection)) + if (std::optional mls_projection = project(si, normal_projection)) final_position = final_position + *mls_projection; else final_position = smoothed_position; @@ -683,7 +683,7 @@ public: const Vector_3 current_pos(CGAL::ORIGIN, point(v->point())); - if (boost::optional mls_projection = project(si, current_pos)) + if (std::optional mls_projection = project(si, current_pos)) { const typename Tr::Point new_pos(CGAL::ORIGIN + *mls_projection); if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 4c8fac7609c..d06a9c52a97 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -30,7 +30,7 @@ #include #include -#include +#include namespace CGAL { @@ -321,15 +321,15 @@ public: Cell_handle c = c_i.first; const std::array& f_on_surface = c_i.second; - boost::optional patch; + std::optional patch; for (int i = 0; i < 4; ++i) { if (f_on_surface[i]) { Surface_patch_index spi = m_c3t3.surface_patch_index(c, i); - if (patch != boost::none && patch != spi) + if (patch != std::nullopt && patch != spi) { - patch = boost::none; + patch = std::nullopt; break; } else @@ -338,7 +338,7 @@ public: } } } - if(patch == boost::none) + if(patch == std::nullopt) continue; for (int i = 0; i < 4; ++i) @@ -346,7 +346,7 @@ public: if(f_on_surface[i]) m_c3t3.remove_from_complex(c, i); else - m_c3t3.add_to_complex(c, i, patch.get()); + m_c3t3.add_to_complex(c, i, patch.value()); } m_c3t3.remove_from_complex(c); diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index be81a7809a4..1c4237191d0 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -535,7 +536,7 @@ void set_index(typename C3t3::Vertex_handle v, const C3t3& c3t3) v->set_index(typename C3t3::Curve_index(1)); break; case 0: - v->set_index(boost::get(v->index())); + v->set_index(Mesh_3::internal::get_index(v->index())); break; default: CGAL_assertion(false); diff --git a/Three/include/CGAL/Three/exceptions.h b/Three/include/CGAL/Three/exceptions.h index cf3640d5b46..dd923aa5b2b 100644 --- a/Three/include/CGAL/Three/exceptions.h +++ b/Three/include/CGAL/Three/exceptions.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace CGAL{ @@ -44,7 +44,7 @@ public: template struct Optional_or_bool { - typedef boost::optional type; + typedef std::optional type; template static type invoke(Callable f) { return type(f()); } diff --git a/Triangulation/include/CGAL/Delaunay_triangulation.h b/Triangulation/include/CGAL/Delaunay_triangulation.h index 262f451fdc1..8fa25e4d08c 100644 --- a/Triangulation/include/CGAL/Delaunay_triangulation.h +++ b/Triangulation/include/CGAL/Delaunay_triangulation.h @@ -130,12 +130,12 @@ private: // Wrapper struct Side_of_oriented_subsphere_d { - boost::optional* fop; + std::optional* fop; Construct_flat_orientation_d cfo; In_flat_side_of_oriented_sphere_d ifsoos; Side_of_oriented_subsphere_d( - boost::optional& x, + std::optional& x, Construct_flat_orientation_d const&y, In_flat_side_of_oriented_sphere_d const&z) : fop(&x), cfo(y), ifsoos(z) {} @@ -145,7 +145,7 @@ private: { if(!*fop) *fop=cfo(a,b); - return ifsoos(fop->get(),a,b,p); + return ifsoos(fop->value(),a,b,p); } }; public: @@ -416,7 +416,7 @@ Delaunay_triangulation Dark_triangulation dark_side( maximal_dimension(), flat_orientation_ ? - std::pair(current_dimension(), flat_orientation_.get_ptr()) + std::pair(current_dimension(), &flat_orientation_.value()) : std::pair((std::numeric_limits::max)(), (Flat_orientation_d*) nullptr) ); Dark_s_handle dark_s; diff --git a/Triangulation/include/CGAL/Regular_triangulation.h b/Triangulation/include/CGAL/Regular_triangulation.h index 2d63893e38a..b2e6a651d49 100644 --- a/Triangulation/include/CGAL/Regular_triangulation.h +++ b/Triangulation/include/CGAL/Regular_triangulation.h @@ -129,12 +129,12 @@ private: // Wrapper struct Power_side_of_power_sphere_for_non_maximal_dim_d { - boost::optional* fop; + std::optional* fop; Construct_flat_orientation_d cfo; In_flat_power_side_of_power_sphere_d ifpt; Power_side_of_power_sphere_for_non_maximal_dim_d( - boost::optional& x, + std::optional& x, Construct_flat_orientation_d const&y, In_flat_power_side_of_power_sphere_d const&z) : fop(&x), cfo(y), ifpt(z) {} @@ -144,7 +144,7 @@ private: { if(!*fop) *fop=cfo(a,b); - return ifpt(fop->get(),a,b,p); + return ifpt(fop->value(),a,b,p); } }; diff --git a/Triangulation/include/CGAL/Triangulation.h b/Triangulation/include/CGAL/Triangulation.h index 55a118a7b69..1c1bff78370 100644 --- a/Triangulation/include/CGAL/Triangulation.h +++ b/Triangulation/include/CGAL/Triangulation.h @@ -88,12 +88,12 @@ protected: // Wrapper struct Coaffine_orientation_d { - boost::optional* fop; + std::optional* fop; Construct_flat_orientation_d cfo; In_flat_orientation_d ifo; Coaffine_orientation_d( - boost::optional& x, + std::optional& x, Construct_flat_orientation_d const&y, In_flat_orientation_d const&z) : fop(&x), cfo(y), ifo(z) {} @@ -102,9 +102,9 @@ protected: CGAL::Orientation operator()(Iter a, Iter b) const { if (*fop) - return ifo(fop->get(),a,b); + return ifo(fop->value(),a,b); *fop = cfo(a,b); - CGAL_assertion(ifo(fop->get(),a,b) == CGAL::POSITIVE); + CGAL_assertion(ifo(fop->value(),a,b) == CGAL::POSITIVE); return CGAL::POSITIVE; } }; @@ -117,7 +117,7 @@ protected: flat_orientation_ = *preset_flat_orientation_.second; } else - flat_orientation_ = boost::none; + flat_orientation_ = std::nullopt; } typedef typename TriangulationTraits::Orientation_d @@ -188,7 +188,7 @@ protected: // DATA MEMBERS Triangulation_ds tds_; const Geom_traits kernel_; Vertex_handle infinity_; - mutable boost::optional flat_orientation_; + mutable std::optional flat_orientation_; // The user can specify a Flat_orientation_d object to be used for // orienting simplices of a specific dimension // (= preset_flat_orientation_.first) diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h index 6f7a9e5ea85..e57a8ebb6f4 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h @@ -40,7 +40,7 @@ public: /*! A function object whose `operator()` computes the intersection of two segments. -`boost::optional > operator()(Segment_2 s1, Segment_2 s2);` +`std::optional > operator()(Segment_2 s1, Segment_2 s2);` Returns the intersection of `s1` and `s2`. */ typedef unspecified_type Intersect_2; diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 0895612e8ea..4ce20796d1a 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -1891,16 +1891,16 @@ compute_intersection(const Gt& gt, #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS typedef typename Gt::Segment_2 Segment_2; if(result){ - if (const Segment_2* s = boost::get(&*result)){ + if (const Segment_2* s = std::get_if(&*result)){ std::cerr << CGAL::internal::cdt_2_indent_level << "compute_intersection: " << *s << '\n'; - }else if(const Point_2* p = boost::get(&*result)) + }else if(const Point_2* p = std::get_if(&*result)) std::cerr << CGAL::internal::cdt_2_indent_level << "compute_intersection: " << *p << '\n'; } #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS if(result){ - if(const Point_2* p = boost::get(&*result)){ + if(const Point_2* p = std::get_if(&*result)){ pi = *p; return true; } diff --git a/Visibility_2/examples/Visibility_2/simple_polygon_visibility_2.cpp b/Visibility_2/examples/Visibility_2/simple_polygon_visibility_2.cpp index be460a83626..dc23e31bfaf 100644 --- a/Visibility_2/examples/Visibility_2/simple_polygon_visibility_2.cpp +++ b/Visibility_2/examples/Visibility_2/simple_polygon_visibility_2.cpp @@ -38,7 +38,7 @@ int main() { CGAL::Arr_naive_point_location pl(env); CGAL::Arr_point_location_result::Type obj = pl.locate(q); // The query point locates in the interior of a face - face = boost::get (&obj); + face = std::get_if (&obj); // compute non regularized visibility area // Define visibility object type that computes non-regularized visibility area diff --git a/Visibility_2/include/CGAL/Simple_polygon_visibility_2.h b/Visibility_2/include/CGAL/Simple_polygon_visibility_2.h index f5cf4d1873d..384d99acb30 100644 --- a/Visibility_2/include/CGAL/Simple_polygon_visibility_2.h +++ b/Visibility_2/include/CGAL/Simple_polygon_visibility_2.h @@ -306,7 +306,7 @@ namespace CGAL { Location_result result = point_location.ray_shoot_up(q); if(const Halfedge_const_handle* e = - boost::get(&(result))) + std::get_if(&(result))) { CGAL_assertion((*e)->face() == face); Point_2 p(q.x(), @@ -321,7 +321,7 @@ namespace CGAL { return (*e)->next()->ccb(); } else if (const Vertex_const_handle* v = - boost::get(&(result))) + std::get_if(&(result))) { Halfedge_around_vertex_const_circulator cir = (*v)->incident_halfedges(); diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/Voronoi_diagram_2.h b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/Voronoi_diagram_2.h index e0dd1cdc461..344fed3378c 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/Voronoi_diagram_2.h +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/Voronoi_diagram_2.h @@ -720,7 +720,7 @@ typedef unspecified_type Site_iterator; /*! The result type of the point location queries. */ -typedef boost::variant +typedef std::variant Locate_result; /// @} diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/AdaptationTraits_2.h b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/AdaptationTraits_2.h index bdd87560936..45693eaf6f9 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/AdaptationTraits_2.h +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/AdaptationTraits_2.h @@ -113,7 +113,7 @@ It must provide the following operator:

    `result_type operator()(Delaunay_graph dg, Point_2 p)`
    where the result type `result_type` is -`boost::variant`. +`std::variant`. This type is required only if `Has_nearest_site_2` is equal to `CGAL::Tag_true`. diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location.cpp b/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location.cpp index 8451c216bde..967660d2efb 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location.cpp +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location.cpp @@ -60,17 +60,17 @@ int main() << ") lies on a Voronoi " << std::flush; Locate_result lr = vd.locate(p); - if ( Vertex_handle* v = boost::get(&lr) ) { + if ( Vertex_handle* v = std::get_if(&lr) ) { std::cout << "vertex." << std::endl; std::cout << "The Voronoi vertex is:" << std::endl; std::cout << "\t" << (*v)->point() << std::endl; - } else if ( Halfedge_handle* e = boost::get(&lr) ) { + } else if ( Halfedge_handle* e = std::get_if(&lr) ) { std::cout << "edge." << std::endl; std::cout << "The source and target vertices " << "of the Voronoi edge are:" << std::endl; print_endpoint(*e, true); print_endpoint(*e, false); - } else if ( Face_handle* f = boost::get(&lr) ) { + } else if ( Face_handle* f = std::get_if(&lr) ) { std::cout << "face." << std::endl; std::cout << "The vertices of the Voronoi face are" << " (in counterclockwise order):" << std::endl; diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp b/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp index 3fa8850e2cc..59ec3453781 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp @@ -62,17 +62,17 @@ int main() << ") lies on a Voronoi " << std::flush; Locate_result lr = vd.locate(p); - if ( Vertex_handle* v = boost::get(&lr) ) { + if ( Vertex_handle* v = std::get_if(&lr) ) { std::cout << "vertex." << std::endl; std::cout << "The Voronoi vertex is:" << std::endl; std::cout << "\t" << (*v)->point() << std::endl; - } else if ( Halfedge_handle* e = boost::get(&lr) ) { + } else if ( Halfedge_handle* e = std::get_if(&lr) ) { std::cout << "edge." << std::endl; std::cout << "The source and target vertices " << "of the Voronoi edge are:" << std::endl; print_endpoint(*e, true); print_endpoint(*e, false); - } else if ( Face_handle* f = boost::get(&lr) ) { + } else if ( Face_handle* f = std::get_if(&lr) ) { std::cout << "face." << std::endl; std::cout << "The vertices of the Voronoi face are" << " (in counterclockwise order):" << std::endl; diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2.h index 82f0bdc6d67..9d4e3785215 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2.h @@ -41,7 +41,7 @@ #include -#include +#include #include namespace CGAL { @@ -268,7 +268,7 @@ protected: public: typedef typename Adaptation_traits::Point_2 Point_2; - typedef boost::variant + typedef std::variant Locate_result; private: @@ -634,15 +634,15 @@ public: Query_result ns_qr = nearest_site(dual_, p); if ( const Delaunay_vertex_handle* dv = - boost::get(&ns_qr) ) { + std::get_if(&ns_qr) ) { return Face_handle( Face(this, *dv) ); } else if ( const Delaunay_face_handle *df = - boost::get(&ns_qr) ) { + std::get_if(&ns_qr) ) { Find_valid_vertex vertex_finder; Delaunay_face_handle dfvalid = vertex_finder(this, *df); return Vertex_handle( Vertex(this, dfvalid) ); } else if ( const Delaunay_edge* de = - boost::get(&ns_qr) ) { + std::get_if(&ns_qr) ) { CGAL_assertion( !edge_rejector()(dual_, *de) ); if ( dual_.dimension() == 1 ) { Delaunay_vertex_handle v1 = diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h index d0f1fbf11a6..6bf63d83fde 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h @@ -20,7 +20,7 @@ #include #include -#include +#include namespace CGAL { @@ -48,7 +48,7 @@ class Apollonius_graph_nearest_site_2 typedef typename Delaunay_graph::Edge_circulator Edge_circulator; public: - typedef boost::variant result_type; + typedef std::variant result_type; result_type operator()(const Delaunay_graph& dg, const Point_2& p) const { CGAL_precondition( dg.dimension() >= 0 ); diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h index 6014724302f..f3739a2da68 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace CGAL { @@ -48,7 +48,7 @@ class Delaunay_triangulation_nearest_site_2 typedef typename Delaunay_graph::Edge_circulator Edge_circulator; public: - typedef boost::variant result_type; + typedef std::variant result_type; result_type operator()(const Delaunay_graph& dg, const Point_2& p) const { CGAL_precondition( dg.dimension() >= 0 ); diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h index 9b9c88965d9..ebc19ed6e1f 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace CGAL { @@ -50,7 +50,7 @@ class Regular_triangulation_nearest_site_2 typedef typename Geom_traits::Weighted_point_2 Weighted_point_2; public: - typedef boost::variant result_type; + typedef std::variant result_type; result_type operator()(const Delaunay_graph& dg, const Point_2& p) const { CGAL_precondition( dg.dimension() >= 0 ); diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h index 8031047d03b..5d89d1c737a 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace CGAL { @@ -95,7 +95,7 @@ private: } public: - typedef boost::variant result_type; + typedef std::variant result_type; result_type operator()(const Delaunay_graph& dg, const Point_2& p) const { CGAL_precondition( dg.dimension() >= 0 ); diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_concept.h b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_concept.h index 9628e9ab45f..b9761752204 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_concept.h +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_concept.h @@ -17,7 +17,7 @@ #include #include "helper_functions.h" #include -#include +#include template @@ -567,11 +567,11 @@ void test_ns_concept(const DG& dg, const AT& at, CGAL::Tag_true) result_type qr = ns(dg, p); - if ( Face_handle* f = boost::get(&qr) ) { + if ( Face_handle* f = std::get_if(&qr) ) { kill_warning(f); - } else if ( Edge* e = boost::get(&qr) ) { + } else if ( Edge* e = std::get_if(&qr) ) { kill_warning(e); - } else if ( Vertex_handle* v = boost::get(&qr) ) { + } else if ( Vertex_handle* v = std::get_if(&qr) ) { kill_warning(v); } else { // we should have reached this line diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_locate.h b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_locate.h index 285e03cb62b..cfcff23df76 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_locate.h +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_locate.h @@ -15,7 +15,7 @@ #include #include -#include +#include #include "helper_functions.h" @@ -81,13 +81,13 @@ void test_locate_dg(const VDA& vda, const Projector& , for (unsigned int i = 0; i < vecp.size(); ++i) { os << vecp[i] << "\t --> \t" << std::flush; ns_qr = nearest_site(vda.dual(), vecp[i]); - if ( Vertex_handle* v = boost::get(&ns_qr) ) { + if ( Vertex_handle* v = std::get_if(&ns_qr) ) { os << "FACE"; kill_warning( v ); - } else if ( Edge* e = boost::get(&ns_qr) ) { + } else if ( Edge* e = std::get_if(&ns_qr) ) { os << "EDGE"; kill_warning( e ); - } else if ( Face_handle* f = boost::get(&ns_qr) ) { + } else if ( Face_handle* f = std::get_if(&ns_qr) ) { os << "VERTEX"; kill_warning( f ); } else { @@ -114,7 +114,7 @@ void test_locate_vd(const VDA& vda, const Point_vector& vecp, for (unsigned int i = 0; i < vecp.size(); ++i) { os << vecp[i] << "\t --> \t" << std::flush; lr = vda.locate(vecp[i]); - if ( Halfedge_handle* ee = boost::get(&lr) ) { + if ( Halfedge_handle* ee = std::get_if(&lr) ) { Halfedge_handle e = *ee; os << "VORONOI EDGE"; if ( print_sites ) { @@ -135,7 +135,7 @@ void test_locate_vd(const VDA& vda, const Point_vector& vecp, } } // if ( print_sites ) kill_warning( e ); - } else if ( Vertex_handle* vv = boost::get(&lr) ) { + } else if ( Vertex_handle* vv = std::get_if(&lr) ) { os << "VORONOI VERTEX"; Vertex_handle v = *vv; if ( print_sites ) { @@ -145,7 +145,7 @@ void test_locate_vd(const VDA& vda, const Point_vector& vecp, } } kill_warning( v ); - } else if ( Face_handle* ff = boost::get(&lr) ) { + } else if ( Face_handle* ff = std::get_if(&lr) ) { typename VDA::Face_handle f = *ff; kill_warning( f ); os << "VORONOI FACE"; diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h index 2b2974ae273..bb9ea6b426e 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h @@ -223,13 +223,13 @@ void test_vdqr_concept(const VDA& vda, const CGAL::Tag_true&) Point_2 p(0,0); Locate_result lr = vda.locate(p); - if ( Vertex_handle* vv = boost::get(&lr) ) { + if ( Vertex_handle* vv = std::get_if(&lr) ) { Vertex_handle v = *vv; kill_warning(v); - } else if ( Halfedge_handle* ee = boost::get(&lr) ) { + } else if ( Halfedge_handle* ee = std::get_if(&lr) ) { Halfedge_handle e = *ee; kill_warning(e); - } else if ( Face_handle* ff = boost::get(&lr) ) { + } else if ( Face_handle* ff = std::get_if(&lr) ) { Face_handle f = *ff; kill_warning(f); }