Merge branch 'cgal/master' into PMP-BF_autorefine

This commit is contained in:
Sébastien Loriot 2023-08-28 13:44:44 +02:00
commit a528464f31
902 changed files with 25304 additions and 22105 deletions

35
.github/workflows/reuse.yml vendored Normal file
View File

@ -0,0 +1,35 @@
# SPDX-FileCopyrightText: 2020 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: REUSE Compliance Check
on: [push, pull_request]
jobs:
reuse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: REUSE version
uses: fsfe/reuse-action@v2
with:
args: --version
- name: REUSE lint
uses: fsfe/reuse-action@v2
with:
args: --include-submodules lint
- name: REUSE SPDX SBOM
uses: fsfe/reuse-action@v2
with:
args: spdx
- name: install dependencies
run: sudo apt-get install -y cmake
- name: Create CGAL internal release
run: |
mkdir -p ./release
cmake -DDESTINATION=./release -DCGAL_VERSION=9.9 -P ./Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
- name: REUSE lint release tarball
uses: fsfe/reuse-action@v2
with:
args: --root ./release/CGAL-9.9 --include-submodules lint

12
.reuse/dep5 Normal file
View File

@ -0,0 +1,12 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: CGAL
Upstream-Contact: CGAL Editorial Board <info@cgal.org>
Source: https://github.com/CGAL/cgal
Files: .* *.cmake *.md .github/* Maintenance/* */TODO */doc/* */deb/* */applications/* */doc_html/* */scripts/* */developer_scripts/* */demo/* */examples/* */src/* */test/* */benchmarks/* */benchmark/* */package_info/* */data/* */cmake/*
Copyright: 1995-2023 The CGAL Project
License: CC0-1.0
Files: CMakeLists.txt GraphicsView/include/CGAL/Qt/ImageInterface.ui GraphicsView/include/CGAL/Qt/resources/qglviewer-icon.xpm Installation/AUTHORS Installation/CMakeLists.txt Installation/README Installation/auxiliary/cgal_create_cmake_script.1 Installation/auxiliary/gmp/README Installation/include/CGAL/license/gpl_package_list.txt MacOSX/auxiliary/cgal_app.icns copyright
Copyright: 1995-2023 The CGAL Project
License: CC0-1.0

View File

@ -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;

View File

@ -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<FT> operator()(const Ray_3& r, const Bounding_box& bbox)`.
`boost::optional<std::pair<FT, Intersection_and_primitive_id<Ray_3>::%Type > >
`std::optional<FT> operator()(const Ray_3& r, const Bounding_box& bbox)`.
`std::optional<std::pair<FT, Intersection_and_primitive_id<Ray_3>::%Type > >
operator()(const Ray_3& r, const Primitive& primitive)`.
A common algorithm to compute the intersection between a bounding box and a ray is <A

View File

@ -119,10 +119,10 @@ typedef unspecified_type Do_intersect;
/*!
A functor object to compute the intersection of a query and a primitive. Provides the operator:
`boost::optional<Intersection_and_primitive_id<Query>::%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<Intersection_and_primitive_id<Query>::%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<Object_and_primitive_id>`.
Before the release 4.3 of \cgal, the return type of this function used to be `std::optional<Object_and_primitive_id>`.
*/
typedef unspecified_type Intersection;

View File

@ -19,8 +19,8 @@ typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef boost::optional< Tree::Intersection_and_primitive_id<Segment>::Type > Segment_intersection;
typedef boost::optional< Tree::Intersection_and_primitive_id<Plane>::Type > Plane_intersection;
typedef std::optional< Tree::Intersection_and_primitive_id<Segment>::Type > Segment_intersection;
typedef std::optional< Tree::Intersection_and_primitive_id<Plane>::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<Point>(&(intersection->first));
const Point* p = std::get_if<Point>(&(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<Segment>(&(plane_intersection->first)))
if(std::get_if<Segment>(&(plane_intersection->first)))
std::cout << "intersection object is a segment" << std::endl;
}

View File

@ -23,7 +23,7 @@ typedef boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type> Ray_intersection;
typedef std::optional<Tree::Intersection_and_primitive_id<Ray>::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<Point>(&(intersection->first))){
const Point* p = boost::get<Point>(&(intersection->first) );
if(std::get_if<Point>(&(intersection->first))){
const Point* p = std::get_if<Point>(&(intersection->first) );
std::cout << *p << std::endl;
}
}

View File

@ -33,7 +33,7 @@ namespace CGAL {
/*!
* \ingroup PkgAABBTreeRef
* Primitive type for a edge of a polyhedral surface.
* Primitive type for an edge of a polyhedral surface.
* It wraps an `edge_descriptor` into a 3D segment.
* The class model of `HalfedgeGraph` from which the primitive is built should not be deleted
* while the AABB tree holding the primitive is in use.

View File

@ -27,7 +27,7 @@
#include <CGAL/Kernel_23/internal/Has_boolean_tags.h>
#include <boost/optional.hpp>
#include <optional>
/// \file AABB_traits.h
@ -39,7 +39,7 @@ template <class T>
struct Remove_optional { typedef T type; };
template <class T>
struct Remove_optional< ::boost::optional<T> > { typedef T type; };
struct Remove_optional< ::std::optional<T> > { typedef T type; };
//helper controlling whether extra data should be stored in the AABB_tree traits class
template <class Primitive, bool has_shared_data=Has_nested_type_Shared_data<Primitive>::value>
@ -85,7 +85,7 @@ struct AABB_traits_base_2<GeomTraits,true>{
typedef typename CGAL::Bbox_3 Bounding_box;
struct Intersection_distance {
boost::optional<FT> operator()(const Ray_3& ray, const Bounding_box& bbox) const {
std::optional<FT> operator()(const Ray_3& ray, const Bounding_box& bbox) const {
FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903
FT t_far = DBL_MAX;
@ -101,7 +101,7 @@ struct AABB_traits_base_2<GeomTraits,true>{
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<GeomTraits,true>{
// 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<Query>::%Type::first_type` is found according to
/// the result type of `GeomTraits::Intersect_3::operator()`. If it is
/// `boost::optional<T>` then it is `T`, and the result type otherwise.
/// `std::optional<T>` then it is `T`, and the result type otherwise.
template<typename Query>
struct Intersection_and_primitive_id {
typedef decltype(
@ -364,12 +364,12 @@ public:
Intersection(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
:m_traits(traits) {}
template<typename Query>
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
std::optional< typename Intersection_and_primitive_id<Query>::Type >
operator()(const Query& query, const typename AT::Primitive& primitive) const {
auto inter_res = GeomTraits().intersect_3_object()(query, internal::Primitive_helper<AT>::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()) );
}
};

View File

@ -26,7 +26,7 @@
#include <CGAL/AABB_tree/internal/AABB_search_tree.h>
#include <CGAL/AABB_tree/internal/Has_nested_type_Shared_data.h>
#include <CGAL/AABB_tree/internal/Primitive_helper.h>
#include <boost/optional.hpp>
#include <optional>
#ifdef CGAL_HAS_THREADS
#include <CGAL/mutex.h>
@ -142,7 +142,7 @@ namespace CGAL {
/// An explicit call to `build()` must be made to ensure that the next call to
/// a query function will not trigger the construction of the data structure.
/// A call to `AABBTraits::set_shared_data(t...)` is made using the internally stored traits.
/// This procedure has a complexity of \f$O(n log(n))\f$, where \f$n\f$ is the number of
/// This procedure has a complexity of \cgalBigO{n log(n)}, where \f$n\f$ is the number of
/// primitives of the tree.
template<typename ... T>
void build(T&& ...);
@ -270,7 +270,7 @@ public:
/// \tparam Query must be a type for which `Do_intersect` operators are
/// defined in the traits class `AABBTraits`.
template <typename Query>
boost::optional<Primitive_id> any_intersected_primitive(const Query& query) const;
std::optional<Primitive_id> 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 <typename Query>
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
std::optional< typename Intersection_and_primitive_id<Query>::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<typename Ray, typename SkipFunctor>
boost::optional< typename Intersection_and_primitive_id<Ray>::Type >
std::optional< typename Intersection_and_primitive_id<Ray>::Type >
first_intersection(const Ray& query, const SkipFunctor& skip) const;
/// \cond
template<typename Ray>
boost::optional< typename Intersection_and_primitive_id<Ray>::Type >
std::optional< typename Intersection_and_primitive_id<Ray>::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<typename Ray, typename SkipFunctor>
boost::optional<Primitive_id>
std::optional<Primitive_id>
first_intersected_primitive(const Ray& query, const SkipFunctor& skip) const;
/// \cond
template<typename Ray>
boost::optional<Primitive_id>
std::optional<Primitive_id>
first_intersected_primitive(const Ray& query) const
{
return first_intersected_primitive(query, [](Primitive_id){ return false; });
@ -963,7 +963,7 @@ public:
template <typename Tr>
template <typename Query>
boost::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
std::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
AABB_tree<Tr>::any_intersection(const Query& query) const
{
using namespace CGAL::internal::AABB_tree;
@ -975,7 +975,7 @@ public:
template <typename Tr>
template <typename Query>
boost::optional<typename AABB_tree<Tr>::Primitive_id>
std::optional<typename AABB_tree<Tr>::Primitive_id>
AABB_tree<Tr>::any_intersected_primitive(const Query& query) const
{
using namespace CGAL::internal::AABB_tree;

View File

@ -19,8 +19,7 @@
#include <functional>
#include <type_traits>
#include <boost/optional.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <optional>
# 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<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, current.nb_primitives/2));
@ -198,7 +197,7 @@ private:
template<typename AABBTraits>
template<typename Ray, typename SkipFunctor>
boost::optional< typename AABB_tree<AABBTraits>::template Intersection_and_primitive_id<Ray>::Type >
std::optional< typename AABB_tree<AABBTraits>::template Intersection_and_primitive_id<Ray>::Type >
AABB_tree<AABBTraits>::first_intersection(const Ray& query,
const SkipFunctor& skip) const {
static_assert(std::is_same<Ray, typename AABBTraits::Ray_3>::value,
@ -219,22 +218,22 @@ AABB_tree<AABBTraits>::first_intersection(const Ray& query,
break;
}
}
return boost::none;
return std::nullopt;
}
template<typename AABBTraits>
template<typename Ray, typename SkipFunctor>
boost::optional<typename AABB_tree<AABBTraits>::Primitive_id>
std::optional<typename AABB_tree<AABBTraits>::Primitive_id>
AABB_tree<AABBTraits>::first_intersected_primitive(const Ray& query,
const SkipFunctor& skip) const
{
boost::optional<
std::optional<
typename AABB_tree<AABBTraits>::
template Intersection_and_primitive_id<Ray>::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;
}
}

View File

@ -17,7 +17,7 @@
#include <CGAL/AABB_tree/internal/AABB_node.h>
#include <boost/optional.hpp>
#include <optional>
namespace CGAL {
@ -69,7 +69,7 @@ class First_intersection_traits
public:
typedef
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
std::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::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<Query>::Type >
std::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::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<typename Primitive::Id>(primitive.id());
m_result = std::optional<typename Primitive::Id>(primitive.id());
m_is_found = true;
}
}
@ -221,12 +221,12 @@ public:
return m_traits.do_intersect_object()(query, node.bbox());
}
boost::optional<typename Primitive::Id> result() const { return m_result; }
std::optional<typename Primitive::Id> result() const { return m_result; }
bool is_intersection_found() const { return m_is_found; }
private:
bool m_is_found;
boost::optional<typename Primitive::Id> m_result;
std::optional<typename Primitive::Id> m_result;
const AABBTraits& m_traits;
};

View File

@ -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<Ray>::Type > r = tree.any_intersection(ray);
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > l = tree.any_intersection(line);
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > s = tree.any_intersection(segment);
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > r = tree.any_intersection(ray);
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > l = tree.any_intersection(line);
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > s = tree.any_intersection(segment);
CGAL_USE(r);
CGAL_USE(l);
CGAL_USE(s);
// any_intersected_primitive
boost::optional<typename Primitive::Id> optional_primitive;
std::optional<typename Primitive::Id> 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<Ray>::Type > > intersections_r;
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > > intersections_l;
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > > intersections_s;
std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > > intersections_r;
std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > > intersections_l;
std::list< std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::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<Object_and_primitive_id> Intersection_result;
typedef std::optional<Object_and_primitive_id> 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<Query>::Type >
std::optional< typename Traits::template Intersection_and_primitive_id<Query>::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<typename Primitive::Id> Any_primitive;
typedef std::optional<typename Primitive::Id> 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<Query>::Type >
std::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Query>::Type >
intersection = tree.any_intersection(query);
// Check: verify we do get the result by naive method

View File

@ -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<Obj_type> o = tree.any_intersection(*b);
std::optional<Obj_type> o = tree.any_intersection(*b);
if(o)
++counter;
}

View File

@ -65,7 +65,7 @@ int test()
return EXIT_FAILURE;
}
boost::optional<Object_and_primitive_id> any;
std::optional<Object_and_primitive_id> any;
any = tree.any_intersection(pq);
if(!any)
{

View File

@ -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<Ray>::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<Ray>::Type
> mini = boost::none;
> mini = std::nullopt;
for(IntersectionVector::iterator it2 = all_intersections.begin(); it2 != all_intersections.end(); ++it2) {
if(Point* point = boost::get<Point>(&(it2->first))) {
if(Point* point = std::get_if<Point>(&(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<Ray>());
std::vector< boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type > > primitives1, primitives2;
std::vector< std::optional<Tree::Intersection_and_primitive_id<Ray>::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;

View File

@ -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$.

View File

@ -27,7 +27,7 @@
#include <type_traits>
#include <CGAL/iterator.h>
#include <CGAL/assertions.h>
#include <boost/optional.hpp>
#include <optional>
#include <CGAL/basic.h>
#include <CGAL/config.h>
@ -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<InnerFunctor> _inner;
::boost::optional<OuterFunctor> _outer;
::std::optional<InnerFunctor> _inner;
::std::optional<OuterFunctor> _outer;
};
template<typename InnerFunctor,typename OuterFunctor>

View File

@ -174,7 +174,7 @@ public:
long old_precision = get_precision( BFI() );
set_precision( BFI(), 53 );
std::pair<double, double> interval = CGAL::to_interval( convert_to_bfi( (*this)));
this->ptr()->interval_option = boost::optional< std::pair<double, double> >(interval);
this->ptr()->interval_option = std::optional< std::pair<double, double> >(interval);
set_precision( BFI(), old_precision );
return *(this->ptr()->interval_option);
}

View File

@ -86,10 +86,10 @@ private:
CGAL::Polynomial_traits_d<Poly>::template Rebind<BFI,1>
::Other::Type BFI_polynomial;
mutable boost::optional
mutable std::optional
< BFI_polynomial > f_bfi_;
mutable boost::optional<BFI> low_bfi_, f_low_bfi_,
mutable std::optional<BFI> 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<Integer, Integer> 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;
}
}
};

View File

@ -23,7 +23,7 @@
#include <CGAL/basic.h>
#include <CGAL/Polynomial_type_generator.h>
#include <CGAL/Polynomial_traits_d.h>
#include <boost/optional.hpp>
#include <optional>
namespace CGAL {
@ -56,7 +56,7 @@ private:
typedef Algebraic_real_rep <Coefficient,Rational> Self;
public:
typedef boost::optional< std::pair<double, double> > Interval_option;
typedef std::optional< std::pair<double, double> > Interval_option;
mutable Poly polynomial_; //!< square free polynomial
mutable Rational low_; //!< lower endpoint of interval

View File

@ -31,7 +31,7 @@
#include <CGAL/Random.h>
#include <CGAL/tss.h>
#include <boost/optional.hpp>
#include <optional>
/*
* AUXILIARY CLASSES AND FUNCTIONS

View File

@ -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<Status_line_1> stack;
std::optional<Status_line_1> 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<std::vector<Event_coordinate_1> >
mutable std::optional<std::vector<Event_coordinate_1> >
event_coordinates;
//! The algebraic kernel to use
Algebraic_kernel_with_analysis_2* _m_kernel;
//! The polynomial defining the curve
boost::optional<Polynomial_2> f;
std::optional<Polynomial_2> 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<Polynomial_2> f_primitive;
mutable std::optional<Polynomial_2> f_primitive;
//! the polynomial containing all roots of the resultant of the primitive
//! part of f and its y-derivative
mutable boost::optional<Polynomial_1>
mutable std::optional<Polynomial_1>
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<Polynomial_1>
mutable std::optional<Polynomial_1>
resultant_of_primitive_and_derivative_x;
//! The Sturm-Habicht polynomials of f
mutable boost::optional<std::vector<Polynomial_2> >
mutable std::optional<std::vector<Polynomial_2> >
sturm_habicht_of_primitive;
//! The content of f
mutable boost::optional<Polynomial_1> content;
mutable std::optional<Polynomial_1> content;
//! The non-working shear factors, as far as known
mutable std::set<Integer> bad_shears;
@ -256,10 +256,10 @@ private:
mutable std::map<Integer,Handle> sheared_curves;
//! Has the curve vertical line components
mutable boost::optional<bool> has_vertical_component;
mutable std::optional<bool> has_vertical_component;
//! The intermediate values
mutable boost::optional<std::vector<boost::optional<Bound> > >
mutable std::optional<std::vector<std::optional<Bound> > >
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<std::vector<CGAL::Object> >
mutable std::optional<std::vector<CGAL::Object> >
horizontal_asymptotes_left, horizontal_asymptotes_right;
//! friends
@ -546,7 +546,7 @@ private:
if(! this->ptr()->intermediate_values) {
this->ptr()->intermediate_values
= std::vector<boost::optional<Bound> >
= std::vector<std::optional<Bound> >
(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>
(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<boost::optional<Bound> >& intermediate_values() const
std::vector<std::optional<Bound> >& 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<size_type>(content_roots.size()));
this->ptr()->intermediate_values
= std::vector<boost::optional<Bound> >
= std::vector<std::optional<Bound> >
(event_coordinate_vector.size()+1);
this->ptr()->event_coordinates = event_coordinate_vector;
@ -2110,7 +2110,7 @@ public:
compute_horizontal_asymptotes();
}
std::vector<Asymptote_y>& asym_info
= this->ptr()->horizontal_asymptotes_left.get();
= this->ptr()->horizontal_asymptotes_left.value();
CGAL_precondition(arcno>=0 &&
arcno<static_cast<size_type>(asym_info.size()));
return asym_info[arcno];
@ -2120,7 +2120,7 @@ public:
compute_horizontal_asymptotes();
}
std::vector<Asymptote_y>& asym_info
= this->ptr()->horizontal_asymptotes_right.get();
= this->ptr()->horizontal_asymptotes_right.value();
CGAL_precondition(arcno>=0 &&
arcno<static_cast<size_type>(asym_info.size()));
return asym_info[arcno];

View File

@ -22,7 +22,7 @@
#include <vector>
#include <algorithm>
#include <boost/optional.hpp>
#include <optional>
#include <CGAL/Handle_with_policy.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>
@ -136,9 +136,9 @@ public:
typedef std::vector<Slice_element> Slice_info;
typedef boost::optional<Slice_info> Lazy_slice_info;
typedef std::optional<Slice_info> Lazy_slice_info;
typedef boost::optional<Bound> Lazy_bound;
typedef std::optional<Bound> Lazy_bound;
typedef CGAL::internal::Event_indices<size_type> Event_indices;
@ -151,11 +151,11 @@ public:
typedef std::vector<std::vector<Intersection_info> >
Intersection_info_container;
typedef boost::optional<Intersection_info_container>
typedef std::optional<Intersection_info_container>
Lazy_intersection_info_container;
// For lazy evaluation of Status_line_CPA_1s.
typedef boost::optional<Status_line_CPA_1> Lazy_status_line_CPA_1;
typedef std::optional<Status_line_CPA_1> Lazy_status_line_CPA_1;
//! @}
@ -191,31 +191,31 @@ private:
Polynomial_2 g;
mutable boost::optional<std::vector<Polynomial_2> > subresultants;
mutable std::optional<std::vector<Polynomial_2> > subresultants;
mutable boost::optional<std::vector<Polynomial_1> >
mutable std::optional<std::vector<Polynomial_1> >
principal_subresultants;
mutable boost::optional<std::vector<Polynomial_1> >
mutable std::optional<std::vector<Polynomial_1> >
coprincipal_subresultants;
mutable boost::optional<Polynomial_1> resultant;
mutable std::optional<Polynomial_1> resultant;
mutable boost::optional<std::vector<Algebraic_real_1> > resultant_roots;
mutable boost::optional<std::vector<Algebraic_real_1> >
mutable std::optional<std::vector<Algebraic_real_1> > resultant_roots;
mutable std::optional<std::vector<Algebraic_real_1> >
event_x_coordinates;
mutable boost::optional<std::vector<size_type> >
mutable std::optional<std::vector<size_type> >
multiplicities_of_resultant_roots;
mutable boost::optional<std::vector<Bound> > stripe_values;
mutable std::optional<std::vector<Bound> > stripe_values;
mutable std::vector< Lazy_status_line_CPA_1 > event_slices;
mutable boost::optional<std::vector< Lazy_bound > > intermediate_values;
mutable std::optional<std::vector< Lazy_bound > > 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<std::vector<Event_indices> > event_indices;
mutable std::optional<std::vector<Event_indices> > 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<Algebraic_real_1>& 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<Algebraic_real_1>& 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>& 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 <tt>i</tt>th event value
*
* Returns a Event_indices <tt>(fg,ffy,ggy)</tt> such that
* Returns an `Event_indices` <tt>(fg,ffy,ggy)</tt> such that
* the <tt>i</tt>th event root is the <tt>fg</tt>th root of the
* resultant of \c f and \c g, the <tt>ffy</tt>th root of the
* discriminant of \c f, and the <tt>ggy</tt>th 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<Lazy_status_line_CPA_1>& 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 <tt>i</tt>th 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<AlgebraicKernelWithAnalysis_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<Polynomial_2>
(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<int>(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<static_cast<size_type>
(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<Algebraic_real_1>& events
= this->ptr()->event_x_coordinates.get();
= this->ptr()->event_x_coordinates.value();
typename std::vector<CGAL::internal::Three_valued>::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<Event_indices>();
std::vector<Event_indices>& event_indices
= this->ptr()->event_indices.get();
= this->ptr()->event_indices.value();
for(size_type i=0;i<static_cast<size_type>(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<Lazy_bound>();
this->ptr()->intermediate_slices=std::vector<Lazy_status_line_CPA_1>();
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)<CGAL::degree(g,1)) {
#if CGAL_ACK_USE_BEZOUT_MATRIX_FOR_SUBRESULTANTS
CGAL::internal::bezout_polynomial_subresultants
(g,f,std::back_inserter(this->ptr()->subresultants.get()));
(g,f,std::back_inserter(this->ptr()->subresultants.value()));
#else
typename CGAL::Polynomial_traits_d<Polynomial_2>
::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_2>
::Polynomial_subresultants()
(f,g,std::back_inserter(this->ptr()->subresultants.get()));
(f,g,std::back_inserter(this->ptr()->subresultants.value()));
#endif
}
std::vector<Polynomial_2>& subresultants
= this->ptr()->subresultants.get();
= this->ptr()->subresultants.value();
size_type n = static_cast<size_type>(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]);
}
}

View File

@ -127,7 +127,7 @@ public:
//Arc_pair _m_num_arcs;
//! sequence of arcs crossing this status line (valid only event lines)
mutable boost::optional<Arc_container> _m_arcs;
mutable std::optional<Arc_container> _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<boost::optional< Algebraic_real_2 > >_m_xy_coords;
mutable std::vector<std::optional< Algebraic_real_2 > >_m_xy_coords;
// stores the isolator instance
mutable boost::optional<Bitstream_descartes> isolator;
mutable std::optional<Bitstream_descartes> isolator;
// befriending the handle
friend class Status_line_CA_1<Curve_analysis_2, Self>;
@ -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

View File

@ -75,7 +75,7 @@ public:
// represents x-coordinate of event of rational value over interval
// computed only by demand
mutable boost::optional<Algebraic_real_1> _m_x;
mutable std::optional<Algebraic_real_1> _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

View File

@ -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<double,Bbox_2> > _m_bbox_2_pair;
mutable std::optional< std::pair<double,Bbox_2> > _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.
*/

View File

@ -80,7 +80,7 @@ use binary search.
`Alpha_shape_2::number_of_solid_components()` performs a graph traversal and takes time
linear in the number of faces of the underlying triangulation.
`Alpha_shape_2::find_optimal_alpha()` uses binary search and takes time
\f$ O(n \log n)\f$, where \f$ n\f$ is the number of points.
\cgalBigO{n \log n}, where \f$ n\f$ is the number of points.
*/
template< typename Dt, typename ExactAlphaComparisonTag >

View File

@ -167,7 +167,7 @@ class Lazy_alpha_nt_2
//members
//the members can be updated when calling method exact()
mutable boost::optional<NT_exact> exact_;
mutable std::optional<NT_exact> 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_);
}

View File

@ -77,7 +77,7 @@ use binary search.
`Alpha_shape_3::number_of_solid_components()` performs a graph traversal and takes time
linear in the number of cells of the underlying triangulation.
`Alpha_shape_3::find_optimal_alpha()` uses binary search and takes time
\f$ O(n \log n)\f$, where \f$ n\f$ is the number of points.
\cgalBigO{n \log n}, where \f$ n\f$ is the number of points.
*/
template< typename Dt, typename ExactAlphaComparisonTag >

View File

@ -22,7 +22,7 @@
#include <memory>
#include <boost/type_traits.hpp>
#include <boost/optional.hpp>
#include <optional>
#include <iostream>
@ -158,7 +158,7 @@ class Lazy_alpha_nt_3{
//members
//the members can be updated when calling method exact()
mutable boost::optional<NT_exact> exact_;
mutable std::optional<NT_exact> 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_);
}

View File

@ -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;
/// @}

View File

@ -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<Vb,Fb>`
\sa `CGAL::Apollonius_graph_hierarchy_vertex_base_2<Gt>`
*/
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

View File

@ -39,6 +39,7 @@ if(GMP_FOUND)
create_single_source_cgal_program("Arithmetic_kernel.cpp")
create_single_source_cgal_program("LEDA_arithmetic_kernel.cpp")
create_single_source_cgal_program("CORE_arithmetic_kernel.cpp")
create_single_source_cgal_program("GMPXX_arithmetic_kernel.cpp")
create_single_source_cgal_program("Get_arithmetic_kernel.cpp")
else()

View File

@ -18,7 +18,7 @@ char * Option_parser::s_strategy_opts[] = {
};
template <class MyId>
void Option_parser::my_validate(boost::any & v,
void Option_parser::my_validate(std::any & v,
const std::vector<std::string> & values)
{
typedef std::vector<MyId> 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<Vector_id>(v);
Vector_id vec = std::any_cast<Vector_id>(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<std::string> & values,
void validate(std::any & v, const std::vector<std::string> & values,
Option_parser::Vector_type_id * target_type, int)
{
Option_parser::my_validate<Option_parser::Type_id>(v, values);
}
/* Overload the 'validate' function for the user-defined class */
void validate(boost::any & v, const std::vector<std::string> & values,
void validate(std::any & v, const std::vector<std::string> & values,
Option_parser::Vector_strategy_id * target_type, int)
{
Option_parser::my_validate<Option_parser::Strategy_id>(v, values);

View File

@ -124,7 +124,7 @@ public:
unsigned int get_height() const { return m_win_height; }
template <class MyId>
static void my_validate(boost::any & v,
static void my_validate(std::any & v,
const std::vector<std::string> & values);
protected:

View File

@ -12,7 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// SPDX-License-Identifier: GPL-3.0+
// SPDX-License-Identifier: GPL-3.0-or-later
//
// Author(s): Saurabh Singh <ssingh@cs.iitr.ac.in>
// Ahmed Essam <theartful.ae@gmail.com>
@ -135,7 +135,7 @@ static inline bool hasValidChars(const std::string& expression, int dimension)
}
template <typename Polynomial_d>
boost::optional<Polynomial_d>
std::optional<Polynomial_d>
AlgebraicCurveParser<Polynomial_d>::operator()(const std::string& expression)
{
using Traits = CGAL::Polynomial_traits_d<Polynomial_d>;

View File

@ -12,7 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// SPDX-License-Identifier: GPL-3.0+
// SPDX-License-Identifier: GPL-3.0-or-later
//
// Author(s): Saurabh Singh <ssingh@cs.iitr.ac.in>
// Ahmed Essam <theartful.ae@gmail.com>
@ -22,12 +22,12 @@
#include <vector>
#include <string>
#include <boost/optional.hpp>
#include <optional>
template <typename Polynomial_d>
struct AlgebraicCurveParser
{
boost::optional<Polynomial_d> operator()(const std::string& expression);
std::optional<Polynomial_d> operator()(const std::string& expression);
};
#endif //ARRANGEMENT_ON_SURFACE_2_DEMO_ALGEBRAICCURVEPARSERNEW_H

View File

@ -961,15 +961,16 @@ findOtherInterestingPoints<demo_types::DemoTypes::Alg_seg_arr>
const CGAL::Bbox_2& allowable_range) {
using Traits = demo_types::DemoTypes::Alg_seg_traits;
CGAL::Bbox_2 bb = {};
std::vector<CGAL::Object> intersections;
typedef std::pair<typename Traits::Point_2, unsigned int> Pt_m;
std::vector<Pt_m> 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<Pt_m>(std::back_inserter(intersections)));
}
}
for (auto it = intersections.begin(); it != intersections.end(); it++) {
std::pair<typename Traits::Point_2, unsigned int> 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();

View File

@ -227,7 +227,7 @@ void EnvelopeCallback< Arr_>::updateEnvelope( bool lower )
{
if (!e->is_empty())
{
boost::optional<Point_2> leftPoint, rightPoint;
std::optional<Point_2> leftPoint, rightPoint;
if (e->left())
leftPoint = e->left()->point();

View File

@ -123,7 +123,7 @@ void GraphicsViewCurveInput<Arr_>::generate(CGAL::Object o) {
template <typename Arr_>
void GraphicsViewCurveInput<Arr_>::
curveInputDoneEvent(const std::vector<Point_2>& clickedPoints, CurveType type) {
boost::optional<Curve_2> cv =
std::optional<Curve_2> cv =
this->curveGenerator.generate(clickedPoints, type);
if (cv) {
Insert_curve<Arrangement>{}(this->arrangement, *cv);
@ -135,9 +135,9 @@ curveInputDoneEvent(const std::vector<Point_2>& clickedPoints, CurveType type) {
template <typename ArrTraits_>
auto CurveGeneratorBase<ArrTraits_>::
generate(const std::vector<Point_2>& clickedPoints, CurveType type)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
boost::optional<Curve_2> res;
std::optional<Curve_2> res;
switch (type) {
case CurveType::Segment:
res = generateSegment(clickedPoints);
@ -180,7 +180,7 @@ void CurveGeneratorBase<ArrTraits_>::setTraits(const ArrTraits* traits_)
template <typename Kernel_>
auto CurveGenerator<CGAL::Arr_segment_traits_2<Kernel_>>::
generateSegment(const std::vector<Point_2>& clickedPoints)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
Curve_2 res{clickedPoints[0], clickedPoints[1]};
return res;
@ -190,7 +190,7 @@ generateSegment(const std::vector<Point_2>& clickedPoints)
template <typename SegmentTraits>
auto CurveGenerator<CGAL::Arr_polyline_traits_2<SegmentTraits>>::
generatePolyline(const std::vector<Point_2>& clickedPoints)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
if (clickedPoints.size() < 2) return {};
@ -202,7 +202,7 @@ auto CurveGenerator<CGAL::Arr_polyline_traits_2<SegmentTraits>>::
// Curve Generator Linear Traits
template <typename Kernel_>
auto CurveGenerator<CGAL::Arr_linear_traits_2<Kernel_>>::
generateSegment(const std::vector<Point_2>& points) -> boost::optional<Curve_2>
generateSegment(const std::vector<Point_2>& points) -> std::optional<Curve_2>
{
Curve_2 res = Curve_2(Segment_2(points[0], points[1]));
return res;
@ -211,7 +211,7 @@ generateSegment(const std::vector<Point_2>& points) -> boost::optional<Curve_2>
//
template <typename Kernel_>
auto CurveGenerator<CGAL::Arr_linear_traits_2<Kernel_>>::
generateRay(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
generateRay(const std::vector<Point_2>& points) -> std::optional<Curve_2> {
Curve_2 res = Curve_2(Ray_2(points[0], points[1]));
return res;
}
@ -219,7 +219,7 @@ generateRay(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
//
template <typename Kernel_>
auto CurveGenerator<CGAL::Arr_linear_traits_2<Kernel_>>::
generateLine(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
generateLine(const std::vector<Point_2>& points) -> std::optional<Curve_2> {
Curve_2 res = Curve_2(Line_2(points[0], points[1]));
return res;
}
@ -228,7 +228,7 @@ generateLine(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
generateSegment(const std::vector<Point_2>& points)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
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<Point_2>& points)
//
template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
generateCircle(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
generateCircle(const std::vector<Point_2>& points) -> std::optional<Curve_2> {
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<Point_2>& points) -> boost::optional<Curve_2> {
template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
generateEllipse(const std::vector<Point_2>& points)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
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<Point_2>& points)
template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
generateThreePointCircularArc(const std::vector<Point_2>& points)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
auto& qp1 = points[0];
auto& qp2 = points[1];
@ -305,7 +305,7 @@ generateThreePointCircularArc(const std::vector<Point_2>& points)
template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
generateFivePointConicArc(const std::vector<Point_2>& points)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
auto& qp0 = points[0];
auto& qp1 = points[1];
@ -333,7 +333,7 @@ generateFivePointConicArc(const std::vector<Point_2>& points)
// CurveGenerator Algebraic Traits
template <typename Coefficient_>
auto CurveGenerator<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
generateLine(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
generateLine(const std::vector<Point_2>& points) -> std::optional<Curve_2> {
RationalTraits ratTraits;
Rational dx = points[1].x() - points[0].x();
@ -369,7 +369,7 @@ generateLine(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
//
template <typename Coefficient_>
auto CurveGenerator<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
generateCircle(const std::vector<Point_2>& points) -> boost::optional<Curve_2> {
generateCircle(const std::vector<Point_2>& points) -> std::optional<Curve_2> {
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<Point_2>& points) -> boost::optional<Curve_2> {
template <typename Coefficient_>
auto CurveGenerator<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
generateEllipse(const std::vector<Point_2>& points)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
auto rx =
(points[0].x() - points[1].x()) * (points[0].x() - points[1].x()) / 4.;
@ -394,7 +394,7 @@ generateEllipse(const std::vector<Point_2>& points)
template <typename Coefficient_>
auto CurveGenerator<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
generateEllipse_(const Point_2& center, Rational rxRat, Rational ryRat)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
RationalTraits ratTraits;
@ -428,7 +428,7 @@ template <typename RatKernel, typename AlgKernel, typename NtTraits,
auto CurveGenerator
<Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits, BoundingTraits>>::
generateBezier(const std::vector<Point_2>& clickedPoints)
-> boost::optional<Curve_2>
-> std::optional<Curve_2>
{
if (clickedPoints.size() < 2) return {};
return Curve_2{clickedPoints.begin(), clickedPoints.end()};

View File

@ -42,34 +42,34 @@ public:
void setTraits(const ArrTraits* traits_);
boost::optional<Curve_2>
std::optional<Curve_2>
generate(const std::vector<Point_2>& clickedPoints, CurveType type);
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateSegment(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateRay(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateLine(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generatePolyline(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateCircle(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateEllipse(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateThreePointCircularArc(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateFivePointConicArc(const std::vector<Point_2>&) { return {}; }
virtual boost::optional<Curve_2>
virtual std::optional<Curve_2>
generateBezier(const std::vector<Point_2>&) { return {}; }
const ArrTraits* traits;
@ -91,7 +91,7 @@ struct CurveGenerator<CGAL::Arr_segment_traits_2<Kernel_>> :
using Super = CurveGeneratorBase<ArrTraits>;
using Point_2 = typename Super::Point_2;
boost::optional<Curve_2>
std::optional<Curve_2>
generateSegment(const std::vector<Point_2>&) override;
};
@ -105,7 +105,7 @@ struct CurveGenerator<CGAL::Arr_polyline_traits_2<SegmentTraits>> :
using Super = CurveGeneratorBase<ArrTraits>;
using Point_2 = typename Super::Point_2;
boost::optional<Curve_2>
std::optional<Curve_2>
generatePolyline(const std::vector<Point_2>&) override;
};
@ -125,18 +125,18 @@ struct CurveGenerator<Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>> :
using Super = CurveGeneratorBase<ArrTraits>;
using Point_2 = typename Super::Point_2;
boost::optional<Curve_2>
std::optional<Curve_2>
generateSegment(const std::vector<Point_2>&) override;
boost::optional<Curve_2> generateCircle(const std::vector<Point_2>&) override;
std::optional<Curve_2> generateCircle(const std::vector<Point_2>&) override;
boost::optional<Curve_2>
std::optional<Curve_2>
generateEllipse(const std::vector<Point_2>&) override;
boost::optional<Curve_2>
std::optional<Curve_2>
generateThreePointCircularArc(const std::vector<Point_2>&) override;
boost::optional<Curve_2>
std::optional<Curve_2>
generateFivePointConicArc(const std::vector<Point_2>&) override;
};
@ -154,10 +154,10 @@ struct CurveGenerator<CGAL::Arr_linear_traits_2<Kernel_>> :
using Super = CurveGeneratorBase<ArrTraits>;
using Point_2 = typename Super::Point_2;
boost::optional<Curve_2>
std::optional<Curve_2>
generateSegment(const std::vector<Point_2>&) override;
boost::optional<Curve_2> generateRay(const std::vector<Point_2>&) override;
boost::optional<Curve_2> generateLine(const std::vector<Point_2>&) override;
std::optional<Curve_2> generateRay(const std::vector<Point_2>&) override;
std::optional<Curve_2> generateLine(const std::vector<Point_2>&) override;
};
template <typename Coefficient_>
@ -176,13 +176,13 @@ struct CurveGenerator<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>> :
using Super = CurveGeneratorBase<ArrTraits>;
using Point_2 = typename Super::Point_2;
boost::optional<Curve_2> generateLine(const std::vector<Point_2>&) override;
boost::optional<Curve_2> generateCircle(const std::vector<Point_2>&) override;
boost::optional<Curve_2>
std::optional<Curve_2> generateLine(const std::vector<Point_2>&) override;
std::optional<Curve_2> generateCircle(const std::vector<Point_2>&) override;
std::optional<Curve_2>
generateEllipse(const std::vector<Point_2>&) override;
private:
boost::optional<Curve_2> generateEllipse_(const Point_2&, Rational, Rational);
std::optional<Curve_2> 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<Curve_2> generateBezier(const std::vector<Point_2>&) override;
std::optional<Curve_2> generateBezier(const std::vector<Point_2>&) override;
};
template <typename ArrTraits>

View File

@ -16,7 +16,7 @@
#include "ArrangementTypesUtils.h"
#include "PointSnapper.h"
#include <boost/optional.hpp>
#include <optional>
template <typename Arr_>
class PointSnapper : public PointSnapperBase
@ -26,7 +26,7 @@ class PointSnapper : public PointSnapperBase
public:
PointSnapper(QGraphicsScene*, GridGraphicsItem*, Arrangement*);
boost::optional<Point_2> snapToArrangement(const QPointF& qpt) override;
std::optional<Point_2> snapToArrangement(const QPointF& qpt) override;
private:
Arrangement* arr;
@ -170,7 +170,7 @@ PointSnapper<Arr_>::PointSnapper(
}
template <typename Arrangement>
inline boost::optional<PointSnapperBase::Point_2> snapToArrangement(
inline std::optional<PointSnapperBase::Point_2> 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 <typename Arrangement>
boost::optional<Point_2>
std::optional<Point_2>
operator()(const QPointF& qpt, const QTransform&, Arrangement*)
{
return Point_2{qpt.x(), qpt.y()};
@ -226,7 +226,7 @@ struct SnapToArrangement<CGAL::Arr_linear_traits_2<Kernel>>
{
using Point_2 = PointSnapperBase::Point_2;
template <typename Arrangement>
boost::optional<Point_2> operator()(
std::optional<Point_2> operator()(
const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr)
{
return snapToArrangement(qpt, worldTransform, arr);
@ -237,7 +237,7 @@ struct SnapToArrangement<CGAL::Arr_segment_traits_2<Kernel>>
{
using Point_2 = PointSnapperBase::Point_2;
template <typename Arrangement>
boost::optional<Point_2> operator()(
std::optional<Point_2> operator()(
const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr)
{
return snapToArrangement(qpt, worldTransform, arr);
@ -248,7 +248,7 @@ struct SnapToArrangement<CGAL::Arr_polyline_traits_2<Kernel>>
{
using Point_2 = PointSnapperBase::Point_2;
template <typename Arrangement>
boost::optional<Point_2> operator()(
std::optional<Point_2> operator()(
const QPointF& qpt, const QTransform& worldTransform, Arrangement* arr)
{
return snapToArrangement(qpt, worldTransform, arr);
@ -257,7 +257,7 @@ struct SnapToArrangement<CGAL::Arr_polyline_traits_2<Kernel>>
template <typename Arr_>
auto PointSnapper<Arr_>::snapToArrangement(const QPointF& qpt)
-> boost::optional<Point_2>
-> std::optional<Point_2>
{
using Traits = typename Arrangement::Geometry_traits_2;
auto view = getView();

View File

@ -50,7 +50,7 @@ public:
protected:
PointSnapperBase(QGraphicsScene* scene, GridGraphicsItem* grid);
Point_2 snapToGrid(const QPointF& qpt);
virtual boost::optional<Point_2> snapToArrangement(const QPointF& qpt) = 0;
virtual std::optional<Point_2> snapToArrangement(const QPointF& qpt) = 0;
GridGraphicsItem* gridGraphicsItem;
bool snapToGridEnabled;

View File

@ -11,6 +11,8 @@
#include "IntersectCurves.h"
#include "ArrangementTypes.h"
#include <boost/function_output_iterator.hpp>
template <typename Traits_>
Intersect_curves<Traits_>::Intersect_curves(const Traits* traits) :
@ -18,12 +20,26 @@ Intersect_curves<Traits_>::Intersect_curves(const Traits* traits) :
{
}
struct Object_putter
{
std::reference_wrapper<std::vector<CGAL::Object>> v;
Object_putter(std::vector<CGAL::Object>& v_)
: v(std::ref(v_))
{}
template <class T>
void operator()(const T& t)
{
v.get().push_back(make_object(t));
}
};
template <typename Traits_>
void Intersect_curves<Traits_>::operator()(
const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2,
std::vector<CGAL::Object>& 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)

View File

@ -391,8 +391,8 @@ Construct_x_monotone_subcurve_2<ArrTraits>::Construct_x_monotone_subcurve_2(
//
template <typename ArrTraits>
auto Construct_x_monotone_subcurve_2<ArrTraits>::operator()(
const X_monotone_curve_2& curve, const boost::optional<Point_2>& pLeft,
const boost::optional<Point_2>& pRight) -> X_monotone_curve_2
const X_monotone_curve_2& curve, const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& pRight) -> X_monotone_curve_2
{
Point_2 pMin, pMax;
bool unbounded_min = false;
@ -442,8 +442,8 @@ template <typename RatKernel, typename AlgKernel, typename NtTraits>
auto Construct_x_monotone_subcurve_2
<CGAL::Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>>::
operator()(const X_monotone_curve_2& curve,
const boost::optional<Point_2>& pLeft,
const boost::optional<Point_2>& pRight) -> X_monotone_curve_2
const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& pRight) -> X_monotone_curve_2
{
// TODO: handle when pLeft or pRight is null
@ -486,8 +486,8 @@ template <typename RatKernel, typename AlgKernel, typename NtTraits,
auto Construct_x_monotone_subcurve_2<CGAL::Arr_Bezier_curve_traits_2<
RatKernel, AlgKernel, NtTraits, BoundingTraits>>::
operator()(
const X_monotone_curve_2& curve, const boost::optional<Point_2>& pLeft,
const boost::optional<Point_2>& pRight) -> X_monotone_curve_2
const X_monotone_curve_2& curve, const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& 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 <typename AlgebraicKernel_d_1>
auto Construct_x_monotone_subcurve_2<
CGAL::Arr_rational_function_traits_2<AlgebraicKernel_d_1>>::
operator()(
const X_monotone_curve_2& curve, const boost::optional<Point_2>& pLeft,
const boost::optional<Point_2>& pRight) -> X_monotone_curve_2
const X_monotone_curve_2& curve, const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& 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<CGAL::Object> oi(o);
std::vector<IntersectionResult> pairs;
this->intersectCurves(curve, verticalLine, oi);
this->intersectCurves(curve, verticalLine,
CGAL::dispatch_or_drop_output<IntersectionResult>(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<CGAL::Object> oi(o);
std::vector<IntersectionResult> pairs;
this->intersectCurves(curve, verticalLine, oi);
this->intersectCurves(curve, verticalLine,
CGAL::dispatch_or_drop_output<IntersectionResult>(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<CGAL::Object> oi(o);
this->intersect_curves(curve, vertical_line, oi);
std::vector<IntersectionResult> pairs;
this->intersect_curves(curve, vertical_line,
CGAL::dispatch_or_drop_output<IntersectionResult>(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<CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::
operator()(const X_monotone_curve_2& curve, const CoordinateType& x)
-> CoordinateType
{
CGAL::Object o;
CGAL::Oneset_iterator<CGAL::Object> oi(o);
Intersect_2 intersect = traits->intersect_2_object();
X_monotone_curve_2 c2 = this->makeVerticalLine(x);
intersect(curve, c2, oi);
std::pair<Point_2, Multiplicity> res;
if (CGAL::assign(res, o)) {
typedef std::pair<Point_2, Multiplicity> PtM;
std::vector<PtM> res;
intersect(curve, c2, CGAL::dispatch_or_drop_output<PtM>(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;
}

View File

@ -479,8 +479,8 @@ public:
* projection.
*/
X_monotone_curve_2 operator()(const X_monotone_curve_2& curve,
const boost::optional<Point_2>& pLeft,
const boost::optional<Point_2>& pRight);
const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& 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<Point_2>& pLeft,
const boost::optional<Point_2>& pRight );
const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& 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<Point_2>& pLeft,
const boost::optional<Point_2>& pRight);
const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& 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<Point_2>& pLeft,
const boost::optional<Point_2>& pRight);
const std::optional<Point_2>& pLeft,
const std::optional<Point_2>& pRight);
protected:
const Traits* traits;

View File

@ -1223,10 +1223,10 @@ halfedge \f$e_{\mathrm{pred}}\f$ directed toward \f$v\f$, such that
\f$c\f$ is located between the curves associated with
\f$e_{\mathrm{pred}}\f$ and the next halfedge in the clockwise order
in the circular list of halfedges around \f$v\f$; see
\cgalFigureRef{aos_fig-insert}. This search may take \f$O(d)\f$ time,
\cgalFigureRef{aos_fig-insert}. This search may take \cgalBigO{d} time,
where \f$d\f$ is the degree of the vertex \f$v\f$. \cgalFootnote{We
can store the handles to the halfedges incident to \f$v\f$ in an efficient
search structure to obtain \f$O(\log d)\f$ access time. However, as
search structure to obtain \cgalBigO{\log d} access time. However, as
\f$d\f$ is usually very small, this may lead to a waste of storage
space without a meaningful improvement in running time in practice.}
However, if the halfedge \f$e_{\mathrm{pred}}\f$ is known in advance,
@ -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 <em>value retrieval</em>
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<Face_const_handle>(&obj)) // located inside a face
if (f = std::get_if<Face_const_handle>(&obj)) // located inside a face
std::cout << "inside "
<< (((*f)->is_unbounded()) ? "the unbounded" : "a bounded")
<< " face.\n";
else if (e = boost::get<Halfedge_const_handle>(&obj)) // located on an edge
else if (e = std::get_if<Halfedge_const_handle>(&obj)) // located on an edge
std::cout << "on an edge: " << (*e)->curve() << std::endl;
else if (v = boost::get<Vertex_const_handle>(&obj)) // located on a vertex
else if (v = std::get_if<Vertex_const_handle>(&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.");
@ -1488,9 +1488,9 @@ keep up-to-date as this arrangement changes.
As mentioned above, the triangulation strategy is provided only for
educational purposes, and thus we do not elaborate on this strategy.
The data structure needed by the landmark and the trapezoidal map RIC
strategies can be constructed in \f$O(N \log N)\f$ time, where \f$N\f$
strategies can be constructed in \cgalBigO{N \log N} time, where \f$N\f$
is the overall number of edges in the arrangement, but the constant
hidden in the \f$O()\f$ notation for the trapezoidal map RIC strategy
hidden in the \cgalBigO{&nbsp;} notation for the trapezoidal map RIC strategy
is much larger. Thus, construction needed by the landmark algorithm is
in practice significantly faster than the construction needed by the
trapezoidal map RIC strategy. In addition, although both resulting
@ -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<Vertex_const_handle>(&obj)) // we hit a vertex
if (v = std::get_if<Vertex_const_handle>(&obj)) // we hit a vertex
std::cout << "hit " << (((*v)->is_isolated()) ? "an isolated" : "a")
<< " vertex: " << (*v)->point() << std::endl;
else if (e = boost::get<Halfedge_const_handle>(&obj)) // we hit an edge
else if (e = std::get_if<Halfedge_const_handle>(&obj)) // we hit an edge
std::cout << "hit an edge: " << (*e)->curve() << std::endl;
else if (f = boost::get<Face_const_handle>(&obj)) { // we hit nothing
else if (f = std::get_if<Face_const_handle>(&obj)) { // we hit nothing
CGAL_assertion((*f)->is_unbounded());
std::cout << "hit nothing.\n";
}
@ -1647,7 +1647,7 @@ Section \ref arr_ssecpl. The output pairs are sorted in increasing
\f$xy\f$-lexicographical order of the query point.
The batched point-location operation is carried out by sweeping the
arrangement. Thus, it takes \f$O((m+N)\log{(m+N)})\f$ time, where
arrangement. Thus, it takes \cgalBigO{(m+N)\log{(m+N)}} time, where
\f$N\f$ is the number of edges in the arrangement. Issuing separate
queries exploiting a point-location strategy with logarithmic query
time per query, such as the trapezoidal map RIC strategy (see Section
@ -2037,11 +2037,11 @@ so it must be construct from scratch.
In the first case, we sweep over the input curves, compute their
intersection points, and construct the \dcel that represents their
arrangement. This process is performed in \f$O\left((n + k)\log
n\right)\f$ time, where \f$k\f$ is the total number of intersection
arrangement. This process is performed in \cgalBigO{left((n + k)\log
n\right} time, where \f$k\f$ is the total number of intersection
points. The running time is asymptotically better than the time needed
for incremental insertion if the arrangement is relatively sparse
(when \f$k\f$ is \f$O(\frac{n^2}{\log n}\f$)), but it is recommended
(when \f$k\f$ is \cgalBigO{\frac{n^2}{\log n}}), but it is recommended
that this aggregate construction process be used even for dense
arrangements, since the plane-sweep algorithm performs fewer geometric
operations compared to the incremental insertion algorithms, and hence
@ -4346,7 +4346,7 @@ a point with respect to an \f$x\f$-monotone polyline, we use binary
search to locate the relevant segment that contains the point in its
\f$x\f$-range. Then, we compute the position of the point with respect
to this segment. Thus, operations on \f$x\f$-monotone polylines of
size \f$m\f$ typically take \f$O(\log m)\f$ time.
size \f$m\f$ typically take \cgalBigO{\log m} time.
You are free to choose the underlying segment traits class. Your
decision could be based, for example, on the number of expected

View File

@ -22,19 +22,7 @@ the output sequence.
`std::pair<Arrangement_2::Point_2, Arr_point_location_result<Arrangement_2>::%Type>`.
</UL>
\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<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template<typename Traits, typename Dcel,

View File

@ -10,7 +10,7 @@ of both types
`CGAL::Line_arc_2<CircularKernel>` or
`CGAL::Circular_arc_2<CircularKernel>`.
It uses the <A HREF="https://www.boost.org/doc/html/variant.html">boost::variant</A>.
It uses the <A HREF="https://www.boost.org/doc/html/variant.html">std::variant</A>.
\cgalModels `ArrangementTraits_2`

View File

@ -53,7 +53,6 @@ insertions of curves and not deletions of them.
\sa `ArrangementPointLocation_2`
\sa `ArrangementVerticalRayShoot_2`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template< typename Arrangement, typename Generator >

View File

@ -19,7 +19,6 @@ time-consuming process when applied to dense arrangements.
\sa `ArrangementPointLocation_2`
\sa `ArrangementVerticalRayShoot_2`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template< typename Arrangement >

View File

@ -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<Vertex_const_handle,Halfedge_const_handle,Face_const_handle>`, 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<Arrangement>`
*/
#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<Arrangement>`
\sa `CGAL::Arr_landmarks_point_location<Arrangement,Generator>`
\sa `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template <class Arrangement>
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<Arrangement::Vertex_const_handle, Arrangement::Halfedge_const_handle, Arrangement::Face_const_handle>`
* if `::CGAL_ARR_POINT_LOCATION_VERSION` == 2, which is the default, otherwise
* `CGAL::Object`.
* `std::variant<Arrangement::Vertex_const_handle, Arrangement::Halfedge_const_handle, Arrangement::Face_const_handle>`
*/
typedef unspecified_type Type;
}; /* end Arr_point_location_result */

View File

@ -12,9 +12,9 @@ Seidel \cgalCite{s-sfira-91} (see also [\cgalCite{bkos-cgaa-00} Chapter 6).
It subdivides each arrangement face to pseudo-trapezoidal cells, each
of constant complexity, and constructs and maintains a linear-size search
structure on top of these cells, such that each query can be answered
in \f$ O(\log n)\f$ time, where \f$ n\f$ is the complexity of the arrangement.
in \cgalBigO{\log n} time, where \f$ n\f$ is the complexity of the arrangement.
Constructing the search structures takes \f$ O(n \log n)\f$ expected time
Constructing the search structures takes \cgalBigO{n \log n} expected time
and may require a small number of rebuilds \cgalCite{hkh-iiplgtds-12}. Therefore
attaching a trapezoidal point-location object to an existing arrangement
may incur some overhead in running times. In addition, the point-location
@ -32,7 +32,6 @@ This strategy supports arbitrary subdivisions, including unbounded ones.
\sa `ArrangementPointLocation_2`
\sa `ArrangementVerticalRayShoot_2`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template< typename Arrangement >

View File

@ -21,7 +21,6 @@ namespace CGAL {
* \sa `ArrangementPointLocation_2`
* \sa `ArrangementVerticalRayShoot_2`
* \sa `CGAL::Arr_point_location_result<Arrangement>`
* \sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template <typename Arrangement_>

View File

@ -29,7 +29,6 @@ of issued queries is not large.
\sa `ArrangementPointLocation_2`
\sa `ArrangementVerticalRayShoot_2`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
template< typename Arrangement >

View File

@ -17,7 +17,7 @@ public:
/*! computes the intersections of `xc1` and `xc2` and writes them <I>in an
* ascending lexicographic \f$xy\f$-order</I> 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<ArrTraits::Point_2, ArrTraits::Multiplicity>` or
* `ArrTraits::X_monotone_curve_2`. An object of the former type represents an
* intersection point with its multiplicity (in case the multiplicity is

View File

@ -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.
*/

View File

@ -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<Arrangement>`
\cgalHasModel `CGAL::Arr_walk_along_line_point_location<Arrangement>`
\cgalHasModel `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
@ -30,7 +20,6 @@ the old style without any overhead, the macro
\sa `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
\sa `CGAL::Arr_landmarks_point_location<Arrangement,Generator>`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/

View File

@ -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<Arrangement>`
\cgalHasModel `CGAL::Arr_walk_along_line_point_location<Arrangement>`
\cgalHasModel `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
@ -38,7 +28,6 @@ is recommended. To enable the old style without any overhead, the macro
\sa `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
\sa `CGAL::Arr_landmarks_point_location<Arrangement,Generator>`
\sa `CGAL::Arr_point_location_result<Arrangement>`
\sa `CGAL_ARR_POINT_LOCATION_VERSION`
*/
class ArrangementVerticalRayShoot_2 {

View File

@ -239,9 +239,6 @@ implemented as peripheral classes or as free (global) functions.
- `CGAL::Arr_unb_planar_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_spherical_topology_traits_2<GeometryTraits_2,Dcel>`
\cgalCRPSection{Macros}
- \link CGAL_ARR_POINT_LOCATION_VERSION `CGAL_ARR_POINT_LOCATION_VERSION` \endlink
\cgalCRPSection{Functions}
- `CGAL::is_valid()`

View File

@ -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<Point, X_monotone_curve> Make_x_monotone_result;
typedef std::variant<Point, X_monotone_curve> Make_x_monotone_result;
int main() {
Traits traits;
@ -52,7 +52,7 @@ int main() {
// but not in this case).
std::vector<X_monotone_curve> segs;
for(size_t i = 0; i < pre_segs.size(); ++i) {
auto* curr_p = boost::get<X_monotone_curve>(&pre_segs[i]);
auto* curr_p = std::get_if<X_monotone_curve>(&pre_segs[i]);
assert(curr_p);
segs.push_back(*curr_p);
}

View File

@ -10,7 +10,7 @@
#include <CGAL/Arr_circular_line_arc_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_naive_point_location.h>
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/Random.h>
@ -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<Circular_k> 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;

View File

@ -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<Arr_with_hist::Halfedge_const_handle>(&obj);
auto* e = std::get_if<Arr_with_hist::Halfedge_const_handle>(&obj);
// Split the edge e to two edges e1 and e2;
auto e1 = arr.split_edge(arr.non_const_handle(*e), q);

View File

@ -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<Arrangement::Face_const_handle>(&obj);
auto* f = std::get_if<Arrangement::Face_const_handle>(&obj);
std::cout << "The query point (" << q << ") is located in: ";
print_face<Arrangement>(*f);

View File

@ -4,33 +4,6 @@
//-----------------------------------------------------------------------------
// Print the result of a point-location query.
//
#if CGAL_ARR_POINT_LOCATION_VERSION < 2
template <typename Arrangement_>
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 <typename Arrangement_>
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<Face_const_handle>(&obj))) // inside a face
if ((f = std::get_if<Face_const_handle>(&obj))) // inside a face
std::cout << "inside "
<< (((*f)->is_unbounded()) ? "the unbounded" : "a bounded")
<< " face." << std::endl;
else if ((e = boost::get<Halfedge_const_handle>(&obj))) // on an edge
else if ((e = std::get_if<Halfedge_const_handle>(&obj))) // on an edge
std::cout << "on an edge: " << (*e)->curve() << std::endl;
else if ((v = boost::get<Vertex_const_handle>(&obj))) // on a vertex
else if ((v = std::get_if<Vertex_const_handle>(&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<Vertex_const_handle>(&obj))) // hit a vertex
if ((v = std::get_if<Vertex_const_handle>(&obj))) // hit a vertex
std::cout << (((*v)->is_isolated()) ? "an isolated" : "a")
<< " vertex: " << (*v)->point() << std::endl;
else if ((e = boost::get<Halfedge_const_handle>(&obj)) ) // hit an edge
else if ((e = std::get_if<Halfedge_const_handle>(&obj)) ) // hit an edge
std::cout << "an edge: " << (*e)->curve() << std::endl;
else if ((f = boost::get<Face_const_handle>(&obj))) { // hit nothing
else if ((f = std::get_if<Face_const_handle>(&obj))) { // hit nothing
assert((*f)->is_unbounded());
std::cout << "nothing." << std::endl;
}

View File

@ -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<Polycurve_bezier_traits> Arrangement_2;
typedef boost::variant<Point, Bezier_x_monotone_curve> Make_x_monotone_result;
typedef std::variant<Point, Bezier_x_monotone_curve> 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<Make_x_monotone_result> obj_vector;
bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector));
auto* x_seg_p = boost::get<Bezier_x_monotone_curve>(&obj_vector[0]);
auto* x_seg_p = std::get_if<Bezier_x_monotone_curve>(&obj_vector[0]);
x_curves.push_back(*x_seg_p);
}

View File

@ -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<Face_const_handle>(&(it->second))) // inside a face
std::get_if<Face_const_handle>(&(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<Halfedge_const_handle>(&(it->second))) // on an edge
std::get_if<Halfedge_const_handle>(&(it->second))) // on an edge
std::cout << "on an edge: " << (*e)->curve() << std::endl;
else if (const Vertex_const_handle* v =
boost::get<Vertex_const_handle>(&(it->second))) // on a vertex
std::get_if<Vertex_const_handle>(&(it->second))) // on a vertex
std::cout << "on "
<< (((*v)->is_isolated()) ? "an isolated" : "a")
<< " vertex: " << (*v)->point() << std::endl;

View File

@ -8,9 +8,9 @@
#include "arr_linear.h"
typedef boost::variant<Vertex_const_handle, Halfedge_const_handle,
typedef std::variant<Vertex_const_handle, Halfedge_const_handle,
Face_const_handle> Cell_type;
typedef boost::optional<Cell_type> Vert_decomp_type;
typedef std::optional<Cell_type> Vert_decomp_type;
typedef std::pair<Vert_decomp_type, Vert_decomp_type> Vert_decomp_pair;
typedef std::pair<Vertex_const_handle, Vert_decomp_pair> Vert_decomp_entry;
typedef std::list<Vert_decomp_entry> Vert_decomp_list;
@ -41,10 +41,10 @@ int main() {
std::cout << " feature below: ";
if (! curr.first) std::cout << "EMPTY";
else {
auto* vh = boost::get<Vertex_const_handle>(&*(curr.first));;
auto* vh = std::get_if<Vertex_const_handle>(&*(curr.first));;
if (vh) std::cout << '(' << (*vh)->point() << ')';
else {
auto* hh = boost::get<Halfedge_const_handle>(&*(curr.first));
auto* hh = std::get_if<Halfedge_const_handle>(&*(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<Vertex_const_handle>(&*(curr.second));;
auto* vh = std::get_if<Vertex_const_handle>(&*(curr.second));;
if (vh) std::cout << '(' << (*vh)->point() << ")\n";
else {
auto* hh = boost::get<Halfedge_const_handle>(&*(curr.second));
auto* hh = std::get_if<Halfedge_const_handle>(&*(curr.second));
if (! (*hh)->is_fictitious())
std::cout << '[' << (*hh)->curve() << "]\n";
else std::cout << "NONE\n";

View File

@ -499,7 +499,7 @@ public:
template <typename OutputIterator>
OutputIterator operator() (const Curve_2& B, OutputIterator oi) const
{
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
typedef typename Bounding_traits::Vertical_tangency_point
Vertical_tangency_point;

View File

@ -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<DFace*>(&obj);
DFace** f_p = std::get_if<DFace*>(&obj);
if (f_p) return (Pl_result::make_result(p_arr->_const_handle_for(*f_p)));
DHalfedge** he_p = boost::get<DHalfedge*>(&obj);
DHalfedge** he_p = std::get_if<DHalfedge*>(&obj);
if (he_p) return (Pl_result::make_result(p_arr->_const_handle_for(*he_p)));
DVertex** v_p = boost::get<DVertex*>(&obj);
DVertex** v_p = std::get_if<DVertex*>(&obj);
if (v_p) return (Pl_result::make_result(p_arr->_const_handle_for(*v_p)));
// We should never reach here:

View File

@ -25,7 +25,7 @@
#include <CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h>
#include <boost/optional.hpp>
#include <optional>
#include <boost/none.hpp>
namespace CGAL {
@ -267,11 +267,11 @@ public:
template <typename OutputIterator> OutputIterator
x_monotone_segment(Curve_2 cv,
Point_2 p,
boost::optional<Point_2> start,
boost::optional<Point_2> end,
std::optional<Point_2> start,
std::optional<Point_2> end,
OutputIterator out) const
{
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
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<X_monotone_curve_2>(&(*it));
const auto* it_seg_p = std::get_if<X_monotone_curve_2>(&(*it));
while (it != arcs.end()) {
if ( on_arc(p, *it_seg_p) ) break;
it++;
it_seg_p = boost::get<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*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<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*it));
while (! on_arc(point_it, *it_seg_p)) {
CGAL_assertion(it != arcs.begin());
it--;
it_seg_p = boost::get<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*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<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*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<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*it));
while(! on_arc(point_it, *it_seg_p)) {
it++;
CGAL_assertion(it != arcs.end());
it_seg_p = boost::get<X_monotone_curve_2>(&(*it));
it_seg_p = std::get_if<X_monotone_curve_2>(&(*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<Point_2>(p),
boost::none,
std::optional<Point_2>(p),
std::nullopt,
out);
}
CGAL_assertion(site_of_p==MAX_ENDPOINT);
return x_monotone_segment(cv,
p,
boost::none,
boost::optional<Point_2>(p),
std::nullopt,
std::optional<Point_2>(p),
out);
}
@ -468,15 +468,15 @@ public:
return x_monotone_segment
(cv,
end_left,
boost::optional<Point_2>(end_left),
boost::optional<Point_2>(end_right),
std::optional<Point_2>(end_left),
std::optional<Point_2>(end_right),
out);
} else {
return x_monotone_segment
(cv,
end_right,
boost::optional<Point_2>(end_left),
boost::optional<Point_2>(end_right),
std::optional<Point_2>(end_left),
std::optional<Point_2>(end_right),
out);
}
}

View File

@ -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<Point_2, Result>,
* where Result is boost::optional<boost::variant<Vertex_const_handle,
* where Result is std::optional<std::variant<Vertex_const_handle,
* Halfedge_const_handle,
* Face_const_handle> >.
* It represents the arrangement feature containing the point.
@ -105,7 +105,7 @@ locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& 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.

View File

@ -14,7 +14,7 @@
#ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
#define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/license/Arrangement_on_surface_2.h>
@ -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<boost::variant<Vertex*, Halfedge*> >
std::optional<std::variant<Vertex*, Halfedge*> >
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<Vertex*, Halfedge*, Face*>
std::variant<Vertex*, Halfedge*, Face*>
locate_curve_end(const X_monotone_curve_2&,
Arr_curve_end,
Arr_parameter_space /* ps_x */,
Arr_parameter_space /* ps_y */)
{
typedef boost::variant<Vertex*, Halfedge*, Face*> Result;
typedef std::variant<Vertex*, Halfedge*, Face*> Result;
// This function should never be called:
CGAL_error();
Vertex* v(nullptr);

View File

@ -584,9 +584,6 @@ public:
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
typedef boost::variant<Point_2, X_monotone_curve_2>
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);
}
}

View File

@ -178,17 +178,17 @@ public:
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& arc, OutputIterator oi) const
{
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
std::vector<CGAL::Object> objs;
std::vector<Make_x_monotone_result> objs;
CircularKernel().make_x_monotone_2_object()(arc, std::back_inserter(objs));
for (const auto& obj : objs) {
if (const auto* p = CGAL::object_cast<Point_2>(&obj)) {
if (const auto* p = std::get_if<Point_2>(&obj)) {
*oi++ = Make_x_monotone_result(*p);
continue;
}
if (const auto* xcv = CGAL::object_cast<X_monotone_curve_2>(&obj)) {
if (const auto* xcv = std::get_if<X_monotone_curve_2>(&obj)) {
*oi++ = Make_x_monotone_result(*xcv);
continue;
}

View File

@ -35,7 +35,7 @@
#include <vector>
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/basic.h>
#include <CGAL/Arr_tags.h>
@ -51,17 +51,17 @@ namespace CGAL {
OutputIterator res2)
{
typedef typename CK::Circular_arc_point_2 Point_2;
typedef boost::variant<Arc1, Arc2> X_monotone_curve_2;
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Arc1, Arc2> X_monotone_curve_2;
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
for (auto it = res1.begin(); it != res1.end(); ++it) {
if (const Arc1* arc = CGAL::object_cast<Arc1>(&*it)) {
boost::variant<Arc1, Arc2> v = *arc;
std::variant<Arc1, Arc2> v = *arc;
*res2++ = Make_x_monotone_result(v);
}
else if (const Arc2* line = CGAL::object_cast<Arc2>(&*it)) {
boost::variant<Arc1, Arc2> v = *line;
std::variant<Arc1, Arc2> v = *line;
*res2++ = Make_x_monotone_result(v);
}
else if (const Point_2* p = CGAL::object_cast<Point_2>(&*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<Arc1>( &a1 ) ){
if ( const Arc1* arc2 = boost::get<Arc1>( &a2 ) ){
if ( const Arc1* arc1 = std::get_if<Arc1>( &a1 ) ){
if ( const Arc1* arc2 = std::get_if<Arc1>( &a2 ) ){
return CircularKernel()
.compare_y_to_right_2_object()(*arc1, *arc2, p);
}
else {
const Arc2* arc2e = boost::get<Arc2>( &a2 );
const Arc2* arc2e = std::get_if<Arc2>( &a2 );
return CircularKernel()
.compare_y_to_right_2_object()(*arc1, *arc2e, p);
}
}
const Arc2* arc1 = boost::get<Arc2>( &a1 );
if ( const Arc1* arc2 = boost::get<Arc1>( &a2 ) ){
const Arc2* arc1 = std::get_if<Arc2>( &a1 );
if ( const Arc1* arc2 = std::get_if<Arc1>( &a2 ) ){
return CircularKernel()
.compare_y_to_right_2_object()(*arc1, *arc2, p);
}
const Arc2* arc2e = boost::get<Arc2>( &a2 );
const Arc2* arc2e = std::get_if<Arc2>( &a2 );
return CircularKernel()
.compare_y_to_right_2_object()(*arc1, *arc2e, p);
}
@ -110,7 +110,6 @@ namespace CGAL {
template <class CircularKernel>
class Variant_Equal_2
: public boost::static_visitor<bool>
{
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<CircularKernel>(), 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<Arc1>( &A1 ) ){
if ( const Arc1* arc1 = std::get_if<Arc1>( &A1 ) ){
return CircularKernel().compare_y_at_x_2_object()(p, *arc1);
}
else {
const Arc2* arc2 = boost::get<Arc2>( &A1 );
const Arc2* arc2 = std::get_if<Arc2>( &A1 );
return CircularKernel().compare_y_at_x_2_object()(p, *arc2);
}
}
};
template <class CircularKernel>
class Variant_Do_overlap_2 : public boost::static_visitor<bool>
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<CircularKernel>(), A0, A1 );
}
};
@ -248,23 +247,17 @@ namespace CGAL {
template < class OutputIterator,class Not_X_Monotone >
OutputIterator
operator()(const boost::variant<Arc1, Arc2, Not_X_Monotone> &A,
operator()(const std::variant<Arc1, Arc2, Not_X_Monotone> &A,
OutputIterator res) const
{
if ( const Arc1* arc1 = boost::get<Arc1>( &A ) ) {
std::vector<CGAL::Object> container;
CircularKernel().
make_x_monotone_2_object()(*arc1,std::back_inserter(container));
return object_to_object_variant<CircularKernel, Arc1, Arc2>
(container, res);
if ( const Arc1* arc1 = std::get_if<Arc1>( &A ) ) {
return CircularKernel().
make_x_monotone_2_object()(*arc1, res);
}
else {
const Arc2* arc2 = boost::get<Arc2>( &A );
std::vector<CGAL::Object> container;
CircularKernel().
make_x_monotone_2_object()(*arc2,std::back_inserter(container));
return object_to_object_variant<CircularKernel, Arc1, Arc2>
(container, res);
const Arc2* arc2 = std::get_if<Arc2>( &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<Arc1>( &c1 ) ){
if ( const Arc1* arc2 = boost::get<Arc1>( &c2 ) ){
if ( const Arc1* arc1 = std::get_if<Arc1>( &c1 ) ){
if ( const Arc1* arc2 = std::get_if<Arc1>( &c2 ) ){
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
}
const Arc2* arc2 = boost::get<Arc2>( &c2 );
const Arc2* arc2 = std::get_if<Arc2>( &c2 );
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
}
const Arc2* arc1e = boost::get<Arc2>( &c1 );
if ( const Arc1* arc2 = boost::get<Arc1>( &c2 ) ){
const Arc2* arc1e = std::get_if<Arc2>( &c1 );
if ( const Arc1* arc2 = std::get_if<Arc1>( &c2 ) ){
return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi);
}
const Arc2* arc2 = boost::get<Arc2>( &c2 );
const Arc2* arc2 = std::get_if<Arc2>( &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<Arc1>( &A ) ){
if ( const Arc1* arc1 = std::get_if<Arc1>( &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<Arc2>( &A );
const Arc2* arc2 = std::get_if<Arc2>( &A );
Arc2 cline1;
Arc2 cline2;
CircularKernel().split_2_object()(*arc2, p, cline1, cline2);
@ -340,8 +333,6 @@ namespace CGAL {
template <class CircularKernel>
class Variant_Construct_min_vertex_2
: public boost::static_visitor
<const typename CircularKernel::Circular_arc_point_2&>
{
typedef typename CircularKernel::Circular_arc_point_2
Circular_arc_point_2;
@ -372,9 +363,9 @@ namespace CGAL {
//std::remove_reference_t<qualified_result_type>
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<CircularKernel>(), cv );
}
};
@ -385,8 +376,6 @@ namespace CGAL {
template <class CircularKernel>
class Variant_Construct_max_vertex_2
: public boost::static_visitor<const typename
CircularKernel::Circular_arc_point_2&>
{
typedef typename CircularKernel::Circular_arc_point_2
Circular_arc_point_2;
@ -422,16 +411,15 @@ namespace CGAL {
//std::remove_reference<qualified_result_type>
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<CircularKernel>(), cv );
}
};
template <class CircularKernel>
class Variant_Is_vertical_2
: public boost::static_visitor<bool>
{
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<CircularKernel>(), 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;

View File

@ -30,7 +30,6 @@
#include <memory>
#include <map>
#include <boost/variant.hpp>
#include <boost/math/constants/constants.hpp>
#include <CGAL/Cartesian.h>
@ -863,8 +862,6 @@ public:
*/
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const {
typedef boost::variant<Point_2, X_monotone_curve_2>
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_point, X_monotone_curve_2>
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;
}
}

View File

@ -23,7 +23,7 @@
#include <list>
#include <boost/variant.hpp>
#include <variant>
#include <boost/mpl/has_xxx.hpp>
#include <CGAL/tags.h>
@ -126,9 +126,9 @@ public:
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
typedef boost::variant<Point_2, Base_x_monotone_curve_2>
typedef std::variant<Point_2, Base_x_monotone_curve_2>
Base_make_x_monotone_result;
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
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_x_monotone_curve_2>(&base_obj)) {
if (const auto* bxcv = std::get_if<Base_x_monotone_curve_2>(&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<Point_2>(&base_obj);
const auto* bp = std::get_if<Point_2>(&base_obj);
CGAL_assertion(bp);
*oi++ = Make_x_monotone_result(*bp);
}
@ -208,9 +208,7 @@ public:
OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;
typedef boost::variant<Intersection_point, Base_x_monotone_curve_2>
typedef std::variant<Intersection_point, Base_x_monotone_curve_2>
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<Base_x_monotone_curve_2>(&item);
std::get_if<Base_x_monotone_curve_2>(&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<Intersection_point>(&item);
*oi++ = Intersection_result(*ip);
const Intersection_point* ip = std::get_if<Intersection_point>(&item);
*oi++ = *ip;
}
return oi;

View File

@ -26,7 +26,7 @@
#include <fstream>
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/config.h>
#include <CGAL/Cartesian.h>
@ -2063,7 +2063,7 @@ public:
*/
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& c, OutputIterator oi) const {
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
// std::cout << "full: " << c.is_full() << std::endl;
// std::cout << "vert: " << c.is_vertical() << std::endl;
@ -2321,8 +2321,7 @@ public:
OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;
const Kernel& kernel = m_traits;
typename Kernel::Equal_2 equal = kernel.equal_2_object();
@ -2337,14 +2336,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;
}
@ -2358,19 +2357,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;
}
@ -2383,12 +2382,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;
}
@ -2400,13 +2399,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;
}
@ -2418,13 +2417,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;
}
@ -2442,12 +2441,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;
}
@ -2457,12 +2456,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;
}
@ -2560,8 +2559,6 @@ public:
typedef typename Kernel::Equal_3 Equal_3;
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, X_monotone_curve_2>
Intersection_result;
const Kernel& kernel = m_traits;
@ -2584,9 +2581,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;
}
@ -2594,11 +2591,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
@ -2646,12 +2643,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;
}

View File

@ -201,7 +201,7 @@ public:
* intersection or a plane in case plane1 and plane2 coincide.
*/
template <typname Kernel>
boost::variant<typename Kernel::Line_3, Arr_plane_3<Kernel> >
std::variant<typename Kernel::Line_3, Arr_plane_3<Kernel> >
intersect(const Arr_plane_3<Kernel> & plane1,
const Arr_plane_3<Kernel> & plane2)
{
@ -209,7 +209,7 @@ intersect(const Arr_plane_3<Kernel> & plane1,
typedef typename Kernel::Direction_3 Direction_3;
typedef typename Kernel::Line_3 Line_3;
typedef typename Kernel::FT FT;
typedef boost::variant<Line_3, Arr_plane_3<Kernel> > Intersection_result;
typedef std::variant<Line_3, Arr_plane_3<Kernel> > Intersection_result;
// We know that the plane goes through the origin
const FT& a1 = plane1.a();

View File

@ -1264,22 +1264,22 @@ private:
Control_points aux_vec;
auto res1 = f_intersect(skew1a, skew2a);
const Point_2* p1 = boost::get<Point_2>(&*res1);
const Point_2* p1 = std::get_if<Point_2>(&*res1);
if (! p1) CGAL_error();
aux_vec.push_back(*p1);
auto res2 = f_intersect(skew1a, skew2b);
const Point_2* p2 = boost::get<Point_2>(&*res2);
const Point_2* p2 = std::get_if<Point_2>(&*res2);
if (! p2) CGAL_error();
aux_vec.push_back(*p2);
auto res3 = f_intersect(skew1b, skew2a);
const Point_2* p3 = boost::get<Point_2>(&*res3);
const Point_2* p3 = std::get_if<Point_2>(&*res3);
if (! p3) CGAL_error();
aux_vec.push_back(*p3);
auto res4 = f_intersect (skew1b, skew2b);
const Point_2* p4 = boost::get<Point_2>(&*res4);
const Point_2* p4 = std::get_if<Point_2>(&*res4);
if (! p4) CGAL_error();
aux_vec.push_back(*p4);

View File

@ -318,13 +318,11 @@ public:
Bezier_cache& cache,
OutputIterator oi) const
{
typedef boost::variant<Intersection_point, Self> 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);
}
}

View File

@ -995,9 +995,6 @@ public:
OutputIterator intersect(const Self& cv, OutputIterator oi,
Intersection_map* inter_map = nullptr) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, Self> 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;
}
}

View File

@ -125,7 +125,7 @@ public:
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& line, OutputIterator oi) const
{
typedef boost::variant<Point_2, X_monotone_curve_2> Make_x_monotone_result;
typedef std::variant<Point_2, X_monotone_curve_2> Make_x_monotone_result;
*oi++ = Make_x_monotone_result(line);
return oi;
}

View File

@ -26,7 +26,7 @@
#include <fstream>
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/tags.h>
#include <CGAL/intersections.h>
@ -1249,7 +1249,7 @@ public:
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
// Wrap the segment with a variant.
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
*oi++ = Make_x_monotone_result(cv);
return oi;
@ -1326,8 +1326,6 @@ public:
OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, X_monotone_curve_2>
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<Point_2>(&*res);
const Point_2* ip = std::get_if<Point_2>(&*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;

View File

@ -27,7 +27,7 @@
* functors required by the concept it models.
*/
#include <boost/variant.hpp>
#include <variant>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/tags.h>
@ -131,7 +131,7 @@ public:
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
// Wrap the segment with a variant.
typedef boost::variant<Point_2, X_monotone_curve_2>
typedef std::variant<Point_2, X_monotone_curve_2>
Make_x_monotone_result;
*oi++ = Make_x_monotone_result(cv);
return oi;
@ -224,8 +224,6 @@ public:
OutputIterator oi) const
{
typedef std::pair<Point_2, Multiplicity> Intersection_point;
typedef boost::variant<Intersection_point, X_monotone_curve_2>
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<Point_2>(&*res);
const Point_2* p_p = std::get_if<Point_2>(&*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<X_monotone_curve_2>(&*res);
const X_monotone_curve_2* cv_p = std::get_if<X_monotone_curve_2>(&*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;
}
};

View File

@ -24,7 +24,7 @@
*/
#include <vector>
#include <boost/optional/optional.hpp>
#include <optional>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/type_traits.hpp>
@ -231,7 +231,7 @@ overlay(const Arrangement_on_surface_2<GeometryTraitsA_2, TopologyTraitsA>& 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<GeometryTraitsA_2, TopologyTraitsA>& 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<Cell_handle_blue>());
Ovl_point_2(vit1->point(), std::make_optional(Cell_handle_red(v1)),
std::optional<Cell_handle_blue>());
}
}
@ -294,8 +294,8 @@ overlay(const Arrangement_on_surface_2<GeometryTraitsA_2, TopologyTraitsA>& arr1
if (vit2->is_isolated()) {
typename Arr_b::Vertex_const_handle v2 = vit2;
pts_vec[i++] =
Ovl_point_2(vit2->point(), boost::optional<Cell_handle_red>(),
boost::make_optional(Cell_handle_blue(v2)));
Ovl_point_2(vit2->point(), std::optional<Cell_handle_red>(),
std::make_optional(Cell_handle_blue(v2)));
}
}

View File

@ -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())); }

View File

@ -26,8 +26,8 @@
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
#include <variant>
#include <optional>
namespace CGAL {

View File

@ -75,7 +75,7 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::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<Td_active_vertex>(tr));
Td_active_vertex& v (std::get<Td_active_vertex>(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<Arrangement_2>::locate(const Point_2& p) const
case TD::CURVE:
{
Td_active_edge& e (boost::get<Td_active_edge>(tr));
Td_active_edge& e (std::get<Td_active_edge>(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<Arrangement_2>::locate(const Point_2& p) const
case TD::TRAPEZOID:
{
Td_active_trapezoid t (boost::get<Td_active_trapezoid>(tr));
Td_active_trapezoid t (std::get<Td_active_trapezoid>(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<Arrangement>::
_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<Td_active_trapezoid>(item));
Td_active_trapezoid tr (std::get<Td_active_trapezoid>(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<Td_active_vertex>(&left_v_item) != nullptr) {
Td_active_vertex v(boost::get<Td_active_vertex>(left_v_item));
if (std::get_if<Td_active_vertex>(&left_v_item) != nullptr) {
Td_active_vertex v(std::get<Td_active_vertex>(left_v_item));
he = v.cw_he();
}
else {
Td_active_fictitious_vertex
v(boost::get<Td_active_fictitious_vertex>(left_v_item));
v(std::get<Td_active_fictitious_vertex>(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<Td_active_vertex>(&right_v_item)!= nullptr) {
Td_active_vertex v(boost::get<Td_active_vertex>(right_v_item));
if (std::get_if<Td_active_vertex>(&right_v_item)!= nullptr) {
Td_active_vertex v(std::get<Td_active_vertex>(right_v_item));
he = v.cw_he();
}
else {
Td_active_fictitious_vertex
v(boost::get<Td_active_fictitious_vertex>(right_v_item));
v(std::get<Td_active_fictitious_vertex>(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<Td_active_vertex>(item));
Td_active_vertex& v (std::get<Td_active_vertex>(item));
return (make_result(v.vertex()));
}
break;
case TD::CURVE:
{
Td_active_edge& e (boost::get<Td_active_edge>(item));
Td_active_edge& e (std::get<Td_active_edge>(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<Td_active_trapezoid>(item));
Td_active_trapezoid trpz (std::get<Td_active_trapezoid>(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))

View File

@ -22,7 +22,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#include <memory>
@ -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<Vertex_const_handle,Point>,
boost::variant<Vertex_const_handle,unsigned char>,
boost::variant<Halfedge_const_handle,
typedef Td_ninetuple<std::variant<Vertex_const_handle,Point>,
std::variant<Vertex_const_handle,unsigned char>,
std::variant<Halfedge_const_handle,
std::shared_ptr<X_monotone_curve_2> >,
Halfedge_const_handle,
unsigned char,
@ -239,7 +239,7 @@ public:
Curve_end v_ce(left()->curve_end());
ptr()->e2 = (std::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv()));
//CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2>>( &(ptr()->e2)) != nullptr);
//CGAL_assertion(std::get<std::shared_ptr<X_monotone_curve_2>>( &(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<Vertex_const_handle>(&(ptr()->e0)) != nullptr);
return boost::get<Vertex_const_handle>(ptr()->e0);
CGAL_assertion(std::get<Vertex_const_handle>(&(ptr()->e0)) != nullptr);
return std::get<Vertex_const_handle>(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<Vertex_const_handle>(&(ptr()->e1)) != nullptr);
return boost::get<Vertex_const_handle>(ptr()->e1);
CGAL_assertion(std::get<Vertex_const_handle>(&(ptr()->e1)) != nullptr);
return std::get<Vertex_const_handle>(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<Halfedge_const_handle>(&(ptr()->e2)) != nullptr);
return boost::get<Halfedge_const_handle>(ptr()->e2);
CGAL_assertion(std::get<Halfedge_const_handle>(&(ptr()->e2)) != nullptr);
return std::get<Halfedge_const_handle>(ptr()->e2);
}
/*! Access trapezoid bottom.
@ -526,8 +526,8 @@ public:
CGAL_precondition(type() == TD_VERTEX);
CGAL_precondition(!is_on_boundaries());
CGAL_assertion(boost::get<Point>( &(ptr()->e0)) != nullptr);
return boost::get<Point>( ptr()->e0 );
CGAL_assertion(std::get<Point>( &(ptr()->e0)) != nullptr);
return std::get<Point>( ptr()->e0 );
}
CGAL_TD_INLINE std::pair<X_monotone_curve_2*,Arr_curve_end> 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<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(std::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(std::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (std::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce =
(boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
(std::get<unsigned char>(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<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(std::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(std::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (std::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce =
(boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
(std::get<unsigned char>(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<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(std::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(std::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (std::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce =
(boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
(std::get<unsigned char>(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<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(std::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (std::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr);
return *cv_ptr;
}

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#include <memory>
@ -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<Td_map_item&> next)
inline void init_neighbors(std::optional<std::reference_wrapper<Td_map_item>> 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<Td_map_item&> next)
CGAL_DEPRECATED inline void init_neighbours(std::optional<std::reference_wrapper<Td_map_item>> 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<Td_map_item&> next = boost::none)
std::optional<std::reference_wrapper<Td_map_item>> 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;
}

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#include <memory>
#ifdef CGAL_TD_DEBUG

View File

@ -23,8 +23,8 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <CGAL/tuple.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
#include <variant>
#include <optional>
#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<Td_map_item&> lb, boost::optional<Td_map_item&> lt,
boost::optional<Td_map_item&> rb, boost::optional<Td_map_item&> rt)
inline void init_neighbors(std::optional<std::reference_wrapper<Td_map_item>> lb, std::optional<std::reference_wrapper<Td_map_item>> lt,
std::optional<std::reference_wrapper<Td_map_item>> rb, std::optional<std::reference_wrapper<Td_map_item>> 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<Td_map_item&> lb, boost::optional<Td_map_item&> lt,
boost::optional<Td_map_item&> rb, boost::optional<Td_map_item&> rt)
CGAL_DEPRECATED inline void init_neighbours(std::optional<std::reference_wrapper<Td_map_item>> lb, std::optional<std::reference_wrapper<Td_map_item>> lt,
std::optional<std::reference_wrapper<Td_map_item>> rb, std::optional<std::reference_wrapper<Td_map_item>> 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<Td_map_item&> lb = boost::none,
boost::optional<Td_map_item&> lt = boost::none,
boost::optional<Td_map_item&> rb = boost::none,
boost::optional<Td_map_item&> rt = boost::none,
std::optional<std::reference_wrapper<Td_map_item>> lb = std::nullopt,
std::optional<std::reference_wrapper<Td_map_item>> lt = std::nullopt,
std::optional<std::reference_wrapper<Td_map_item>> rb = std::nullopt,
std::optional<std::reference_wrapper<Td_map_item>> 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<Self>(rb()));
Self tr(std::get<Self>(rb()));
tr.set_lb(item);
}
if (ptr()->rt.which() != 0)
if (ptr()->rt.index() != 0)
{
Self tr(boost::get<Self>(rt()));
Self tr(std::get<Self>(rt()));
tr.set_lt(item);
}
CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary());

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#include <memory>

View File

@ -28,7 +28,7 @@
#include <list>
#include <functional>
#include <boost/variant.hpp>
#include <variant>
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

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#include <memory>

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#ifdef CGAL_TD_DEBUG

View File

@ -21,7 +21,7 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <variant>
#ifdef CGAL_TD_DEBUG

Some files were not shown because too many files have changed in this diff Show More