diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml
new file mode 100644
index 00000000000..6979eb86108
--- /dev/null
+++ b/.github/workflows/build_doc.yml
@@ -0,0 +1,93 @@
+name: Documentation
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/github-script@v3
+ id: get_round
+ with:
+ result-encoding: string
+ script: |
+ const asso = context.payload.comment.author_association
+ if(asso == 'OWNER' || asso == 'MEMBER') {
+ const body = context.payload.comment.body
+ if(body.includes("build:")) {
+ return body.replace('build:','')
+ }
+ }
+ return 'stop'
+ - uses: actions/github-script@v3
+ if: steps.get_round.outputs.result != 'stop'
+ id: get_pr_number
+ with:
+ result-encoding: string
+ script: |
+ //get pullrequest url
+ const pr_number = context.payload.issue.number
+ return pr_number
+ - uses: actions/checkout@v2
+ name: "checkout branch"
+ if: steps.get_round.outputs.result != 'stop'
+ with:
+ repository: ${{ github.repository }}
+ ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge
+ token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}
+
+
+ - name: install dependencies
+ if: steps.get_round.outputs.result != 'stop'
+ run: |
+ set -x
+ sudo apt-get install -y graphviz ssh
+ sudo pip install lxml pyquery
+ wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~mgimeno/doxygen/build_1_8_13/bin/doxygen
+ sudo mv doxygen_exe /usr/bin/doxygen
+ sudo chmod +x /usr/bin/doxygen
+ git config --global user.email "maxime.gimeno@geometryfactory.com"
+ git config --global user.name "Maxime Gimeno"
+
+ - name: configure all
+ if: steps.get_round.outputs.result != 'stop'
+ run: |
+ set -ex
+ git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
+ mkdir -p build_doc && cd build_doc && cmake ../Documentation/doc
+
+ - name: Upload Doc
+ if: steps.get_round.outputs.result != 'stop'
+ run: |
+ set -ex
+ PR_NUMBER=${{ steps.get_pr_number.outputs.result }}
+ ROUND=${{ steps.get_round.outputs.result }}
+ wget --no-verbose cgal.github.io -O tmp.html
+ if ! egrep -q "\/$PR_NUMBER\/$ROUND" tmp.html; then
+ mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND
+ cd build_doc && make -j2 doc && make -j2 doc_with_postprocessing
+ cp -r ./doc_output/* ../cgal.github.io/${PR_NUMBER}/$ROUND
+ cd ../cgal.github.io
+ egrep -v " ${PR_NUMBER}\." index.html > tmp.html
+ echo "
Manual for PR ${PR_NUMBER} ($ROUND)." >> ./tmp.html
+ mv tmp.html index.html
+ git add ${PR_NUMBER}/$ROUND && git commit -q -a -m "Add ${PR_NUMBER} $ROUND" && git push -q -u origin master
+ else
+ exit 1
+ fi
+
+ - name: Post address
+ uses: actions/github-script@v3
+ if: steps.get_round.outputs.result != 'stop'
+ with:
+ script: |
+ const address = "The documentation is built. You can find it here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html"
+ github.issues.createComment({
+ owner: "CGAL",
+ repo: "cgal",
+ issue_number: ${{ github.event.issue.number }},
+ body: address
+ });
diff --git a/.github/workflows/delete_doc.yml b/.github/workflows/delete_doc.yml
new file mode 100644
index 00000000000..c1152d37ca9
--- /dev/null
+++ b/.github/workflows/delete_doc.yml
@@ -0,0 +1,27 @@
+name: Documentation Removal
+
+on:
+ pull_request_target:
+ types: [closed, removed]
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2.0.0
+ - name: delete directory
+ run: |
+ set -x
+ git config --global user.email "maxime.gimeno@geometryfactory.com"
+ git config --global user.name "Maxime Gimeno"
+ git clone https://maxGimeno:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
+ PR_NUMBER=$(python -c "import json; import os; y = json.load(open(os.environ['GITHUB_EVENT_PATH'])); print(y[\"number\"])")
+ cd cgal.github.io/
+ egrep -v " ${PR_NUMBER}\." index.html > tmp.html
+ if [ -n "$(diff -q ./index.html ./tmp.html)" ]; then
+ mv tmp.html index.html
+ #git rm -r ${PR_NUMBER} && git commit -a -m "Remove ${PR_NUMBER}" && git push -u origin master
+ git commit -a -m "Remove ${PR_NUMBER}" && git push -u origin master
+ fi
+
diff --git a/.travis/build_package.sh b/.travis/build_package.sh
index 254dd2b08c7..12f6082c922 100755
--- a/.travis/build_package.sh
+++ b/.travis/build_package.sh
@@ -41,6 +41,7 @@ do
continue
fi
cd $ROOT
+
#install openmesh only if necessary
if [ "$ARG" = "CHECK" ] || [ "$ARG" = BGL ] || [ "$ARG" = Convex_hull_3 ] ||\
[ "$ARG" = Polygon_mesh_processing ] || [ "$ARG" = Property_map ] ||\
@@ -92,28 +93,27 @@ cd $ROOT
exit 1
fi
echo "Matrix is up to date."
- #check if non standard cgal installation works
- cd $ROOT
- mkdir build_test
- cd build_test
- mytime cmake -DCMAKE_INSTALL_PREFIX=install/ -DCGAL_BUILD_THREE_DOC=TRUE ..
- mytime make install
- # test install with minimal downstream example
- mkdir installtest
- cd installtest
- touch main.cpp
- mkdir build
- echo 'project(Example)' >> CMakeLists.txt
- echo 'set(PROJECT_SRCS ${PROJECT_SOURCE_DIR}/main.cpp)' >> CMakeLists.txt
- echo 'find_package(CGAL REQUIRED)' >> CMakeLists.txt
- echo 'add_executable(${PROJECT_NAME} ${PROJECT_SRCS})' >> CMakeLists.txt
- echo 'target_link_libraries(${PROJECT_NAME} CGAL::CGAL)' >> CMakeLists.txt
- echo '#include "CGAL/remove_outliers.h"' >> main.cpp
- cd build
- mytime cmake -DCMAKE_INSTALL_PREFIX=../../install -DCGAL_BUILD_THREE_DOC=TRUE ..
- cd ..
exit 0
fi
+
+ if [ "$ARG" = "Installation" ]
+ then
+ mkdir build_dir
+ cd build_dir
+ cmake -DWITH_tests=ON -DBUILD_TESTING=ON ..
+ ctest -j2 -L CGAL_cmake_testsuite --output-on-failure
+ cd ..
+ rm -rf ./build_dir
+ #==-- configure all CGAL with -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON, and then launch CTest on a few labels. --==
+ mkdir config_dir
+ cd config_dir
+ cmake -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON -DBUILD_TESTING=ON ..
+ ctest -j2 -L AABB_tree --output-on-failure
+ cd ..
+ rm -rf ./config_dir
+ exit 0
+ fi
+
IFS=$old_IFS
if [ -n "$TRAVIS_PULL_REQUEST_BRANCH" ] && [ "$ARG" != Polyhedron_demo ]; then
@@ -185,6 +185,7 @@ cd $ROOT
cd "$ROOT/$DEMO"
build_demo
fi
+
done
IFS=$old_IFS
# Local Variables:
diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h
index 84a45fba132..03a6dab8354 100644
--- a/AABB_tree/include/CGAL/AABB_tree.h
+++ b/AABB_tree/include/CGAL/AABB_tree.h
@@ -578,7 +578,7 @@ public:
#ifdef CGAL_HAS_THREADS
mutable CGAL_MUTEX build_mutex; // mutex used to protect const calls inducing build() and build_kd_tree()
#endif
-
+ public:
const Node* root_node() const {
CGAL_assertion(size() > 1);
@@ -596,7 +596,7 @@ public:
}
return m_p_root_node;
}
-
+ private:
const Primitive& singleton_data() const {
CGAL_assertion(size() == 1);
return *m_primitives.begin();
diff --git a/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h b/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h
index 0a710185dfe..e999643e2ed 100644
--- a/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h
+++ b/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h
@@ -660,23 +660,33 @@ public:
return Equal_2(_traits);
}
- /*! A functor that divides a curve into continues (x-monotone) curves. */
+ //! A functor for subdividing curves into x-monotone curves.
class Make_x_monotone_2
{
private:
Traits& _traits;
+
public:
Make_x_monotone_2(Traits& traits) : _traits(traits) {}
- template
- OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const
+
+ /*! Subdivide a given curve into x-monotone subcurves and insert them into
+ * a given output iterator.
+ * \param cv the curve.
+ * \param oi an output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return The past-the-end iterator.
+ */
+ template
+ OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
Object_vector res (boost::apply_visitor(Make_x_monotone_2_visitor(_traits),cv.variant()));
re_cast_object_vector(res,oi);
return (oi);
}
+
private:
- class Make_x_monotone_2_visitor
- : public boost::static_visitor < Object_vector >
+ class Make_x_monotone_2_visitor :
+ public boost::static_visitor < Object_vector >
{
private:
typedef boost::static_visitor Base;
@@ -1787,4 +1797,3 @@ public:
#endif // CGAL_DONT_SUBMIT
#endif //CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H
-
diff --git a/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h b/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h
index cd8d80f962f..2c25299c59b 100644
--- a/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h
+++ b/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h
@@ -80,7 +80,7 @@ public:
Arr_rational_arc_traits_2 ()
{}
- /// \name Functor definitions.
+ /// \name Basic functor definitions.
//@{
/*! A functor that compares the x-coordinates of two points */
@@ -381,19 +381,22 @@ public:
{
return Equal_2();
}
+ //@}
+
+ //! \name Intersections, subdivisions, and mergings
+ //@{
/*! A functor that divides a curve into continues (x-monotone) curves. */
class Make_x_monotone_2
{
public:
- /*!
- * Cut the given conic curve (or conic arc) into x-monotone subcurves
- * and insert them to the given output iterator.
- * \param cv The curve.
- * \param oi The output iterator, whose value-type is Object. The returned
- * objects is a wrapper for an X_monotone_curve_2 object.
- * \return The past-the-end iterator.
+ /*! Subdivide a given rational arc into x-monotone subcurves and insert them
+ * into a given output iterator.
+ * \param cv the arc.
+ * \param oi an output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return the past-the-end iterator.
*/
template
OutputIterator operator() (const Curve_2& cv, OutputIterator oi)
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
index 41acec251bb..dbe9e2dd917 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
@@ -25,26 +25,26 @@ typedef CGAL::Curved_kernel_via_analysis_2< Algebraic_kernel_d_2 > CKvA_2;
Polynomial_2 makeParabola( )
{
- Polynomial_2 x = CGAL::shift( Polynomial_2( 1 ), 1, 0 );
- Polynomial_2 y = CGAL::shift( Polynomial_2( 1 ), 1, 1 );
- Polynomial_2 parabola = y - x*x;
+ Polynomial_2 x = CGAL::shift( Polynomial_2( 1 ), 1, 0 );
+ Polynomial_2 y = CGAL::shift( Polynomial_2( 1 ), 1, 1 );
+ Polynomial_2 parabola = y - x*x;
- return parabola;
+ return parabola;
}
X_monotone_curve_2 makeVerticalLine( Bound x )
{
- Traits traits;
- Traits::Construct_point_2 constructPoint =
- traits.construct_point_2_object( );
- Traits::Construct_x_monotone_segment_2 constructSegment =
- traits.construct_x_monotone_segment_2_object( );
+ Traits traits;
+ Traits::Construct_point_2 constructPoint =
+ traits.construct_point_2_object( );
+ Traits::Construct_x_monotone_segment_2 constructSegment =
+ traits.construct_x_monotone_segment_2_object( );
- std::vector< X_monotone_curve_2 > curves;
- Point_2 p1 = constructPoint( Algebraic_real_1(x), Algebraic_real_1(Bound( -10000 )) );
- Point_2 p2 = constructPoint( x, Bound( +10000 ) );
- constructSegment( p1, p2, std::back_inserter( curves ) );
- return curves[ 0 ];
+ std::vector< X_monotone_curve_2 > curves;
+ Point_2 p1 = constructPoint( Algebraic_real_1(x), Algebraic_real_1(Bound( -10000 )) );
+ Point_2 p2 = constructPoint( x, Bound( +10000 ) );
+ constructSegment( p1, p2, std::back_inserter( curves ) );
+ return curves[ 0 ];
}
typedef CGAL::Cartesian< Coefficient > Kernel;
@@ -52,40 +52,38 @@ typedef Kernel::Point_2 Kernel_point_2;
int main( )
{
- Algebraic_real_1 real( 1 );
- //CGAL::Qt::Converter< Algebraic_kernel_d_2 > testConverter;
- //CGAL::Qt::Converter< CKvA_2 > testConverter;
+ Algebraic_real_1 real( 1 );
+ //CGAL::Qt::Converter< Algebraic_kernel_d_2 > testConverter;
+ //CGAL::Qt::Converter< CKvA_2 > testConverter;
- //CGAL::Qt::Converter< Cartesian > testConverter;
- Kernel_point_2 testPt( 1, 2 );
- Point_2 testPt2( testPt.x( ), testPt.y( ) );
- Traits traits;
- Construct_curve_2 constructCurve = traits.construct_curve_2_object( );
- Curve_2 curve = constructCurve( makeParabola( ) );
- Make_x_monotone_2 mm = traits.make_x_monotone_2_object( );
- std::vector< CGAL::Object > curves;
- mm( curve, std::back_inserter( curves ) );
- std::cout << curves.size( ) << std::endl;
- X_monotone_curve_2 c1;
- CGAL::assign( c1, curves[ 0 ] );
- double lb = -3;
- double ub = 3;
- double step = 6.0 / 1000;
+ //CGAL::Qt::Converter< Cartesian > testConverter;
+ Kernel_point_2 testPt( 1, 2 );
+ Point_2 testPt2( testPt.x( ), testPt.y( ) );
+ Traits traits;
+ Construct_curve_2 constructCurve = traits.construct_curve_2_object( );
+ Curve_2 curve = constructCurve( makeParabola( ) );
+ Make_x_monotone_2 mm = traits.make_x_monotone_2_object( );
+ std::vector< CGAL::Object > curves;
+ mm( curve, std::back_inserter( curves ) );
+ std::cout << curves.size( ) << std::endl;
+ X_monotone_curve_2 c1;
+ CGAL::assign( c1, curves[ 0 ] );
+ double lb = -3;
+ double ub = 3;
+ double step = 6.0 / 1000;
- for ( int i = 0; i < 1000; ++i )
- {
- X_monotone_curve_2 c2 = makeVerticalLine( lb + step * i );
+ for ( int i = 0; i < 1000; ++i ) {
+ X_monotone_curve_2 c2 = makeVerticalLine( lb + step * i );
- CGAL::Object o;
- CGAL::Oneset_iterator< CGAL::Object > oi( o );
- Intersect_2 intersect = traits.intersect_2_object( );
- intersect( c1, c2, oi );
- std::pair< Point_2, Multiplicity > res;
- CGAL::assign( res, o );
- std::pair< double, double > approx = res.first.to_double( );
- std::cout << approx.first << " " << approx.second << std::endl;
- }
+ CGAL::Object o;
+ CGAL::Oneset_iterator< CGAL::Object > oi( o );
+ Intersect_2 intersect = traits.intersect_2_object( );
+ intersect( c1, c2, oi );
+ std::pair< Point_2, Multiplicity > res;
+ CGAL::assign( res, o );
+ std::pair< double, double > approx = res.first.to_double( );
+ std::cout << approx.first << " " << approx.second << std::endl;
+ }
-
- return 0;
+ return 0;
}
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
index e2be25f6b52..120fdf7beea 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
@@ -6,28 +6,29 @@
#include
#include
-typedef CGAL::Gmpq NT;
-typedef CGAL::Cartesian< NT > Kernel;
-typedef CGAL::Arr_linear_traits_2< Kernel > Traits;
-typedef CGAL::Arr_default_dcel< Traits > Dcel;
-typedef CGAL::Arrangement_with_history_2< Traits, Dcel > Arrangement;
-typedef CGAL::Arr_walk_along_line_point_location< Arrangement > WalkAlongLinePointLocationStrategy;
-typedef Kernel::Point_2 Point_2;
-typedef Kernel::Ray_2 Ray_2;
-typedef Arrangement::Curve_2 Curve_2;
+typedef CGAL::Gmpq NT;
+typedef CGAL::Cartesian Kernel;
+typedef CGAL::Arr_linear_traits_2 Traits;
+typedef CGAL::Arr_default_dcel Dcel;
+typedef CGAL::Arrangement_with_history_2< Traits, Dcel> Arrangement;
+typedef CGAL::Arr_walk_along_line_point_location
+ Walk_along_line_pl;
+typedef Kernel::Point_2 Point_2;
+typedef Kernel::Ray_2 Ray_2;
+typedef Arrangement::Curve_2 Curve_2;
int main( )
{
- Point_2 p1( 0, 0 );
- Point_2 p2( 1, 0 );
- Ray_2 ray( p1, p2 );
- Curve_2 curve( ray );
+ Point_2 p1(0, 0);
+ Point_2 p2(1, 0);
+ Ray_2 ray(p1, p2);
+ Curve_2 curve(ray);
Arrangement arr;
- CGAL::insert( arr, curve );
+ CGAL::insert(arr, curve);
- WalkAlongLinePointLocationStrategy pl( arr );
- CGAL::Object o = pl.locate( Point_2( 1, -1 ) );
+ Walk_along_line_pl pl(arr);
+ auto o = pl.locate(Point_2(1, -1));
return 0;
}
diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h
index fc41e4c1f97..16788a94596 100644
--- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h
+++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h
@@ -239,19 +239,17 @@ namespace CGAL {
const Point_2& tgt) const;
};
- /*! Subdivide the given subcurve into x-monotone subcurves and insert them
- * into the given output iterator. Since the subcurves that
- * constitute a general polycurve are not necessarily
- * \f$x\f$-monotone, this functor may break them.
+ /*! Subdivide a given subcurve into x-monotone subcurves and insert them
+ * into a given output iterator.
*/
class Make_x_monotone_2 {
public:
/*!
* \pre if `cv` is not empty then it must be continuous and well-oriented.
- * \param cv The subcurve.
- * \param oi The output iterator, whose value-type is Object. The output
- * object is a wrapper of a X_monotone_curve_2 objects.
- * \return The past-the-end iterator.
+ * \param cv the subcurve.
+ * \param oi an output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return the past-the-end iterator.
*/
template
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const;
diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertical_decomposition_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertical_decomposition_2.h
index d2deb6868f4..7a39bd94d77 100644
--- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertical_decomposition_2.h
+++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertical_decomposition_2.h
@@ -1,57 +1,52 @@
namespace CGAL {
-/*!
-\ingroup PkgArrangementOnSurface2Funcs
-
-Produces the symbolic vertical decomposition of a
-given arrangement, performing a batched vertical ray-shooting query from
-all arrangement vertices, such that every vertex is associated with a pair
-of objects, one corresponds to the arrangement feature that lies below it,
-and the other corresponds to the feature that lies above it.
-The output of this function can be readily used for inserting vertical walls
-and physically decomposing the arrangement into pseudo-trapezoids. To do
-this, it is convenient to process the vertices in an ascending
-\f$ xy\f$-lexicographic order. The visible objects are therefore returned through
-an output iterator, which pairs each finite arrangement vertex with the two
-features it "sees", such that the vertices are given in ascending
-\f$ xy\f$-lexicographic order.
-
-Produces the symbolic vertical decomposition of the `arr` arrangement.
-More precisely, it performs a batched vertical ray-shooting query from all
-arrangement vertices, such that every vertex is associated with a pair of
-objects, one corresponding to the arrangement feature that lies below it,
-while the other corresponds to the feature that lies above it.
-The query results are returned through the output iterator, which pairs
-each finite arrangement vertex with a pair of `Object`s, the first
-represents the feature below the vertex, and the second represents the
-feature that lies above it. Each `Object` may be one of the following:
-
-- `Halfedge_const_handle`, if the vertex is located above (or
-below) an edge. The given halfedge is always directed from right to left.
-In case there is no concrete edge below (or above) the vertex, and
-the arrangement is unbounded, then the object returned is a
-fictitious halfedge.
-
- `Face_const_handle`, in case there is no edge below (or above)
-the vertex, and the arrangement is bounded.
-
- `Vertex_const_handle`, in case the vertex is located vertically
-above (or below) another arrangement vertex.
-
- An empty object, in case the vertex is the top end-vertex of
-a vertical edge, we define there is no feature below it. Similarly, if
-it is the bottom end-vertex of a vertical edge, we define that there
-is no feature above it.
-
-The function returns a past-the-end iterator for its output sequence.
-
-\cgalHeading{Requirements}
-
-`OutputIterator::value_type` must be
-`pair >`.
-
-*/
+/*! \ingroup PkgArrangementOnSurface2Funcs
+ *
+ * Produces the symbolic vertical decomposition of a given arrangement,
+ * performing a batched vertical ray-shooting query from all arrangement
+ * vertices, such that every vertex is associated with a pair of objects, one
+ * corresponds to the arrangement feature that lies below it, and the other
+ * corresponds to the feature that lies above it. The output of this function
+ * can be readily used for inserting vertical walls and physically decomposing
+ * the arrangement into pseudo-trapezoids. To do this, it is convenient to
+ * process the vertices in an ascending \f$ xy\f$-lexicographic order. The
+ * visible objects are therefore returned through an output iterator, which
+ * pairs each finite arrangement vertex with the two features it "sees", such
+ * that the vertices are given in ascending \f$ xy\f$-lexicographic order.
+ *
+ * Produces the symbolic vertical decomposition of the `arr` arrangement. More
+ * precisely, it performs a batched vertical ray-shooting query from all
+ * arrangement vertices, such that every vertex is associated with a pair of
+ * objects, one corresponding to the arrangement feature that lies below it,
+ * while the other corresponds to the feature that lies above it. The query
+ * results are returned through the output iterator, which pairs each finite
+ * arrangement vertex with a pair of objects, the first represents the feature
+ * below the vertex, and the second represents the feature that lies above
+ * it. Each object is an optional variant that wraps a handle to an arrangement
+ * feature. If the vertex is the top end-vertex of a vertical edge, we say that
+ * there is no feature below it; similarly, if it is the bottom end-vertex of a
+ * vertical edge, we say that there is no feature above it. In these cases the
+ * optional object is set to be empty; otherwise it is set as follows:
+ *
+ * - `Halfedge_const_handle`, if the vertex is located above (or below) an
+ * edge. The given halfedge is always directed from right to left. In case
+ * there is no concrete edge below (or above) the vertex, and the arrangement
+ * is unbounded, then the object returned is a fictitious halfedge.
+ *
- `Face_const_handle`, in case there is no edge below (or above)
+ * the vertex, and the arrangement is bounded.
+ *
- `Vertex_const_handle`, in case the vertex is located vertically above
+ * (or below) another arrangement vertex.
+ *
The function returns a past-the-end iterator for its output sequence.
+ *
+ * \cgalHeading{Requirements}
+ *
+ * `OutputIterator::value_type` must be
+ * `pair >`.
+ *
+ */
template
OutputIterator decompose (const Arrangement_2& arr,
OutputIterator oi);
} /* namespace CGAL */
-
diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h
index 2bed5f23a61..9af5785aa0c 100644
--- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h
+++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h
@@ -16,18 +16,16 @@ public:
/// A model of this concept must provide:
/// @{
-/*!
-subdivides the input curve `c` into \f$ x\f$-monotone subcurves and
-isolated points, and inserts the results into a container through the
-given output iterator. The value type of `OutputIterator` is
-`CGAL::Object`, where each `Object` wraps either an
-`ArrTraits::X_monotone_curve_2` object or a `ArrTraits::Point_2`
-object. The operator returns a past-the-end iterator for the output
-sequence.
-*/
+/*! subdivides the input curve `c` into \f$ x\f$-monotone subcurves and
+ * isolated points, and inserts the results into a range begining at the
+ * given output iterator `oi`. The type `OutputIterator` dereferences a
+ * `boost::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.
+ */
template
-OutputIterator operator()( ArrTraits::Curve_2 c,
-OutputIterator oi);
+OutputIterator operator()(ArrTraits::Curve_2 c,
+ OutputIterator oi);
/// @}
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp
index 96bcc9c1786..1db0e105e69 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp
@@ -25,106 +25,102 @@ typedef CORE::BigInt Integer;
typedef LEDA::integer Integer;
#endif
-typedef CGAL::Arr_algebraic_segment_traits_2 Arr_traits_2;
-typedef CGAL::Arrangement_2 Arrangement_2;
-typedef Arr_traits_2::Curve_2 Curve_2;
-typedef Arr_traits_2::Polynomial_2 Polynomial_2;
-typedef Arr_traits_2::Algebraic_real_1 Algebraic_real_1;
-typedef Arr_traits_2::X_monotone_curve_2 X_monotone_curve_2;
-typedef Arr_traits_2::Point_2 Point_2;
+typedef CGAL::Arr_algebraic_segment_traits_2 Arr_traits_2;
+typedef CGAL::Arrangement_2 Arrangement_2;
+typedef Arr_traits_2::Curve_2 Curve_2;
+typedef Arr_traits_2::Polynomial_2 Polynomial_2;
+typedef Arr_traits_2::Algebraic_real_1 Algebraic_real_1;
+typedef Arr_traits_2::X_monotone_curve_2 X_monotone_curve_2;
+typedef Arr_traits_2::Point_2 Point_2;
+typedef boost::variant Make_x_monotone_result;
-int main() {
+int main()
+{
+ Arr_traits_2 arr_traits;
+ auto construct_curve = arr_traits.construct_curve_2_object();
+ auto construct_x_monotone_segment =
+ arr_traits.construct_x_monotone_segment_2_object();
+ auto construct_point = arr_traits.construct_point_2_object();
+ auto make_x_monotone = arr_traits.make_x_monotone_2_object();
- Arr_traits_2 arr_traits;
+ Arrangement_2 arr(&arr_traits);
- Arr_traits_2::Construct_curve_2 construct_curve
- = arr_traits.construct_curve_2_object();
- Arr_traits_2::Construct_x_monotone_segment_2 construct_x_monotone_segment
- = arr_traits.construct_x_monotone_segment_2_object();
- Arr_traits_2::Construct_point_2 construct_point
- = arr_traits.construct_point_2_object();
- Arr_traits_2::Make_x_monotone_2 make_x_monotone
- = arr_traits.make_x_monotone_2_object();
+ std::vector segs;
- Arrangement_2 arr(&arr_traits);
+ Polynomial_2 x = CGAL::shift(Polynomial_2(1),1,0);
+ Polynomial_2 y = CGAL::shift(Polynomial_2(1),1,1);
- std::vector segs;
+ // Construct x^4+y^3-1
+ Curve_2 cv0 = construct_curve(CGAL::ipower(x,4)+CGAL::ipower(y,3)-1);
+ // Construct all x-monotone segments using the Make_x_mononotone functor
+ std::vector pre_segs;
+ make_x_monotone(cv0, std::back_inserter(pre_segs));
+ // Cast all CGAL::Objects into X_monotone_segment_2
+ // (the vector might also contain Point_2 objects for isolated points,
+ // but not for this instance
+ for(size_t i = 0; i < pre_segs.size(); ++i) {
+ auto* curr_p = boost::get(&pre_segs[i]);;
+ CGAL_assertion(curr_p);
+ segs.push_back(*curr_p);
+ }
+ // Construct an ellipse with equation 2*x^2+5*y^2-7=0
+ Curve_2 cv1 = construct_curve(2*CGAL::ipower(x,2)+5*CGAL::ipower(y,2)-7);
- Polynomial_2 x = CGAL::shift(Polynomial_2(1),1,0);
- Polynomial_2 y = CGAL::shift(Polynomial_2(1),1,1);
+ // Construct point on the upper arc (counting of arc numbers starts with 0!
+ Point_2 p11 = construct_point(Algebraic_real_1(0),cv1,1);
- // Construct x^4+y^3-1
- Curve_2 cv0 = construct_curve(CGAL::ipower(x,4)+CGAL::ipower(y,3)-1);
- // Construct all x-monotone segments using the Make_x_mononotone functor
- std::vector pre_segs;
- make_x_monotone(cv0,std::back_inserter(pre_segs));
- // Cast all CGAL::Objects into X_monotone_segment_2
- // (the vector might also contain Point_2 objects for isolated points,
- // but not for this instance
- for(size_t i = 0; i < pre_segs.size(); i++ ) {
- X_monotone_curve_2 curr;
- bool check = CGAL::assign(curr,pre_segs[i]);
- assert(check); CGAL_USE(check);
- segs.push_back(curr);
- }
- // Construct an ellipse with equation 2*x^2+5*y^2-7=0
- Curve_2 cv1 = construct_curve(2*CGAL::ipower(x,2)+5*CGAL::ipower(y,2)-7);
+ construct_x_monotone_segment(cv1,p11,Arr_traits_2::POINT_IN_INTERIOR,
+ std::back_inserter(segs));
- // Construct point on the upper arc (counting of arc numbers starts with 0!
- Point_2 p11 = construct_point(Algebraic_real_1(0),cv1,1);
+ // Construct a vertical cusp x^2-y^3=0
+ Curve_2 cv2 = construct_curve(CGAL::ipower(x,2)-CGAL::ipower(y,3));
- construct_x_monotone_segment(cv1,p11,Arr_traits_2::POINT_IN_INTERIOR,
+ // Construct a segment containing the cusp point.
+ // This adds to X_monotone_curve_2 objects to the vector,
+ // because the cusp is a critical point
+ Point_2 p21 = construct_point(Algebraic_real_1(-2),cv2,0);
+ Point_2 p22 = construct_point(Algebraic_real_1(2),cv2,0);
+ construct_x_monotone_segment(cv2,p21,p22,std::back_inserter(segs));
+
+ // Construct an unbounded curve, starting at x=3
+ Point_2 p23 = construct_point(Algebraic_real_1(3),cv2,0);
+ construct_x_monotone_segment(cv2,p23,Arr_traits_2::MIN_ENDPOINT,
std::back_inserter(segs));
- // Construct a vertical cusp x^2-y^3=0
- Curve_2 cv2 = construct_curve(CGAL::ipower(x,2)-CGAL::ipower(y,3));
+ // Construct another conic: y^2-x^2+1
+ Curve_2 cv3 = construct_curve(CGAL::ipower(y,2)-CGAL::ipower(x,2)+1);
- // Construct a segment containing the cusp point.
- // This adds to X_monotone_curve_2 objects to the vector,
- // because the cusp is a critical point
- Point_2 p21 = construct_point(Algebraic_real_1(-2),cv2,0);
- Point_2 p22 = construct_point(Algebraic_real_1(2),cv2,0);
- construct_x_monotone_segment(cv2,p21,p22,std::back_inserter(segs));
+ Point_2 p31 = construct_point(Algebraic_real_1(2),cv3,1);
+ construct_x_monotone_segment(cv3,p31,Arr_traits_2::MAX_ENDPOINT,
+ std::back_inserter(segs));
- // Construct an unbounded curve, starting at x=3
- Point_2 p23 = construct_point(Algebraic_real_1(3),cv2,0);
- construct_x_monotone_segment(cv2,p23,Arr_traits_2::MIN_ENDPOINT,
- std::back_inserter(segs));
+ // Construct a vertical segment
+ Point_2 v1 = construct_point(0,0);
+ Point_2 v2 = construct_point(Algebraic_real_1(0),cv1,1);
+ construct_x_monotone_segment(v1,v2,std::back_inserter(segs));
- // Construct another conic: y^2-x^2+1
- Curve_2 cv3 = construct_curve(CGAL::ipower(y,2)-CGAL::ipower(x,2)+1);
+ CGAL::insert(arr,segs.begin(),segs.end());
- Point_2 p31 = construct_point(Algebraic_real_1(2),cv3,1);
- construct_x_monotone_segment(cv3,p31,Arr_traits_2::MAX_ENDPOINT,
- std::back_inserter(segs));
+ // Add some isolated points (must be wrapped into CGAL::Object)
+ std::vector isolated_points;
+ isolated_points.push_back
+ (CGAL::make_object(construct_point(Algebraic_real_1(2),cv3,0)));
+ isolated_points.push_back
+ (CGAL::make_object(construct_point(Integer(1),Integer(5))));
+ isolated_points.push_back
+ (CGAL::make_object(construct_point(Algebraic_real_1(-1),
+ Algebraic_real_1(5))));
- // Construct a vertical segment
- Point_2 v1 = construct_point(0,0);
- Point_2 v2 = construct_point(Algebraic_real_1(0),cv1,1);
- construct_x_monotone_segment(v1,v2,std::back_inserter(segs));
+ CGAL::insert(arr,isolated_points.begin(), isolated_points.end());
- CGAL::insert(arr,segs.begin(),segs.end());
+ // Print the arrangement size.
+ std::cout << "The arrangement size:" << std::endl
+ << " V = " << arr.number_of_vertices()
+ << ", E = " << arr.number_of_edges()
+ << ", F = " << arr.number_of_faces() << std::endl;
- // Add some isolated points (must be wrapped into CGAL::Object)
- std::vector isolated_points;
- isolated_points.push_back
- (CGAL::make_object(construct_point(Algebraic_real_1(2),cv3,0)));
- isolated_points.push_back
- (CGAL::make_object(construct_point(Integer(1),Integer(5))));
- isolated_points.push_back
- (CGAL::make_object(construct_point(Algebraic_real_1(-1),
- Algebraic_real_1(5))));
-
- CGAL::insert(arr,isolated_points.begin(), isolated_points.end());
-
- // Print the arrangement size.
- std::cout << "The arrangement size:" << std::endl
- << " V = " << arr.number_of_vertices()
- << ", E = " << arr.number_of_edges()
- << ", F = " << arr.number_of_faces() << std::endl;
-
- return 0;
+ return 0;
}
#endif
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
index a28f94b838b..08e312a7e83 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
@@ -8,16 +8,20 @@
#include
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
-typedef CGAL::Arr_segment_traits_2 Traits_2;
-typedef Traits_2::Point_2 Point_2;
-typedef Traits_2::X_monotone_curve_2 Segment_2;
-typedef CGAL::Arrangement_2 Arrangement_2;
-typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
-typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
-typedef Arrangement_2::Face_const_handle Face_const_handle;
-typedef std::pair Object_pair;
-typedef std::pair Vert_decomp_entry;
-typedef std::list Vert_decomp_list;
+typedef CGAL::Arr_segment_traits_2 Traits_2;
+typedef Traits_2::Point_2 Point_2;
+typedef Traits_2::X_monotone_curve_2 Segment_2;
+typedef CGAL::Arrangement_2 Arrangement_2;
+typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
+typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
+typedef Arrangement_2::Face_const_handle Face_const_handle;
+
+typedef boost::variant Cell_type;
+typedef boost::optional Vert_decomp_type;
+typedef std::pair Vert_decomp_pair;
+typedef std::pair Vert_decomp_entry;
+typedef std::list Vert_decomp_list;
int main()
{
@@ -39,34 +43,41 @@ int main()
CGAL::decompose(arr, std::back_inserter(vd_list));
// Print the results.
- Vert_decomp_list::const_iterator vd_iter;
- for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
- const Object_pair& curr = vd_iter->second;
+ for (auto vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
+ const Vert_decomp_pair& curr = vd_iter->second;
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
- Vertex_const_handle vh;
- Halfedge_const_handle hh;
- Face_const_handle fh;
-
std::cout << " feature below: ";
- if (CGAL::assign(hh, curr.first))
- std::cout << '[' << hh->curve() << ']';
- else if (CGAL::assign(vh, curr.first))
- std::cout << '(' << vh->point() << ')';
- else if (CGAL::assign(fh, curr.first))
- std::cout << "NONE";
- else
- std::cout << "EMPTY";
+ if (! curr.first) std::cout << "EMPTY";
+ else {
+ auto* vh = boost::get(&*(curr.first));
+ if (vh) std::cout << '(' << (*vh)->point() << ')';
+ else {
+ auto* hh = boost::get(&*(curr.first));
+ if (hh) std::cout << '[' << (*hh)->curve() << ']';
+ else {
+ auto* fh = boost::get(&*(curr.first));
+ CGAL_assertion(fh);
+ std::cout << "NONE (" << (*fh)->is_unbounded() << ")";
+ }
+ }
+ }
std::cout << " feature above: ";
- if (CGAL::assign(hh, curr.second))
- std::cout << '[' << hh->curve() << ']' << std::endl;
- else if (CGAL::assign(vh, curr.second))
- std::cout << '(' << vh->point() << ')' << std::endl;
- else if (CGAL::assign(fh, curr.second))
- std::cout << "NONE" << std::endl;
- else
- std::cout << "EMPTY" << std::endl;
+ if (! curr.second) std::cout << "EMPTY" << std::endl;
+ else {
+ auto* vh = boost::get(&*(curr.second));
+ if (vh) std::cout << '(' << (*vh)->point() << ')' << std::endl;
+ else {
+ auto* hh = boost::get(&*(curr.second));
+ if (hh) std::cout << '[' << (*hh)->curve() << ']' << std::endl;
+ else {
+ auto* fh = boost::get(&*(curr.second));
+ CGAL_assertion(fh);
+ std::cout << "NONE (" << (*fh)->is_unbounded() << ")" << std::endl;
+ }
+ }
+ }
}
return 0;
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
index bed7aead09d..2ab2edbdc96 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
@@ -33,16 +33,18 @@ typedef CGAL::Arr_Bezier_curve_traits_2
typedef Bezier_traits::Curve_2 Bezier_curve_2;
typedef Bezier_traits::X_monotone_curve_2 Bezier_x_curve_2;
typedef CGAL::Arr_polycurve_traits_2 Polycurve_bezier_traits_2;
+typedef Polycurve_bezier_traits_2::Point_2 Point_2;
typedef Polycurve_bezier_traits_2::X_monotone_curve_2 X_mono_polycurve;
typedef CGAL::Arrangement_2 Arrangement_2;
+typedef boost::variant Make_x_monotone_result;
+
int main()
{
Polycurve_bezier_traits_2 pc_traits;
Bezier_traits bezier_traits;
- Polycurve_bezier_traits_2::Construct_x_monotone_curve_2
- construct_x_mono_polycurve =
+ auto construct_x_mono_polycurve =
pc_traits.construct_x_monotone_curve_2_object();
std::vector x_bezier_curves;
@@ -69,11 +71,11 @@ int main()
// Read the current curve (specified by its control points).
in_file >> B;
//convert it into x-monotone bezier curve.
- std::vector obj_vector;
+ std::vector obj_vector;
bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector));
- Bezier_x_curve_2 x_seg =
- CGAL::object_cast((obj_vector[0]));
- x_curves.push_back(x_seg);
+ auto* x_seg_p = boost::get(&obj_vector[0]);
+ CGAL_assertion(x_seg_p);
+ x_curves.push_back(*x_seg_p);
}
X_mono_polycurve polycurve =
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
index ef04deb25ce..230c6d7694b 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
@@ -8,19 +8,22 @@
#include
#include
-typedef CGAL::MP_Float Number_type;
-typedef CGAL::Cartesian Kernel;
-typedef CGAL::Arr_linear_traits_2 Traits_2;
-typedef Traits_2::Point_2 Point_2;
-typedef Traits_2::X_monotone_curve_2 Segment_2;
-typedef CGAL::Arrangement_2 Arrangement_2;
-typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
-typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
-typedef Arrangement_2::Face_const_handle Face_const_handle;
+typedef CGAL::MP_Float Number_type;
+typedef CGAL::Cartesian Kernel;
+typedef CGAL::Arr_linear_traits_2 Traits_2;
+typedef Traits_2::Point_2 Point_2;
+typedef Traits_2::X_monotone_curve_2 Segment_2;
+typedef CGAL::Arrangement_2 Arrangement_2;
+typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
+typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
+typedef Arrangement_2::Face_const_handle Face_const_handle;
-typedef std::pair >
- Vert_decomp_entry;
-typedef std::list Vert_decomp_list;
+typedef boost::variant Cell_type;
+typedef boost::optional Vert_decomp_type;
+typedef std::pair Vert_decomp_pair;
+typedef std::pair Vert_decomp_entry;
+typedef std::list Vert_decomp_list;
int main ()
{
@@ -43,37 +46,37 @@ int main ()
CGAL::decompose (arr, std::back_inserter(vd_list));
// Print the results.
- Vert_decomp_list::const_iterator vd_iter;
- std::pair curr;
- Vertex_const_handle vh;
- Halfedge_const_handle hh;
- Face_const_handle fh;
-
- for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
- curr = vd_iter->second;
+ for (auto vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
+ const Vert_decomp_pair& curr = vd_iter->second;
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
std::cout << " feature below: ";
- if (CGAL::assign (vh, curr.first))
- std::cout << '(' << vh->point() << ')';
- else if (CGAL::assign (hh, curr.first))
- if (!hh->is_fictitious())
- std::cout << '[' << hh->curve() << ']';
- else
- std::cout << "NONE";
- else
- std::cout << "EMPTY";
+ if (! curr.first) std::cout << "EMPTY";
+ else {
+ auto* vh = boost::get(&*(curr.first));;
+ if (vh) std::cout << '(' << (*vh)->point() << ')';
+ else {
+ auto* hh = boost::get(&*(curr.first));
+ CGAL_assertion(hh);
+ if (! (*hh)->is_fictitious())
+ std::cout << '[' << (*hh)->curve() << ']';
+ else std::cout << "NONE";
+ }
+ }
std::cout << " feature above: ";
- if (CGAL::assign (vh, curr.second))
- std::cout << '(' << vh->point() << ')' << std::endl;
- else if (CGAL::assign (hh, curr.second))
- if (!hh->is_fictitious())
- std::cout << '[' << hh->curve() << ']' << std::endl;
- else
- std::cout << "NONE" << std::endl;
- else
- std::cout << "EMPTY" << std::endl;
+ if (! curr.second) std::cout << "EMPTY" << std::endl;
+ else {
+ auto* vh = boost::get(&*(curr.second));;
+ if (vh) std::cout << '(' << (*vh)->point() << ')' << std::endl;
+ else {
+ auto* hh = boost::get(&*(curr.second));
+ CGAL_assertion(hh);
+ if (! (*hh)->is_fictitious())
+ std::cout << '[' << (*hh)->curve() << ']' << std::endl;
+ else std::cout << "NONE" << std::endl;
+ }
+ }
}
return 0;
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h
index 36b46416572..243fbbf705a 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h
@@ -7,9 +7,9 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
-// Author(s) : Ron Wein
-// Iddo Hanniel
-// Waqar Khan
+// Author(s): Ron Wein
+// Iddo Hanniel
+// Waqar Khan
#ifndef CGAL_ARR_BEZIER_CURVE_TRAITS_2_H
#define CGAL_ARR_BEZIER_CURVE_TRAITS_2_H
@@ -163,7 +163,7 @@ public:
}
//@}
- /// \name Functor definitions for the arrangement traits.
+ /// \name Basic functor definitions for the arrangement traits
//@{
/*! \class Compare_x_2
@@ -473,33 +473,34 @@ public:
{
return (Equal_2 (p_cache));
}
+ //@}
+
+ //! \name Intersections, subdivisions, and mergings
+ //@{
/*! \class Make_x_monotone_2
- * The Make_x_monotone_2 functor.
+ * A functor for subdividing a curve into x-monotone curves.
*/
- class Make_x_monotone_2
- {
+ class Make_x_monotone_2 {
private:
- Bezier_cache *p_cache;
+ Bezier_cache* p_cache;
public:
-
/*! Constructor. */
- Make_x_monotone_2 (Bezier_cache *cache) :
- p_cache (cache)
- {}
+ Make_x_monotone_2(Bezier_cache* cache) : p_cache(cache) {}
- /*!
- * Cut the given Bezier curve into x-monotone subcurves and insert them
- * into the given output iterator.
- * \param cv The curve.
- * \param oi The output iterator, whose value-type is Object. The returned
- * objects is a wrapper for an X_monotone_curve_2 object.
- * \return The past-the-end iterator.
+ /*! Subdivide a given Bezier curve into x-monotone subcurves and insert them
+ * into a given output iterator.
+ * \param cv the curve.
+ * \param oi an output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return the past-the-end iterator.
*/
- template
+ template
OutputIterator operator() (const Curve_2& B, OutputIterator oi) const
{
+ typedef boost::variant
+ Make_x_monotone_result;
typedef typename Bounding_traits::Vertical_tangency_point
Vertical_tangency_point;
@@ -512,20 +513,17 @@ public:
std::back_inserter(cpts));
bound_tr.compute_vertical_tangency_points
- (cpts, std::back_inserter (vpt_bounds));
+ (cpts, std::back_inserter (vpt_bounds));
// Construct Point_2 from bounded tangency points.
std::list vpts;
bool app_ok = true;
- typename std::list::const_iterator iter;
- for (iter = vpt_bounds.begin(); iter != vpt_bounds.end(); ++iter)
- {
+ for (auto iter = vpt_bounds.begin(); iter != vpt_bounds.end(); ++iter) {
const typename Bounding_traits::Bez_point_bound& bound = iter->bound;
const typename Bounding_traits::Bez_point_bbox& bbox = iter->bbox;
- if (! bound.can_refine)
- {
+ if (! bound.can_refine) {
// If we cannot refine the vertical-tangency bound anymore, then
// we failed to bound the vertical tangency point.
// \todo In the future, we might want to use the info.
@@ -534,28 +532,25 @@ public:
}
// Construct an approximate vertical tangency point.
- Point_2 pt;
+ Point_2 pt;
- if (bound.type == Bounding_traits::Bez_point_bound::RATIONAL_PT)
- {
+ if (bound.type == Bounding_traits::Bez_point_bound::RATIONAL_PT) {
CGAL_assertion (CGAL::compare (bound.t_min, bound.t_max) == EQUAL);
- Rational t0 = bound.t_min;
+ Rational t0 = bound.t_min;
pt = Point_2 (B, t0);
}
- else
- {
- pt.add_originator (typename Point_2::Originator(B, bound));
+ else {
+ pt.add_originator(typename Point_2::Originator(B, bound));
}
- pt.set_bbox (bbox);
+ pt.set_bbox(bbox);
vpts.push_back(pt);
}
// If bounding the approximated vertical-tangency points went fine,
// use these points as endpoint for the x-monotone subcurves.
- if (app_ok)
- {
+ if (app_ok) {
// Create the x-monotone subcurves with approximate endpoints.
typename std::list::const_iterator pit;
unsigned int xid = 1; // Serial number of the subcurve.
@@ -563,19 +558,16 @@ public:
// Note: xid is needed in ctr of p0 (and of p1 below),
// for handling end case of start point == end point.
- for (pit = vpts.begin(); pit != vpts.end(); ++pit)
- {
- *oi++ = CGAL::make_object (X_monotone_curve_2 (B, xid,
- p0, *pit,
- *p_cache));
+ for (pit = vpts.begin(); pit != vpts.end(); ++pit) {
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(B, xid, p0, *pit,
+ *p_cache));
xid++;
p0 = *pit;
}
Point_2 p1(B, xid, Rational(1)); // A rational end point.
- *oi++ = CGAL::make_object (X_monotone_curve_2 (B, xid,
- p0, p1,
- *p_cache));
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(B, xid, p0, p1,
+ *p_cache));
return (oi);
}
@@ -583,41 +575,34 @@ public:
// points in an exact manner. We do this by considering all t-values
// on B(t) = (X(t), Y(t)), such that X'(t) = 0.
const typename Bezier_cache::Vertical_tangency_list&
- vt_list = p_cache->get_vertical_tangencies (B.id(),
- B.x_polynomial(),
- B.x_norm());
+ vt_list = p_cache->get_vertical_tangencies(B.id(), B.x_polynomial(),
+ B.x_norm());
// Create the x-monotone subcurves.
- Point_2 p1;
- typename Bezier_cache::Vertical_tangency_iter it;
- unsigned int xid = 1; // Serial number of the subcurve.
- Point_2 p0 (B, xid, Rational(0));
+ Point_2 p1;
+ unsigned int xid = 1; // Serial number of the subcurve.
+ Point_2 p0(B, xid, Rational(0));
- for (it = vt_list.begin(); it != vt_list.end(); ++it)
- {
- p1 = Point_2 (B, *it);
- *oi++ = CGAL::make_object (X_monotone_curve_2 (B, xid,
- p0, p1,
- *p_cache));
+ for (auto it = vt_list.begin(); it != vt_list.end(); ++it) {
+ p1 = Point_2(B, *it);
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(B, xid, p0, p1,
+ *p_cache));
xid++;
p0 = p1;
}
// Create the final subcurve.
- p1 = Point_2 (B, xid, Rational(1));
- *oi++ = CGAL::make_object (X_monotone_curve_2 (B, xid,
- p0, p1,
- *p_cache));
- return (oi);
+ p1 = Point_2(B, xid, Rational(1));
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(B, xid, p0, p1,
+ *p_cache));
+ return oi;
}
};
/*! Get a Make_x_monotone_2 functor object. */
- Make_x_monotone_2 make_x_monotone_2_object () const
- {
- return (Make_x_monotone_2 (p_cache));
- }
+ Make_x_monotone_2 make_x_monotone_2_object() const
+ { return (Make_x_monotone_2 (p_cache)); }
/*! \class Split_2
* The Split_2 functor.
@@ -756,7 +741,6 @@ public:
{
return Merge_2(this);
}
-
//@}
/// \name Functor definitions for the Boolean set-operation traits.
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h
index 0397cd07f67..dbbc07dbad9 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h
@@ -22,6 +22,7 @@
*/
#include
+#include
namespace CGAL {
@@ -60,6 +61,9 @@ private:
typedef typename Arrangement_2::DInner_ccb DInner_ccb;
typedef typename Arrangement_2::DIso_vertex DIso_vertex;
+ typedef Arr_point_location_result Pl_result;
+ typedef typename Pl_result::Type Pl_result_type;
+
private:
Arrangement_2* p_arr; // The associated arrangement.
@@ -99,33 +103,29 @@ public:
* This object may wrap a Face_const_handle (the general case),
* or a Halfedge_const_handle (in case of an overlap).
*/
- CGAL::Object locate_curve_end(const X_monotone_curve_2& cv,
- Arr_curve_end ind,
- Arr_parameter_space ps_x,
- Arr_parameter_space ps_y) const
+ Pl_result_type locate_curve_end(const X_monotone_curve_2& cv,
+ Arr_curve_end ind,
+ Arr_parameter_space ps_x,
+ Arr_parameter_space ps_y) const
{
CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
// Use the topology traits to locate the unbounded curve end.
- CGAL::Object obj =
- p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y);
+ auto obj = p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y);
// Return a handle to the DCEL feature.
- DFace* f;
- if (CGAL::assign(f, obj))
- return (CGAL::make_object(p_arr->_const_handle_for(f)));
+ DFace** f_p = boost::get(&obj);
+ if (f_p) return (Pl_result::make_result(p_arr->_const_handle_for(*f_p)));
- DHalfedge* he;
- if (CGAL::assign(he, obj))
- return (CGAL::make_object(p_arr->_const_handle_for(he)));
+ DHalfedge** he_p = boost::get(&obj);
+ if (he_p) return (Pl_result::make_result(p_arr->_const_handle_for(*he_p)));
- DVertex* v;
- if (CGAL::assign(v, obj))
- return (CGAL::make_object(p_arr->_const_handle_for(v)));
+ DVertex** v_p = boost::get(&obj);
+ if (v_p) return (Pl_result::make_result(p_arr->_const_handle_for(*v_p)));
// We should never reach here:
CGAL_error();
- return Object();
+ return Pl_result::make_result(Vertex_const_handle());
}
/*!
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h
index 5a3384145d2..5a3f2baa7b0 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h
@@ -8,7 +8,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
-// Author(s) : Michael Kerber
+// Author(s): Michael Kerber
//
// ============================================================================
@@ -264,138 +264,141 @@ public:
}
- template OutputIterator
- x_monotone_segment (Curve_2 cv,
- Point_2 p,
- boost::optional start,
- boost::optional end,
- OutputIterator out) const {
+ template OutputIterator
+ x_monotone_segment(Curve_2 cv,
+ Point_2 p,
+ boost::optional start,
+ boost::optional end,
+ OutputIterator out) const
+ {
+ typedef boost::variant
+ Make_x_monotone_result;
+ //CGAL_assertion(is_one_one(cv,p));
- //CGAL_assertion(is_one_one(cv,p));
+ std::list segs;
- std::list segs;
-
- Is_on_2 on_arc
- = this->_ckva()->is_on_2_object();
- Construct_min_vertex_2 left
- = this->_ckva()->construct_min_vertex_2_object();
- Construct_max_vertex_2 right
- = this->_ckva()->construct_max_vertex_2_object();
- Equal_2 equal = this->_ckva()->equal_2_object();
-
- std::vector arcs;
- this->_ckva()->make_x_monotone_2_object()
- (cv,std::back_inserter(arcs));
- typename std::vector::const_iterator
- it = arcs.begin(),helper;
- X_monotone_curve_2 it_seg;
- CGAL::assign(it_seg,*it);
- while(it!=arcs.end()) {
- if( on_arc(p,it_seg) ) {
- break;
- }
- CGAL_assertion(it!=arcs.end());
- it++;
- CGAL::assign(it_seg,*it);
- }
-
- bool left_on_arc = start && on_arc(start.get(),it_seg);
- bool right_on_arc = end && on_arc(end.get(),it_seg);
-
- if( left_on_arc && right_on_arc ) {
- segs.push_back(it_seg.trim(start.get(),end.get()));
- }
- if(left_on_arc && (!right_on_arc)) {
- if(!it_seg.is_finite(CGAL::ARR_MAX_END) ||
- !equal(start.get(),right(it_seg))) {
- if(it_seg.is_finite(CGAL::ARR_MIN_END) && equal(start.get(),left(it_seg))) {
- segs.push_back(it_seg);
- } else {
- X_monotone_curve_2 split1,split2;
- it_seg.split(start.get(),split1,split2);
- segs.push_back(split2);
- }
- }
- }
- if((!left_on_arc) && right_on_arc) {
- if(!it_seg.is_finite(CGAL::ARR_MIN_END) ||
- ! equal(left(it_seg),end.get())) {
- if(it_seg.is_finite(CGAL::ARR_MAX_END) && equal(end.get(),right(it_seg))) {
- segs.push_back(it_seg);
- } else {
- X_monotone_curve_2 split1,split2;
- it_seg.split(end.get(),split1,split2);
- segs.push_back(split1);
- }
- }
- }
- if( (!left_on_arc) && (!right_on_arc)) {
- segs.push_back(it_seg);
- }
- helper=it; // for later usage
-
- if(! left_on_arc) {
-
- Point_2 point_it;
- while(true) {
- if(it_seg.is_finite(CGAL::ARR_MIN_END) &&
- is_one_one(cv,left(it_seg) ) ) {
- point_it=left(it_seg);
- } else {
- CGAL_assertion(! start);
- break;
- }
- CGAL_assertion(it!=arcs.begin());
- it--;
- CGAL::assign(it_seg,*it);
- while(! on_arc(point_it,it_seg)) {
- CGAL_assertion(it!=arcs.begin());
- it--;
- CGAL::assign(it_seg,*it);
- }
- if(start && on_arc(start.get(),it_seg)) {
- segs.push_front(it_seg.trim(start.get(),
- right(it_seg)));
- break;
- } else {
- segs.push_front(it_seg);
- }
- }
- }
- if(! right_on_arc) {
- it=helper; // reset
- CGAL::assign(it_seg,*it);
- Point_2 point_it;
- while(true) {
- if(it_seg.is_finite(CGAL::ARR_MAX_END) &&
- is_one_one(cv,right(it_seg) ) ) {
- point_it=right(it_seg);
- } else {
- CGAL_assertion(! end);
- break;
- }
- it++;
- CGAL_assertion(it!=arcs.end());
- CGAL::assign(it_seg,*it);
- while(! on_arc(point_it,it_seg)) {
- it++;
- CGAL_assertion(it!=arcs.end());
- CGAL::assign(it_seg,*it);
- }
- if(end && on_arc(end.get(),it_seg)) {
- segs.push_back(it_seg.trim(left(it_seg),end.get()));
- break;
- } else {
- segs.push_back(it_seg);
- }
- }
- }
-
- std::copy(segs.begin(),segs.end(),out);
- return out;
+ Is_on_2 on_arc = this->_ckva()->is_on_2_object();
+ auto left = this->_ckva()->construct_min_vertex_2_object();
+ auto right = this->_ckva()->construct_max_vertex_2_object();
+ Equal_2 equal = this->_ckva()->equal_2_object();
+ std::vector arcs;
+ this->_ckva()->make_x_monotone_2_object()(cv, std::back_inserter(arcs));
+ auto it = arcs.begin();
+ auto helper = it;
+ const auto* it_seg_p = boost::get(&(*it));
+ while (it != arcs.end()) {
+ if ( on_arc(p, *it_seg_p) ) break;
+ it++;
+ it_seg_p = boost::get(&(*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);
+
+ if ( left_on_arc && right_on_arc ) {
+ segs.push_back(it_seg_p->trim(start.get(),end.get()));
+ }
+ if (left_on_arc && (!right_on_arc)) {
+ if (!it_seg_p->is_finite(CGAL::ARR_MAX_END) ||
+ !equal(start.get(),right(*it_seg_p))) {
+ if (it_seg_p->is_finite(CGAL::ARR_MIN_END) &&
+ equal(start.get(),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);
+ 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()))
+ {
+ if (it_seg_p->is_finite(CGAL::ARR_MAX_END) &&
+ equal(end.get(), 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);
+ segs.push_back(split1);
+ }
+ }
+ }
+ if ( (!left_on_arc) && (!right_on_arc)) {
+ segs.push_back(*it_seg_p);
+ }
+ helper = it; // for later usage
+
+ if (! left_on_arc) {
+
+ Point_2 point_it;
+ while (true) {
+ if (it_seg_p->is_finite(CGAL::ARR_MIN_END) &&
+ is_one_one(cv, left(*it_seg_p) ) ) {
+ point_it = left(*it_seg_p);
+ } else {
+ CGAL_assertion(! start);
+ break;
+ }
+ CGAL_assertion(it != arcs.begin());
+ it--;
+ it_seg_p = boost::get(&(*it));
+ while (! on_arc(point_it, *it_seg_p)) {
+ CGAL_assertion(it != arcs.begin());
+ it--;
+ it_seg_p = boost::get(&(*it));
+ }
+ if (start && on_arc(start.get(),*it_seg_p)) {
+ segs.push_front(it_seg_p->trim(start.get(), right(*it_seg_p)));
+ break;
+ }
+ else {
+ segs.push_front(*it_seg_p);
+ }
+ }
+ }
+ if (! right_on_arc) {
+ it = helper; // reset
+ it_seg_p = boost::get(&(*it));
+ Point_2 point_it;
+ while (true) {
+ if (it_seg_p->is_finite(CGAL::ARR_MAX_END) &&
+ is_one_one(cv,right(*it_seg_p) ) )
+ {
+ point_it=right(*it_seg_p);
+ } else {
+ CGAL_assertion(! end);
+ break;
+ }
+ it++;
+ CGAL_assertion(it != arcs.end());
+ it_seg_p = boost::get(&(*it));
+ while(! on_arc(point_it, *it_seg_p)) {
+ it++;
+ CGAL_assertion(it != arcs.end());
+ it_seg_p = boost::get(&(*it));
+ }
+ if(end && on_arc(end.get(),*it_seg_p)) {
+ segs.push_back(it_seg_p->trim(left(*it_seg_p),end.get()));
+ break;
+ }
+ else {
+ segs.push_back(*it_seg_p);
+ }
+ }
+ }
+
+ std::copy(segs.begin(), segs.end(), out);
+ return out;
+
+ }
+
public:
template OutputIterator
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h
index e526a7ae2b9..af328f1d6e6 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h
@@ -41,11 +41,9 @@ namespace Ss2 = Surface_sweep_2;
* \param oi Output: An output iterator for the query results.
* \pre The value-type of PointsIterator is Arrangement::Point_2,
* and the value-type of OutputIterator is is pair,
- * where Result is either
- * (i) Object or
- * (ii) boost::optional >.
+ * where Result is boost::optional >.
* It represents the arrangement feature containing the point.
*/
template
-// Efi Fogel
-// Eric Berberich
+// Author(s): Ron Wein
+// Efi Fogel
+// Eric Berberich
#ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
#define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H
+#include
+
#include
#include
@@ -306,17 +307,18 @@ public:
* \param ps_x The boundary condition of the curve end in x.
* \param ps_y The boundary condition of the curve end in y.
* \pre The curve has a boundary condition in either x or y.
- * \return An object that contains the curve end.
+ * \return An object that wraps the curve end.
*/
- CGAL::Object place_boundary_vertex(Face*,
- const X_monotone_curve_2&,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */)
+ boost::optional >
+ place_boundary_vertex(Face*,
+ const X_monotone_curve_2&,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */)
{
// This function should never be called:
CGAL_error();
- return Object();
+ return boost::none;
}
/*! Locate the predecessor halfedge for the given curve around a given
@@ -349,14 +351,17 @@ public:
* \pre The curve end is incident to the boundary.
* \return An object that contains the curve end.
*/
- CGAL::Object locate_curve_end(const X_monotone_curve_2&,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */)
+ boost::variant
+ locate_curve_end(const X_monotone_curve_2&,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */)
{
+ typedef boost::variant Result;
// This function should never be called:
CGAL_error();
- return Object();
+ Vertex* v(nullptr);
+ return Result(v);
}
/*! Split a fictitious edge using the given vertex.
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h
index 2b5a25cd5e0..8364ffc5cd3 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h
@@ -378,46 +378,47 @@ public:
}
//@}
- /// \name Functor definitions for supporting intersections.
+ /// \name Intersections, subdivisions, and mergings
//@{
- class Make_x_monotone_2
- {
+ /*! \class
+ * A functor for subdividing a curve into x-monotone curves.
+ */
+ class Make_x_monotone_2 {
private:
typedef Arr_circle_segment_traits_2 Self;
bool m_use_cache;
public:
+ Make_x_monotone_2(bool use_cache = false) : m_use_cache(use_cache) {}
- Make_x_monotone_2(bool use_cache = false) : m_use_cache(use_cache)
- {}
-
- /*!
- * Cut the given conic curve (ocv.is_in_x_range (p)r conic arc) into x-monotone subcurves
- * and insert them to the given output iterator.
- * \param cv The curve.
- * \param oi The output iterator, whose value-type is Object. The returned
- * objects are all wrcv.is_in_x_range (p)appers X_monotone_curve_2 objects.
- * \return The past-the-end iterator.
+ /*! Subdivide a given circular arc or line segment into x-monotone subcurves
+ * and insert them to a given output iterator.
+ * \param cv the curve.
+ * \param oi the output iterator for the result. Its dereference type is a
+ * variant that wraps a \c Point_2 or an \c X_monotone_curve_2
+ * objects.
+ * \return the past-the-end iterator.
*/
- template
- OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const
+ template
+ OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
+ typedef boost::variant
+ Make_x_monotone_result;
+
// Increment the serial number of the curve cv, which will serve as its
// unique identifier.
- unsigned int index = 0;
- if(m_use_cache)
- index = Self::get_index();
+ unsigned int index = 0;
+ if (m_use_cache) index = Self::get_index();
- if (cv.orientation() == COLLINEAR)
- {
+ if (cv.orientation() == COLLINEAR) {
// The curve is a line segment.
- *oi = make_object (X_monotone_curve_2 (cv.supporting_line(),
- cv.source(), cv.target(),
- index));
- ++oi;
- return (oi);
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv.supporting_line(),
+ cv.source(),
+ cv.target(),
+ index));
+ return oi;
}
// Check the case of a degenrate circle (a point).
@@ -425,12 +426,11 @@ public:
CGAL::Sign sign_rad = CGAL::sign (circ.squared_radius());
CGAL_precondition (sign_rad != NEGATIVE);
- if (sign_rad == ZERO)
- {
+ if (sign_rad == ZERO) {
// Create an isolated point.
- *oi = make_object (Point_2 (circ.center().x(), circ.center().y()));
- ++oi;
- return (oi);
+ *oi++ = Make_x_monotone_result(Point_2(circ.center().x(),
+ circ.center().y()));
+ return oi;
}
// The curve is circular: compute the to vertical tangency points
@@ -438,84 +438,73 @@ public:
Point_2 vpts[2];
unsigned int n_vpts = cv.vertical_tangency_points (vpts);
- if (cv.is_full())
- {
+ if (cv.is_full()) {
CGAL_assertion (n_vpts == 2);
// Subdivide the circle into two arcs (an upper and a lower half).
- *oi = make_object (X_monotone_curve_2 (circ,
- vpts[0], vpts[1],
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ vpts[0], vpts[1],
+ cv.orientation(),
+ index));
- *oi = make_object (X_monotone_curve_2 (circ,
- vpts[1], vpts[0],
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ vpts[1], vpts[0],
+ cv.orientation(),
+ index));
}
- else
- {
+ else {
// Act according to the number of vertical tangency points.
- if (n_vpts == 2)
- {
+ if (n_vpts == 2) {
// Subdivide the circular arc into three x-monotone arcs.
- *oi = make_object (X_monotone_curve_2 (circ,
- cv.source(), vpts[0],
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ cv.source(), vpts[0],
+ cv.orientation(),
+ index));
- *oi = make_object (X_monotone_curve_2 (circ,
- vpts[0], vpts[1],
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ vpts[0], vpts[1],
+ cv.orientation(),
+ index));
- *oi = make_object (X_monotone_curve_2 (circ,
- vpts[1], cv.target(),
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ vpts[1],
+ cv.target(),
+ cv.orientation(),
+ index));
}
- else if (n_vpts == 1)
- {
+ else if (n_vpts == 1) {
// Subdivide the circular arc into two x-monotone arcs.
- *oi = make_object (X_monotone_curve_2 (circ,
- cv.source(), vpts[0],
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ cv.source(),
+ vpts[0],
+ cv.orientation(),
+ index));
- *oi = make_object (X_monotone_curve_2 (circ,
- vpts[0], cv.target(),
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ vpts[0],
+ cv.target(),
+ cv.orientation(),
+ index));
}
- else
- {
- CGAL_assertion (n_vpts == 0);
+ else {
+ CGAL_assertion(n_vpts == 0);
// The arc is already x-monotone:
- *oi = make_object (X_monotone_curve_2 (circ,
- cv.source(), cv.target(),
- cv.orientation(),
- index));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ,
+ cv.source(),
+ cv.target(),
+ cv.orientation(),
+ index));
}
}
- return (oi);
+ return oi;
}
};
/*! Get a Make_x_monotone_2 functor object. */
- Make_x_monotone_2 make_x_monotone_2_object () const
- {
- return Make_x_monotone_2(m_use_cache);
- }
+ Make_x_monotone_2 make_x_monotone_2_object() const
+ { return Make_x_monotone_2(m_use_cache); }
class Split_2
{
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h
index a7d96844523..6827889a4f1 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h
@@ -27,6 +27,10 @@
* Arrangement_2 package, which it is now part of. It contains a traits
* class for the arrangement package that handles circular curves.
* It is based on the circular kernel.
+ *
+ * \todo Fix the circular-kernel make-x-monotone functor to use modern variant
+ * instead of the legacy CGAL::Object. Then, eliminate the special
+ * implementation here and directly use the kernel functor instead.
*/
#include
@@ -109,7 +113,7 @@ public:
typedef unsigned int Multiplicity;
typedef CGAL::Tag_false Has_left_category;
- typedef CGAL::Tag_false Has_merge_category;
+ typedef CGAL::Tag_false Has_merge_category;
typedef CGAL::Tag_false Has_do_intersect_category;
typedef Arr_oblivious_side_tag Left_side_category;
@@ -129,7 +133,7 @@ public:
typedef typename CircularKernel::Construct_circular_min_vertex_2
Construct_min_vertex_2;
typedef typename CircularKernel::Equal_2 Equal_2;
- typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
+ // typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
typedef typename CircularKernel::Split_2 Split_2;
typedef typename CircularKernel::Intersect_2 Intersect_2;
typedef typename CircularKernel::Is_vertical_2 Is_vertical_2;
@@ -149,8 +153,8 @@ public:
Equal_2 equal_2_object() const
{ return ck.equal_2_object(); }
- Make_x_monotone_2 make_x_monotone_2_object() const
- { return ck.make_x_monotone_2_object(); }
+ // Make_x_monotone_2 make_x_monotone_2_object() const
+ // { return ck.make_x_monotone_2_object(); }
Split_2 split_2_object() const
{ return ck.split_2_object(); }
@@ -168,6 +172,34 @@ public:
{ return ck.is_vertical_2_object(); }
+ //! A functor for subdividing curves into x-monotone curves.
+ class Make_x_monotone_2 {
+ public:
+ template
+ OutputIterator operator()(const Curve_2& arc, OutputIterator oi) const
+ {
+ typedef boost::variant
+ Make_x_monotone_result;
+
+ std::vector objs;
+ CircularKernel().make_x_monotone_2_object()(arc, std::back_inserter(objs));
+ for (const auto& obj : objs) {
+ if (const auto* p = CGAL::object_cast(&obj)) {
+ *oi++ = Make_x_monotone_result(*p);
+ continue;
+ }
+ if (const auto* xcv = CGAL::object_cast(&obj)) {
+ *oi++ = Make_x_monotone_result(*xcv);
+ continue;
+ }
+ CGAL_error();
+ }
+ return oi;
+ }
+ };
+
+ Make_x_monotone_2 make_x_monotone_2_object() const
+ { return Make_x_monotone_2(); }
};
} // namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h
index eb9acae74a8..db91adb57cf 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h
@@ -27,6 +27,10 @@
* Arrangement_2 package, which it is now part of. It contains a traits
* class for the arrangement package that handles circular and linear curves.
* It is based on the circular kernel.
+ *
+ * \todo Fix the circular-kernel make-x-monotone functor to use modern variant
+ * instead of the legacy CGAL::Object. Then, eliminate the special
+ * implementation here and directly use the kernel functor instead.
*/
#include
@@ -39,53 +43,35 @@
namespace CGAL {
namespace VariantFunctors{
- // Takes an iterator range of Object(Line/Circular_arc),
- // returns an Object(Variant(Line/Circular_arc)).
- // Do nothing for Object(Endpoint).
+ // Takes an iterator range of Object(Line/Circular_arc/Point),
+ // returns a variant of Line, Circular_arc, and Point_2.
template
OutputIterator
object_to_object_variant(const std::vector& res1,
OutputIterator res2)
{
- for (std::vector::const_iterator it = res1.begin();
- it != res1.end(); ++it ) {
- if (const Arc1 *arc = CGAL::object_cast< Arc1 >(&*it)){
- boost::variant< Arc1, Arc2 > v = *arc;
- *res2++ = make_object(v);
+ typedef typename CK::Circular_arc_point_2 Point_2;
+ typedef boost::variant X_monotone_curve_2;
+ typedef boost::variant
+ Make_x_monotone_result;
+
+ for (auto it = res1.begin(); it != res1.end(); ++it) {
+ if (const Arc1* arc = CGAL::object_cast(&*it)) {
+ boost::variant v = *arc;
+ *res2++ = Make_x_monotone_result(v);
}
- else if (const Arc2 *line = CGAL::object_cast< Arc2 >(&*it)){
- boost::variant< Arc1, Arc2 > v = *line;
- *res2++ = make_object(v);
+ else if (const Arc2* line = CGAL::object_cast(&*it)) {
+ boost::variant v = *line;
+ *res2++ = Make_x_monotone_result(v);
}
- else{
- *res2++ = *it;
+ else if (const Point_2* p = CGAL::object_cast(&*it)) {
+ *res2++ = Make_x_monotone_result(*p);
}
+ else CGAL_error();
}
return res2;
}
- template
- OutputIterator
- object_to_object_variant1(const std::vector& res,
- OutputIterator oi)
- {
- typedef IntersectionPoint Intersection_point;
- typedef XMonotoneCurve X_monotone_curve_2;
- typedef boost::variant
- Intersection_result;
-
- for (auto it = res.begin(); it != res.end(); ++it) {
- if (const Arc* arc = boost::get(&*it)) {
- X_monotone_curve_2 cv = *arc;
- *oi++ = Intersection_result(cv);
- }
- else *oi++ = Intersection_result(*it);
- }
- return oi;
- }
-
template
class Compare_y_to_right_2
{
@@ -147,17 +133,12 @@ namespace CGAL {
template
class Equal_2
-#ifndef CGAL_CFG_MATCHING_BUG_6
- : public
- CircularKernel::Equal_2
-#endif
+ : public CircularKernel::Equal_2
{
public:
typedef boost::variant< Arc1, Arc2 > Curve_2;
typedef bool result_type;
-#ifndef CGAL_CFG_MATCHING_BUG_6
using CircularKernel::Equal_2::operator();
-#else
typedef typename CircularKernel::Circular_arc_point_2
Circular_arc_point_2;
typedef typename CircularKernel::Line_arc_2 Line_arc_2;
@@ -185,8 +166,6 @@ namespace CGAL {
operator() ( const Circular_arc_2 &a0, const Line_arc_2 &a1) const
{ return false; }
-#endif
-
result_type
operator()(const Curve_2 &a0, const Curve_2 &a1) const
{
@@ -259,6 +238,7 @@ namespace CGAL {
};
+ //! A functor for subdividing curves into x-monotone curves.
template
class Make_x_monotone_2
{
@@ -268,20 +248,21 @@ namespace CGAL {
template < class OutputIterator,class Not_X_Monotone >
OutputIterator
- operator()(const boost::variant &A, OutputIterator res) const
+ operator()(const boost::variant &A,
+ OutputIterator res) const
{
- if ( const Arc1* arc1 = boost::get( &A ) ){
+ if ( const Arc1* arc1 = boost::get( &A ) ) {
std::vector container;
- CircularKernel()
- .make_x_monotone_2_object()(*arc1,std::back_inserter(container));
+ CircularKernel().
+ make_x_monotone_2_object()(*arc1,std::back_inserter(container));
return object_to_object_variant
(container, res);
}
else {
const Arc2* arc2 = boost::get( &A );
std::vector container;
- CircularKernel()
- .make_x_monotone_2_object()(*arc2,std::back_inserter(container));
+ CircularKernel().
+ make_x_monotone_2_object()(*arc2,std::back_inserter(container));
return object_to_object_variant
(container, res);
}
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h
index cc26c045a84..45c3a903ea7 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h
@@ -448,135 +448,127 @@ public:
}
//@}
- /// \name Functor definitions for supporting intersections.
+ /// \name Intersections, subdivisions, and mergings
//@{
- class Make_x_monotone_2
- {
+ /*! \class Make_x_monotone_2
+ * A functor for subdividing curves into x-monotone curves.
+ */
+ class Make_x_monotone_2 {
typedef Arr_conic_traits_2 Self;
- public:
- /*!
- * Cut the given conic curve (or conic arc) into x-monotone subcurves
- * and insert them to the given output iterator.
- * \param cv The curve.
- * \param oi The output iterator, whose value-type is Object. The returned
- * objects are all wrappers X_monotone_curve_2 objects.
- * \return The past-the-end iterator.
+ public:
+ /*! Subdivide a given conic curve (or conic arc) into x-monotone subcurves
+ * and insert them to a given output iterator.
+ * \param cv the curve.
+ * \param oi the output iterator for the result. Its dereference type is a
+ * variant that wraps a \c Point_2 or an \c X_monotone_curve_2
+ * objects.
+ * \return the past-the-end iterator.
*/
- template
- OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const
+ template
+ OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
+ typedef boost::variant
+ Make_x_monotone_result;
+
// Increment the serial number of the curve cv, which will serve as its
// unique identifier.
- unsigned int index = Self::get_index();
- Conic_id conic_id (index);
+ auto index = Self::get_index();
+ Conic_id conic_id(index);
// Find the points of vertical tangency to cv and act accordingly.
- typename Curve_2::Point_2 vtan_ps[2];
- int n_vtan_ps;
+ typename Curve_2::Point_2 vtan_ps[2];
+ int n_vtan_ps;
- n_vtan_ps = cv.vertical_tangency_points (vtan_ps);
+ n_vtan_ps = cv.vertical_tangency_points(vtan_ps);
- if (n_vtan_ps == 0)
- {
+ if (n_vtan_ps == 0) {
// In case the given curve is already x-monotone:
- *oi = make_object (X_monotone_curve_2 (cv, conic_id));
- ++oi;
- return (oi);
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, conic_id));
+ return oi;
}
// Split the conic arc into x-monotone sub-curves.
- if (cv.is_full_conic())
- {
+ if (cv.is_full_conic()) {
// Make sure we have two vertical tangency points.
CGAL_assertion(n_vtan_ps == 2);
// 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_object (X_monotone_curve_2 (cv, vtan_ps[0], vtan_ps[1],
- conic_id));
- ++oi;
- *oi = make_object (X_monotone_curve_2 (cv, vtan_ps[1], vtan_ps[0],
- conic_id));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, vtan_ps[0],
+ vtan_ps[1],
+ conic_id));
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, vtan_ps[1],
+ vtan_ps[0],
+ conic_id));
}
- else
- {
- if (n_vtan_ps == 1)
- {
+ 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_object (X_monotone_curve_2 (cv, cv.source(), vtan_ps[0],
- conic_id));
- ++oi;
- *oi = make_object (X_monotone_curve_2 (cv, vtan_ps[0], cv.target(),
- conic_id));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, cv.source(),
+ vtan_ps[0],
+ conic_id));
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, vtan_ps[0],
+ cv.target(),
+ conic_id));
}
- else
- {
- CGAL_assertion (n_vtan_ps == 2);
+ else {
+ CGAL_assertion(n_vtan_ps == 2);
// Identify the first point we encounter when going from cv's source
// to its target, and the second point we encounter. Note that the
// two endpoints must both be below the line connecting the two
// tangnecy points (or both lies above it).
- int ind_first = 0;
- int ind_second = 1;
- Alg_kernel_ ker;
- typename Alg_kernel_::Line_2 line =
- ker.construct_line_2_object() (vtan_ps[0], vtan_ps[1]);
- const Comparison_result start_pos =
+ int ind_first = 0;
+ int ind_second = 1;
+ Alg_kernel_ ker;
+ typename Alg_kernel_::Line_2 line =
+ ker.construct_line_2_object()(vtan_ps[0], vtan_ps[1]);
+ const Comparison_result start_pos =
ker.compare_y_at_x_2_object() (cv.source(), line);
- const Comparison_result order_vpts =
- ker.compare_x_2_object() (vtan_ps[0], vtan_ps[1]);
+ const Comparison_result order_vpts =
+ ker.compare_x_2_object()(vtan_ps[0], vtan_ps[1]);
- CGAL_assertion (start_pos != EQUAL &&
- ker.compare_y_at_x_2_object() (cv.target(),
- line) == start_pos);
- CGAL_assertion (order_vpts != EQUAL);
+ CGAL_assertion(start_pos != EQUAL &&
+ ker.compare_y_at_x_2_object()(cv.target(),
+ line) == start_pos);
+ CGAL_assertion(order_vpts != EQUAL);
- if ((cv.orientation() == COUNTERCLOCKWISE &&
- start_pos == order_vpts) ||
- (cv.orientation() == CLOCKWISE &&
- start_pos != order_vpts))
+ if (((cv.orientation() == COUNTERCLOCKWISE) &&
+ (start_pos == order_vpts)) ||
+ ((cv.orientation() == CLOCKWISE) && (start_pos != order_vpts)))
{
ind_first = 1;
ind_second = 0;
}
// Split the arc into three x-monotone sub-curves.
- *oi = make_object (X_monotone_curve_2 (cv,
- cv.source(),
- vtan_ps[ind_first],
- conic_id));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv, cv.source(),
+ vtan_ps[ind_first],
+ conic_id));
- *oi = make_object (X_monotone_curve_2 (cv,
- vtan_ps[ind_first],
- vtan_ps[ind_second],
- conic_id));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv,
+ vtan_ps[ind_first],
+ vtan_ps[ind_second],
+ conic_id));
- *oi = make_object (X_monotone_curve_2 (cv,
- vtan_ps[ind_second],
- cv.target(),
- conic_id));
- ++oi;
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv,
+ vtan_ps[ind_second],
+ cv.target(),
+ conic_id));
}
}
- return (oi);
+ return oi;
}
};
/*! Get a Make_x_monotone_2 functor object. */
- Make_x_monotone_2 make_x_monotone_2_object () const
- {
- return Make_x_monotone_2();
- }
+ Make_x_monotone_2 make_x_monotone_2_object() const
+ { return Make_x_monotone_2(); }
class Split_2
{
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h
index 1babd65aba1..8f07fc7be36 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h
@@ -101,120 +101,120 @@ public:
}
/*! Obtain the counter of the given operation */
- unsigned int count(Operation_id id) const
+ size_t count(Operation_id id) const
{ return m_counters[id]; }
- unsigned int count_compare_x() const
+ size_t count_compare_x() const
{ return m_counters[COMPARE_X_OP]; }
- unsigned int count_compare_xy() const
+ size_t count_compare_xy() const
{ return m_counters[COMPARE_XY_OP]; }
- unsigned int count_construct_min_vertex() const
+ size_t count_construct_min_vertex() const
{ return m_counters[CONSTRUCT_MIN_VERTEX_OP]; }
- unsigned int count_construct_max_vertex() const
+ size_t count_construct_max_vertex() const
{ return m_counters[CONSTRUCT_MAX_VERTEX_OP]; }
- unsigned int count_is_vertical() const
+ size_t count_is_vertical() const
{ return m_counters[IS_VERTICAL_OP]; }
- unsigned int count_compare_y_at_x() const
+ size_t count_compare_y_at_x() const
{ return m_counters[COMPARE_Y_AT_X_OP]; }
- unsigned int count_equal_points() const
+ size_t count_equal_points() const
{ return m_counters[EQUAL_POINTS_OP]; }
- unsigned int count_equal_curves() const
+ size_t count_equal_curves() const
{ return m_counters[EQUAL_CURVES_OP]; }
- unsigned int count_compare_y_at_x_left() const
+ size_t count_compare_y_at_x_left() const
{ return m_counters[COMPARE_Y_AT_X_LEFT_OP]; }
- unsigned int count_compare_y_at_x_right() const
+ size_t count_compare_y_at_x_right() const
{ return m_counters[COMPARE_Y_AT_X_RIGHT_OP]; }
- unsigned int count_make_x_monotone() const
+ size_t count_make_x_monotone() const
{ return m_counters[MAKE_X_MONOTONE_OP]; }
- unsigned int count_split() const
+ size_t count_split() const
{ return m_counters[SPLIT_OP]; }
- unsigned int count_intersect() const
+ size_t count_intersect() const
{ return m_counters[INTERSECT_OP]; }
- unsigned int count_are_mergeable() const
+ size_t count_are_mergeable() const
{ return m_counters[ARE_MERGEABLE_OP]; }
- unsigned int count_merge() const
+ size_t count_merge() const
{ return m_counters[MERGE_OP]; }
- unsigned int count_construct_opposite() const
+ size_t count_construct_opposite() const
{ return m_counters[CONSTRUCT_OPPOSITE_OP]; }
- unsigned int count_compare_endpoints_xy() const
+ size_t count_compare_endpoints_xy() const
{ return m_counters[COMPARE_ENDPOINTS_XY_OP]; }
// left-right
- unsigned int count_parameter_space_in_x_curve_end() const
+ size_t count_parameter_space_in_x_curve_end() const
{ return m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP]; }
- unsigned int count_parameter_space_in_x_curve() const
+ size_t count_parameter_space_in_x_curve() const
{ return m_counters[PARAMETER_SPACE_IN_X_CURVE_OP]; }
- unsigned int count_parameter_space_in_x_point() const
+ size_t count_parameter_space_in_x_point() const
{ return m_counters[PARAMETER_SPACE_IN_X_POINT_OP]; }
- unsigned int count_is_on_x_identification_point() const
+ size_t count_is_on_x_identification_point() const
{ return m_counters[IS_ON_X_IDENTIFICATION_POINT_OP]; }
- unsigned int count_is_on_x_identification_curve() const
+ size_t count_is_on_x_identification_curve() const
{ return m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]; }
- unsigned int count_compare_y_on_boundary() const
+ size_t count_compare_y_on_boundary() const
{ return m_counters[COMPARE_Y_ON_BOUNDARY_OP]; }
- unsigned int count_compare_y_near_boundary() const
+ size_t count_compare_y_near_boundary() const
{ return m_counters[COMPARE_Y_NEAR_BOUNDARY_OP]; }
// bottom-top
- unsigned int count_parameter_space_in_y_curve_end() const
+ size_t count_parameter_space_in_y_curve_end() const
{ return m_counters[PARAMETER_SPACE_IN_Y_CURVE_END_OP]; }
- unsigned int count_parameter_space_in_y_curve() const
+ size_t count_parameter_space_in_y_curve() const
{ return m_counters[PARAMETER_SPACE_IN_Y_CURVE_OP]; }
- unsigned int count_parameter_space_in_y_point() const
+ size_t count_parameter_space_in_y_point() const
{ return m_counters[PARAMETER_SPACE_IN_Y_POINT_OP]; }
- unsigned int count_is_on_y_identification_point() const
+ size_t count_is_on_y_identification_point() const
{ return m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP]; }
- unsigned int count_is_on_y_identification_curve() const
+ size_t count_is_on_y_identification_curve() const
{ return m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP]; }
- unsigned int count_compare_x_at_limit_point_curve_end() const
+ size_t count_compare_x_at_limit_point_curve_end() const
{ return m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP]; }
- unsigned int count_compare_x_at_limit_curve_ends() const
+ size_t count_compare_x_at_limit_curve_ends() const
{ return m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]; }
- unsigned int count_compare_x_near_limit() const
+ size_t count_compare_x_near_limit() const
{ return m_counters[COMPARE_X_NEAR_LIMIT_OP]; }
- unsigned int count_compare_x_on_boundary_points() const
+ size_t count_compare_x_on_boundary_points() const
{ return m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP]; }
- unsigned int count_compare_x_on_boundary_point_curve_end() const
+ size_t count_compare_x_on_boundary_point_curve_end() const
{ return m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP]; }
- unsigned int count_compare_x_on_boundary_curve_ends() const
+ size_t count_compare_x_on_boundary_curve_ends() const
{ return m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]; }
- unsigned int count_compare_x_near_boundary() const
+ size_t count_compare_x_near_boundary() const
{ return m_counters[COMPARE_X_NEAR_BOUNDARY_OP]; }
/// \name Types and functors inherited from the base
@@ -242,11 +242,11 @@ public:
class Compare_x_2 {
private:
typename Base::Compare_x_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_x_2(const Base* base, unsigned int& counter) :
+ Compare_x_2(const Base* base, size_t& counter) :
m_object(base->compare_x_2_object()), m_counter(counter) {}
/*! Operate */
@@ -258,11 +258,11 @@ public:
class Compare_xy_2 {
private:
typename Base::Compare_xy_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_xy_2(const Base* base, unsigned int& counter) :
+ Compare_xy_2(const Base* base, size_t& counter) :
m_object(base->compare_xy_2_object()), m_counter(counter) {}
/*! Operate */
@@ -274,11 +274,11 @@ public:
class Construct_min_vertex_2 {
private:
typename Base::Construct_min_vertex_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Construct_min_vertex_2(const Base* base, unsigned int& counter) :
+ Construct_min_vertex_2(const Base* base, size_t& counter) :
m_object(base->construct_min_vertex_2_object()), m_counter(counter) {}
/*! Operate */
@@ -290,11 +290,11 @@ public:
class Construct_max_vertex_2 {
private:
typename Base::Construct_max_vertex_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Construct_max_vertex_2(const Base* base, unsigned int& counter) :
+ Construct_max_vertex_2(const Base* base, size_t& counter) :
m_object(base->construct_max_vertex_2_object()), m_counter(counter) {}
/*! Operate */
@@ -306,11 +306,11 @@ public:
class Is_vertical_2 {
private:
typename Base::Is_vertical_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Is_vertical_2(const Base* base, unsigned int& counter) :
+ Is_vertical_2(const Base* base, size_t& counter) :
m_object(base->is_vertical_2_object()), m_counter(counter) {}
/*! Operate */
@@ -324,11 +324,11 @@ public:
class Compare_y_at_x_2 {
private:
typename Base::Compare_y_at_x_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_y_at_x_2(const Base* base, unsigned int& counter) :
+ Compare_y_at_x_2(const Base* base, size_t& counter) :
m_object(base->compare_y_at_x_2_object()), m_counter(counter) {}
/*! Operate */
@@ -343,12 +343,12 @@ public:
class Equal_2 {
private:
typename Base::Equal_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
+ size_t& m_counter1;
+ size_t& m_counter2;
public:
/*! Construct */
- Equal_2(const Base* base, unsigned int& counter1, unsigned int& counter2) :
+ Equal_2(const Base* base, size_t& counter1, size_t& counter2) :
m_object(base->equal_2_object()),
m_counter1(counter1), m_counter2(counter2)
{}
@@ -369,11 +369,11 @@ public:
class Compare_y_at_x_left_2 {
private:
typename Base::Compare_y_at_x_left_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_y_at_x_left_2(const Base* base, unsigned int& counter) :
+ Compare_y_at_x_left_2(const Base* base, size_t& counter) :
m_object(base->compare_y_at_x_left_2_object()), m_counter(counter) {}
/*! Operate */
@@ -389,11 +389,11 @@ public:
class Compare_y_at_x_right_2 {
private:
typename Base::Compare_y_at_x_right_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_y_at_x_right_2(const Base* base, unsigned int& counter) :
+ Compare_y_at_x_right_2(const Base* base, size_t& counter) :
m_object(base->compare_y_at_x_right_2_object()), m_counter(counter) {}
/*! Operate */
@@ -403,19 +403,27 @@ public:
{ ++m_counter; return m_object(xc1, xc2, p); }
};
- /*! A functor that divides a curve into x-monotone curves. */
+ /*! \class Make_x_monotone_2
+ * A functor that subdivides a curve into x-monotone curves.
+ */
class Make_x_monotone_2 {
private:
typename Base::Make_x_monotone_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Make_x_monotone_2(const Base* base, unsigned int& counter) :
+ Make_x_monotone_2(const Base* base, size_t& counter) :
m_object(base->make_x_monotone_2_object()), m_counter(counter) {}
- /*! Operate */
- template
+ /*! Subdivide a given curve into x-monotone subcurves and insert them into
+ * a given output iterator.
+ * \param cv the curve.
+ * \param oi the output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return The past-the-end iterator.
+ */
+ template
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{ ++m_counter; return m_object(cv, oi); }
};
@@ -424,11 +432,11 @@ public:
class Split_2 {
private:
typename Base::Split_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Split_2(const Base* base, unsigned int& counter) :
+ Split_2(const Base* base, size_t& counter) :
m_object(base->split_2_object()), m_counter(counter) {}
/*! Operate */
@@ -441,11 +449,11 @@ public:
class Intersect_2 {
private:
typename Base::Intersect_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Intersect_2(const Base* base, unsigned int& counter) :
+ Intersect_2(const Base* base, size_t& counter) :
m_object(base->intersect_2_object()), m_counter(counter) {}
/*! Operate */
@@ -460,11 +468,11 @@ public:
class Are_mergeable_2 {
private:
typename Base::Are_mergeable_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Are_mergeable_2(const Base* base, unsigned int& counter) :
+ Are_mergeable_2(const Base* base, size_t& counter) :
m_object(base->are_mergeable_2_object()), m_counter(counter) {}
/*! Operate */
@@ -477,11 +485,11 @@ public:
class Merge_2 {
private:
typename Base::Merge_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Merge_2(const Base* base, unsigned int& counter) :
+ Merge_2(const Base* base, size_t& counter) :
m_object(base->merge_2_object()), m_counter(counter) {}
/*! Operate */
@@ -495,11 +503,11 @@ public:
class Construct_opposite_2 {
private:
typename Base::Construct_opposite_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Construct_opposite_2(const Base* base, unsigned int& counter) :
+ Construct_opposite_2(const Base* base, size_t& counter) :
m_object(base->construct_opposite_2_object()), m_counter(counter) {}
/*! Operate */
@@ -513,11 +521,11 @@ public:
class Compare_endpoints_xy_2 {
private:
typename Base::Compare_endpoints_xy_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_endpoints_xy_2(const Base* base, unsigned int& counter) :
+ Compare_endpoints_xy_2(const Base* base, size_t& counter) :
m_object(base->compare_endpoints_xy_2_object()), m_counter(counter) {}
/*! Operate */
@@ -533,14 +541,14 @@ public:
class Parameter_space_in_x_2 {
private:
typename Base::Parameter_space_in_x_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
- unsigned int& m_counter3;
+ size_t& m_counter1;
+ size_t& m_counter2;
+ size_t& m_counter3;
public:
/*! Construct */
- Parameter_space_in_x_2(const Base* base, unsigned int& counter1,
- unsigned int& counter2, unsigned int& counter3) :
+ Parameter_space_in_x_2(const Base* base, size_t& counter1,
+ size_t& counter2, size_t& counter3) :
m_object(base->parameter_space_in_x_2_object()),
m_counter1(counter1),
m_counter2(counter2),
@@ -569,13 +577,13 @@ public:
class Is_on_x_identification_2 {
private:
typename Base::Is_on_x_identificiation_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
+ size_t& m_counter1;
+ size_t& m_counter2;
public:
/*! Construct */
Is_on_x_identification_2(const Base* base,
- unsigned int& counter1, unsigned int& counter2) :
+ size_t& counter1, size_t& counter2) :
m_object(base->is_on_x_identificiation_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@@ -597,11 +605,11 @@ public:
class Compare_y_on_boundary_2 {
private:
typename Base::Compare_y_on_boundary_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_y_on_boundary_2(const Base* base, unsigned int& counter) :
+ Compare_y_on_boundary_2(const Base* base, size_t& counter) :
m_object(base->compare_y_on_boundary_2_object()),
m_counter(counter)
{}
@@ -617,11 +625,11 @@ public:
class Compare_y_near_boundary_2 {
private:
typename Base::Compare_y_near_boundary_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_y_near_boundary_2(const Base* base, unsigned int& counter) :
+ Compare_y_near_boundary_2(const Base* base, size_t& counter) :
m_object(base->compare_y_near_boundary_2_object()), m_counter(counter) {}
/*! Operate */
@@ -639,14 +647,14 @@ public:
class Parameter_space_in_y_2 {
private:
typename Base::Parameter_space_in_y_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
- unsigned int& m_counter3;
+ size_t& m_counter1;
+ size_t& m_counter2;
+ size_t& m_counter3;
public:
/*! Construct */
- Parameter_space_in_y_2(const Base* base, unsigned int& counter1,
- unsigned int& counter2, unsigned int& counter3) :
+ Parameter_space_in_y_2(const Base* base, size_t& counter1,
+ size_t& counter2, size_t& counter3) :
m_object(base->parameter_space_in_y_2_object()),
m_counter1(counter1),
m_counter2(counter2),
@@ -673,13 +681,13 @@ public:
class Is_on_y_identification_2 {
private:
typename Base::Is_on_y_identificiation_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
+ size_t& m_counter1;
+ size_t& m_counter2;
public:
/*! Construct */
Is_on_y_identification_2(const Base* base,
- unsigned int& counter1, unsigned int& counter2) :
+ size_t& counter1, size_t& counter2) :
m_object(base->is_on_y_identificiation_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@@ -701,13 +709,13 @@ public:
class Compare_x_at_limit_2 {
private:
typename Base::Compare_x_at_limit_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
+ size_t& m_counter1;
+ size_t& m_counter2;
public:
/*! Construct */
Compare_x_at_limit_2(const Base* base,
- unsigned int& counter1, unsigned int& counter2) :
+ size_t& counter1, size_t& counter2) :
m_object(base->compare_x_at_limit_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@@ -733,11 +741,11 @@ public:
class Compare_x_near_limit_2 {
private:
typename Base::Compare_x_near_limit_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
- Compare_x_near_limit_2(const Base* base, unsigned int& counter) :
+ Compare_x_near_limit_2(const Base* base, size_t& counter) :
m_object(base->compare_x_near_limit_2_object()),
m_counter(counter) {}
@@ -755,14 +763,14 @@ public:
class Compare_x_on_boundary_2 {
private:
typename Base::Compare_x_on_boundary_2 m_object;
- unsigned int& m_counter1;
- unsigned int& m_counter2;
- unsigned int& m_counter3;
+ size_t& m_counter1;
+ size_t& m_counter2;
+ size_t& m_counter3;
public:
/*! Construct */
- Compare_x_on_boundary_2(const Base* base, unsigned int& counter1,
- unsigned int& counter2, unsigned int& counter3 ) :
+ Compare_x_on_boundary_2(const Base* base, size_t& counter1,
+ size_t& counter2, size_t& counter3 ) :
m_object(base->compare_x_on_boundary_2_object()),
m_counter1(counter1),
m_counter2(counter2),
@@ -794,12 +802,12 @@ public:
class Compare_x_near_boundary_2 {
private:
typename Base::Compare_x_near_boundary_2 m_object;
- unsigned int& m_counter;
+ size_t& m_counter;
public:
/*! Construct */
Compare_x_near_boundary_2(const Base* base,
- unsigned int& counter) :
+ size_t& counter) :
m_object(base->compare_x_near_boundary_2_object()),
m_counter(counter) {}
@@ -945,12 +953,12 @@ public:
* \param doit indicates whethet to actually inceremnt the counter or not
* \return the counter at the end of the operation
*/
- static unsigned int increment(bool doit = true)
+ static size_t increment(bool doit = true)
{
#ifdef CGAL_NO_ATOMIC
- static unsigned int counter;
+ static size_t counter;
#else
- static CGAL::cpp11::atomic counter;
+ static CGAL::cpp11::atomic counter;
#endif
if (doit) ++counter;
return counter;
@@ -962,7 +970,7 @@ public:
private:
/*! The operation counters */
- mutable unsigned int m_counters[NUMBER_OF_OPERATIONS];
+ mutable size_t m_counters[NUMBER_OF_OPERATIONS];
};
template
@@ -971,8 +979,8 @@ Out_stream& operator<<(Out_stream& os,
const Arr_counting_traits_2& traits)
{
typedef Arr_counting_traits_2 Traits;
- unsigned int sum = 0;
- unsigned int i;
+ size_t sum = 0;
+ size_t i;
for (i = 0; i < Traits::NUMBER_OF_OPERATIONS; ++i)
sum += traits.count(static_cast(i));
os << "# of COMPARE_X operation = "
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h
index 7ed8e459334..ca8413d47ad 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h
@@ -27,8 +27,8 @@
#include
#include
-#include
#include
+#include
#include
#include
@@ -101,6 +101,12 @@ public:
/// \name Overriden functors.
//@{
+ //! \name Intersections & subdivisions
+ //@{
+
+ /*! \class Make_x_monotone_2
+ * A functor for subdividing a curve into x-monotone curves.
+ */
class Make_x_monotone_2 {
private:
const Base_traits_2& m_base;
@@ -109,36 +115,36 @@ public:
/*! Constructor. */
Make_x_monotone_2(const Base_traits_2& base) : m_base(base) {}
- /*! Cut the given curve into x-monotone subcurves and insert them to the
- * given output iterator. As segments are always x_monotone, only one
- * x-monotone curve will be contained in the iterator.
- * \param cv The curve.
- * \param oi The output iterator, whose value-type is X_monotone_curve_2.
- * \return The past-the-end iterator.
+ /*! Subdivide a given curve into x-monotone subcurves and insert them into
+ * a given output iterator.
+ * \param cv the curve.
+ * \param oi the output iterator for the result. Its value type is a variant
+ * that wraps Point_2 or an X_monotone_curve_2 objects.
+ * \return the past-the-end iterator.
*/
- template
+ template
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
+ typedef boost::variant
+ Base_make_x_monotone_result;
+ typedef boost::variant
+ Make_x_monotone_result;
+
// Make the original curve x-monotone.
- std::list base_objects;
+ std::list base_objects;
m_base.make_x_monotone_2_object()(cv, std::back_inserter(base_objects));
// Attach the data to each of the resulting x-monotone curves.
- const Base_x_monotone_curve_2* base_x_curve;
X_monotone_curve_data xdata = Convert()(cv.data());
- for (typename std::list::const_iterator it =
- base_objects.begin(); it != base_objects.end(); ++it)
- {
- base_x_curve = object_cast(&(*it));
- if (base_x_curve != nullptr) {
- // Current object is an x-monotone curve: Attach data to it.
- *oi++ = make_object(X_monotone_curve_2(*base_x_curve, xdata));
- }
- else {
- // Current object is an isolated point: Leave it as is.
- CGAL_assertion(object_cast(&(*it)) != nullptr);
- *oi++ = *it;
+ for (const auto& base_obj : base_objects) {
+ if (const auto* bxcv = boost::get(&base_obj)) {
+ *oi++ = Make_x_monotone_result(X_monotone_curve_2(*bxcv, xdata));
+ continue;
}
+ // Current object is an isolated point: Leave it as is.
+ const auto* bp = boost::get(&base_obj);
+ CGAL_assertion(bp);
+ *oi++ = Make_x_monotone_result(*bp);
}
return oi;
@@ -359,6 +365,8 @@ public:
/*! Obtain a Merge_2 functor object. */
Merge_2 merge_2_object() const { return Merge_2(*this); }
+ //@}
+
class Construct_x_monotone_curve_2 {
private:
const Base_traits_2& m_base;
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
index 3855dee3c67..cf0b22dddd0 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
@@ -1358,8 +1358,9 @@ public:
/// \name Functor definitions for supporting intersections.
//@{
- /*! A functor that divides an arc into x-monotone arcs. That are, arcs that
- * do not cross the identification arc.
+ /*! \class Make_x_monotone_2
+ * A functor for subdividing arcs into x-monotone arcs that do not cross the
+ * identification arc.
*/
class Make_x_monotone_2 {
protected:
@@ -1376,21 +1377,24 @@ public:
friend class Arr_geodesic_arc_on_sphere_traits_2;
public:
- /*! Cut the given curve into x-monotone subcurves and insert them into the
- * given output iterator. As spherical_arcs are always x_monotone, only one
- * object will be contained in the iterator.
+ /*! Subdivide a given curve into x-monotone subcurves and insert them into
+ * a given output iterator. As spherical_arcs are always x_monotone, only
+ * one object will be contained in the iterator.
* \param xc the curve.
- * \param oi the output iterator, whose value-type is Object. The output
- * object is a wrapper of either an X_monotone_curve_2, or - in
- * case the input spherical_arc is degenerate - a Point_2 object.
+ * \param oi the output iterator for the result. Its dereference type is a
+ * variant that wraps a \c Point_2 or an \c X_monotone_curve_2
+ * objects.
* \return the past-the-end iterator.
*/
- template
+ template
OutputIterator operator()(const Curve_2& c, OutputIterator oi) const
{
+ typedef boost::variant
+ Make_x_monotone_result;
+
if (c.is_degenerate()) {
// The spherical_arc is a degenerate point - wrap it with an object:
- *oi++ = make_object(c.right());
+ *oi++ = Make_x_monotone_result(c.right());
return oi;
}
@@ -1398,7 +1402,7 @@ public:
// The spherical arc is monotone - wrap it with an object:
// *oi++ = make_object(X_monotone_curve_2(c));
const X_monotone_curve_2* xc = &c;
- *oi++ = make_object(*xc);
+ *oi++ = Make_x_monotone_result(*xc);
return oi;
}
@@ -1410,14 +1414,14 @@ public:
const Direction_3& pp = m_traits->pos_pole();
X_monotone_curve_2 xc1(np, pp, c.normal(), true, true);
X_monotone_curve_2 xc2(pp, np, c.normal(), true, false);
- *oi++ = make_object(xc1);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc1);
+ *oi++ = Make_x_monotone_result(xc2);
return oi;
}
#if defined(CGAL_FULL_X_MONOTONE_GEODESIC_ARC_ON_SPHERE_IS_SUPPORTED)
// The arc is not vertical => break it at the discontinuity arc:
const X_monotone_curve_2 xc(c.normal());
- *oi++ = make_object(xc);
+ *oi++ = Make_x_monotone_result(xc);
#else
// Full x-monotone arcs are not supported!
// Split the arc at the intersection point with the complement of the
@@ -1428,8 +1432,8 @@ public:
Direction_3 d2(normal.dz(), 0, -(normal.dx()));
X_monotone_curve_2 xc1(d1, d2, normal, false, directed_right);
X_monotone_curve_2 xc2(d2, d1, normal, false, directed_right);
- *oi++ = make_object(xc1);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc1);
+ *oi++ = Make_x_monotone_result(xc2);
#endif
return oi;
}
@@ -1447,16 +1451,16 @@ public:
if (source.is_min_boundary() || target.is_min_boundary()) {
X_monotone_curve_2 xc1(source, pp, normal, true, true);
X_monotone_curve_2 xc2(pp, target, normal, true, false);
- *oi++ = make_object(xc1);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc1);
+ *oi++ = Make_x_monotone_result(xc2);
return oi;
}
if (source.is_max_boundary() || target.is_max_boundary()) {
X_monotone_curve_2 xc1(source, np, normal, true, false);
X_monotone_curve_2 xc2(np, target, normal, true, true);
- *oi++ = make_object(xc1);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc1);
+ *oi++ = Make_x_monotone_result(xc2);
return oi;
}
@@ -1476,19 +1480,19 @@ public:
(!plane_is_positive && !s_is_positive));
const Point_2& pole1 = (ccw) ? pp : np;
X_monotone_curve_2 xc1(source, pole1, normal, true, ccw);
- *oi++ = make_object(xc1);
+ *oi++ = Make_x_monotone_result(xc1);
if (s_is_positive != t_is_positive) {
// Construct 1 more arc:
X_monotone_curve_2 xc2(pole1, target, normal, true, !ccw);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc2);
return oi;
}
// Construct 2 more arcs:
const Point_2& pole2 = (ccw) ? np : pp;
X_monotone_curve_2 xc2(pole1, pole2, normal, true, !ccw);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc2);
X_monotone_curve_2 xc3(pole2, target, normal, true, ccw);
- *oi++ = make_object(xc3);
+ *oi++ = Make_x_monotone_result(xc3);
return oi;
}
@@ -1514,8 +1518,8 @@ public:
X_monotone_curve_2 xc1(source, p, normal, false, directed_right);
X_monotone_curve_2 xc2(p, target, normal, false, directed_right);
- *oi++ = make_object(xc1);
- *oi++ = make_object(xc2);
+ *oi++ = Make_x_monotone_result(xc1);
+ *oi++ = Make_x_monotone_result(xc2);
return oi;
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
index ebfc5cef09b..7680e01d93a 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
@@ -197,49 +197,51 @@ public:
/*! Intersect 2 planes
* \param plane1 the first plane
* \param plane2 the second plane
- * \return a geometric object that represents the intersection. Could be
- * the line of intersection, or a plane in case plane1 and plane2 coincide.
+ * \return a variant that represents the intersection. It wraps a line of
+ * intersection or a plane in case plane1 and plane2 coincide.
*/
-template
-CGAL::Object intersect(const Arr_plane_3 & plane1,
+template
+boost::variant >
+intersect(const Arr_plane_3 & plane1,
const Arr_plane_3 & plane2)
{
typedef typename Kernel::Point_3 Point_3;
typedef typename Kernel::Direction_3 Direction_3;
typedef typename Kernel::Line_3 Line_3;
typedef typename Kernel::FT FT;
+ typedef boost::variant > Intersection_result;
// We know that the plane goes throgh the origin
- const FT & a1 = plane1.a();
- const FT & b1 = plane1.b();
- const FT & c1 = plane1.c();
+ const FT& a1 = plane1.a();
+ const FT& b1 = plane1.b();
+ const FT& c1 = plane1.c();
- const FT & a2 = plane2.a();
- const FT & b2 = plane2.b();
- const FT & c2 = plane2.c();
+ const FT& a2 = plane2.a();
+ const FT& b2 = plane2.b();
+ const FT& c2 = plane2.c();
FT det = a1*b2 - a2*b1;
if (det != 0) {
Point_3 is_pt = Point_3(0, 0, 0, det);
Direction_3 is_dir = Direction_3(b1*c2 - c1*b2, a2*c1 - a1*c2, det);
- return make_object(Line_3(is_pt, is_dir));
+ return Intersection_result(Line_3(is_pt, is_dir));
}
det = a1*c2 - a2*c1;
if (det != 0) {
Point_3 is_pt = Point_3(0, 0, 0, det);
Direction_3 is_dir = Direction_3(c1*b2 - b1*c2, det, a2*b1 - a1*b2);
- return make_object(Line_3(is_pt, is_dir));
+ return Intersection_result(Line_3(is_pt, is_dir));
}
det = b1*c2 - c1*b2;
if (det != 0) {
Point_3 is_pt = Point_3(0, 0, 0, det);
Direction_3 is_dir = Direction_3(det, c1*a2 - a1*c2, a1*b2 - b1*a2);
- return make_object(Line_3(is_pt, is_dir));
+ return Intersection_result(Line_3(is_pt, is_dir));
}
// degenerate case
- return make_object(plane1);
+ return Intersection_result(plane1);
}
/*! Compute the image point of the projection of p under an affine
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
index 761710d8a89..bc7831ee95f 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
@@ -1262,36 +1262,26 @@ private:
// the intersection of the two skewed bounding boxes.
Bez_point_bbox ipt_bbox;
Control_points aux_vec;
- CGAL::Object res;
- Point_2 p;
- res = f_intersect (skew1a, skew2a);
- if (! assign (p, res))
- {
- CGAL_error();
- }
- aux_vec.push_back(p);
+ auto res1 = f_intersect(skew1a, skew2a);
+ const Point_2* p1 = boost::get(&*res1);
+ if (! p1) CGAL_error();
+ aux_vec.push_back(*p1);
- res = f_intersect (skew1a, skew2b);
- if (! assign(p, res))
- {
- CGAL_error();
- }
- aux_vec.push_back(p);
+ auto res2 = f_intersect(skew1a, skew2b);
+ const Point_2* p2 = boost::get(&*res2);
+ if (! p2) CGAL_error();
+ aux_vec.push_back(*p2);
- res = f_intersect (skew1b, skew2a);
- if (! assign(p, res))
- {
- CGAL_error();
- }
- aux_vec.push_back(p);
+ auto res3 = f_intersect(skew1b, skew2a);
+ const Point_2* p3 = boost::get(&*res3);
+ if (! p3) CGAL_error();
+ aux_vec.push_back(*p3);
- res = f_intersect (skew1b, skew2b);
- if (!assign(p, res))
- {
- CGAL_error();
- }
- aux_vec.push_back(p);
+ auto res4 = f_intersect (skew1b, skew2b);
+ const Point_2* p4 = boost::get(&*res4);
+ if (! p4) CGAL_error();
+ aux_vec.push_back(*p4);
construct_bbox (aux_vec, ipt_bbox);
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h
index b48cad3da36..20ccbe9c758 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h
@@ -27,6 +27,10 @@
* Arrangement_2 package, which it is now part of. It contains a traits
* class for the arrangement package that handles linear curves.
* It is based on the circular kernel.
+ *
+ * \todo Fix the circular-kernel make-x-monotone functor to use modern variant
+ * instead of the legacy CGAL::Object. Then, eliminate the special
+ * implementation here and directly use the kernel functor instead.
*/
#include
@@ -73,7 +77,7 @@ public:
typedef typename CircularKernel::Compare_y_at_x_2 Compare_y_at_x_2;
typedef typename CircularKernel::Compare_y_to_right_2 Compare_y_at_x_right_2;
typedef typename CircularKernel::Equal_2 Equal_2;
- typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
+ // typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
typedef typename CircularKernel::Split_2 Split_2;
typedef typename CircularKernel::Construct_circular_min_vertex_2
Construct_min_vertex_2;
@@ -97,8 +101,8 @@ public:
Equal_2 equal_2_object() const
{ return ck.equal_2_object(); }
- Make_x_monotone_2 make_x_monotone_2_object() const
- { return ck.make_x_monotone_2_object(); }
+ // Make_x_monotone_2 make_x_monotone_2_object() const
+ // { return ck.make_x_monotone_2_object(); }
Split_2 split_2_object() const
{ return ck.split_2_object(); }
@@ -115,7 +119,20 @@ public:
Is_vertical_2 is_vertical_2_object() const
{ return ck.is_vertical_2_object();}
+ //! A functor for subdividing curves into x-monotone curves.
+ class Make_x_monotone_2 {
+ public:
+ template
+ OutputIterator operator()(const Curve_2& line, OutputIterator oi) const
+ {
+ typedef boost::variant Make_x_monotone_result;
+ *oi++ = Make_x_monotone_result(line);
+ return oi;
+ }
+ };
+ Make_x_monotone_2 make_x_monotone_2_object() const
+ { return Make_x_monotone_2(); }
};
} // namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h
index 3fe62601378..7d6b3fcbb23 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h
@@ -1239,16 +1239,18 @@ public:
* given output iterator. As segments are always x_monotone, only one
* object will be contained in the iterator.
* \param cv The curve.
- * \param oi The output iterator, whose value-type is Object. The output
- * object is a wrapper of an X_monotone_curve_2 which is
- * essentially the same as the input curve.
+ * \param oi an output iterator for the result. Its dereference type is a
+ * variant that wraps a \c Point_2 or an \c X_monotone_curve_2
+ * objects.
* \return The past-the-end iterator.
*/
template
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
- // Wrap the curve with an object.
- *oi++ = make_object(cv);
+ // Wrap the segment with a variant.
+ typedef boost::variant
+ Make_x_monotone_result;
+ *oi++ = Make_x_monotone_result(cv);
return oi;
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
index ac2220a2b5f..1190c3e1085 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
@@ -7,14 +7,14 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
-// Author(s) : Efi Fogel
-// Ron Wein
-// (based on old version by: Iddo Hanniel,
-// Eyal Flato,
-// Oren Nechushtan,
-// Ester Ezra,
-// Shai Hirsch,
-// and Eugene Lipovetsky)
+// Author(s): Efi Fogel
+// Ron Wein
+// (based on old version by: Iddo Hanniel,
+// Eyal Flato,
+// Oren Nechushtan,
+// Ester Ezra,
+// Shai Hirsch,
+// and Eugene Lipovetsky)
#ifndef CGAL_ARR_NON_CACHING_SEGMENT_BASIC_TRAITS_2_H
#define CGAL_ARR_NON_CACHING_SEGMENT_BASIC_TRAITS_2_H
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h
index 3df642ba1e7..81852fe41ea 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h
@@ -113,24 +113,27 @@ public:
// Traits types:
typedef X_monotone_curve_2 Curve_2;
- /*! \class
- * A functor for splitting curves into x-monotone pieces.
+ /*! \class Make_x_monotone_2
+ * A functor for subdividing a curve into x-monotone curves.
*/
class Make_x_monotone_2 {
public:
-
- /*! Cut the given segment into x-monotone subcurves and insert them into
- * the given output iterator. As segments are always x_monotone, only one
+ /*! Subdivide a given curve into x-monotone subcurves and insert them into
+ * a given output iterator. As segments are always x_monotone, only one
* x-monotone curve is inserted into the output iterator.
- * \param cv The segment.
- * \param oi The output iterator, whose value-type is Object. The output
- * object is a wrapper of an X_monotone_curve_2 object.
- * \return The past-the-end iterator.
+ * \param cv the segment.
+ * \param oi the output iterator for the result. Its dereference type is a
+ * variant that wraps a \c Point_2 or an \c X_monotone_curve_2
+ * objects.
+ * \return the past-the-end iterator.
*/
template
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{
- *oi++ = make_object(cv);
+ // Wrap the segment with a variant.
+ typedef boost::variant
+ Make_x_monotone_result;
+ *oi++ = Make_x_monotone_result(cv);
return oi;
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
index 103f47c670c..208ff208cfc 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
@@ -42,6 +42,7 @@ public:
typedef typename Base_traits_2::X_monotone_curve_2 Base_x_monotone_curve_2;
typedef typename Base_traits_2::Point_2 Base_point_2;
+ typedef typename Base_traits_2::Multiplicity Multiplicity;
typedef typename Base_traits_2::Construct_min_vertex_2
Base_construct_min_vertex_2;
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
index eb9679a8883..0a6fbc736b7 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
@@ -56,15 +56,15 @@ Arr_landmarks_point_location::locate(const Point_2& p) const
const Vertex_const_handle* vh;
const Halfedge_const_handle* hh;
const Face_const_handle* fh;
- if ( ( vh = Result().template assign(lm_location_obj) ) )
+ if ( ( vh = Result().template assign(&lm_location_obj) ) )
out_obj = _walk_from_vertex(*vh, p, crossed_edges);
- else if ( ( hh = Result().template assign(lm_location_obj) ) )
+ else if ( ( hh = Result().template assign(&lm_location_obj) ) )
out_obj = _walk_from_edge(*hh, landmark_point, p, crossed_edges);
- else if ( ( fh = Result().template assign(lm_location_obj) ) )
+ else if ( ( fh = Result().template assign(&lm_location_obj) ) )
out_obj = _walk_from_face(*fh, landmark_point, p, crossed_edges);
else CGAL_error_msg("lm_location_obj of an unknown type.");
- if ( ( fh = Result().template assign(out_obj) ) ) {
+ if ( ( fh = Result().template assign(&out_obj) ) ) {
// If we reached here, we did not locate the query point in any of the
// holes inside the current face, so we conclude it is contained in this
// face.
@@ -159,7 +159,7 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex,
if (new_vertex) {
// We found a vertex closer to p; Continue using this vertex.
const Vertex_const_handle* p_vh =
- Result().template assign(obj);
+ Result().template assign(&obj);
CGAL_assertion(p_vh != nullptr);
vh = *p_vh;
continue;
@@ -167,11 +167,12 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex,
// If p is located on an edge or on a vertex, return the object
// that wraps this arrangement feature.
- if (Result().template assign(obj) ||
- Result().template assign(obj))
+ if (Result().template assign(&obj) ||
+ Result().template assign(&obj))
return obj;
- const Face_const_handle* p_fh = Result().template assign(obj);
+ const Face_const_handle* p_fh =
+ Result().template assign(&obj);
if (p_fh)
// Walk to p from the face we have located:
return _walk_from_face(*p_fh, vh->point(), p, crossed_edges);
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
index 6b0820da97e..a5980967cb4 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
@@ -44,10 +44,8 @@ Arr_simple_point_location::locate(const Point_2& p) const
// Go over arrangement halfedges and check whether one of them contains
// the query point in its interior.
- typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range =
- m_geom_traits->is_in_x_range_2_object();
- typename Traits_adaptor_2::Compare_y_at_x_2 cmp_y_at_x =
- m_geom_traits->compare_y_at_x_2_object();
+ auto is_in_x_range = m_geom_traits->is_in_x_range_2_object();
+ auto cmp_y_at_x = m_geom_traits->compare_y_at_x_2_object();
typename Arrangement::Edge_const_iterator eit;
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit) {
@@ -71,14 +69,14 @@ Arr_simple_point_location::locate(const Point_2& p) const
// In case the ray-shooting returned a vertex, we have to locate the first
// halfedge whose source vertex is v, rotating clockwise around the vertex
// from "6 o'clock", and to return its incident face.
- const Vertex_const_handle* vh = Result().template assign(obj);
+ const auto* vh = Result::template assign(&obj);
if (vh) {
Halfedge_const_handle hh = _first_around_vertex(*vh);
Face_const_handle fh = hh->face();
return make_result(fh);
}
- const Halfedge_const_handle* hh = Result().template assign(obj);
+ const auto* hh = Result::template assign(&obj);
if (hh) {
// Make sure that the edge is directed from right to left, so that p
// (which lies below it) is contained in its incident face. If necessary,
@@ -288,14 +286,13 @@ Arr_simple_point_location::_vertical_ray_shoot(const Point_2& p,
if (! optional_empty(optional_obj)) {
const Result_type& obj = optional_assign(optional_obj);
- const Vertex_const_handle* p_vh = Result().template assign(obj);
+ const auto* p_vh = Result::template assign(&obj);
if (p_vh) {
found_vertex = true;
closest_v = *p_vh;
}
else {
- const Halfedge_const_handle* p_hh =
- Result().template assign(obj);
+ const auto* p_hh = Result::template assign(&obj);
CGAL_assertion(p_hh != nullptr);
found_halfedge = true;
closest_he = *p_hh;
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
index c8971c5d1eb..7b2cc3ffd9b 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
@@ -618,7 +618,8 @@ _is_in_connected_component (const Point_2& p,
// The current curve is not vertical. Check the query point is in the
// semi-open x-range (source, target] of this curve and lies below it.
if (source_res != EQUAL) {
- if (closest_he == invalid_he || (closest_he->twin() == curr)) {
+ if ((closest_he == invalid_he) ||
+ (closest_he->twin() == Halfedge_const_handle(curr))) {
// 1. If we have no closests halfedge, we have just found one.
// 2. If the closest halfedge is the twin of our current halfedge,
// we can take our halfedge to be the closest one. This covers the
@@ -701,7 +702,7 @@ _is_in_connected_component (const Point_2& p,
do {
next_non_vert = next_non_vert->next();
- CGAL_assertion (next_non_vert != curr);
+ CGAL_assertion(next_non_vert != Halfedge_const_handle(curr));
}
while ((! next_non_vert->is_fictitious() &&
is_vertical(next_non_vert->curve())) ||
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
index 33aeb50201b..1fae9de1d30 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
@@ -78,32 +78,34 @@ struct Arr_point_location_result {
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_ARR_POINT_LOCATION_VERSION < 2
- template
+ template