diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml
index 9e65a357fca..8a238305b81 100644
--- a/.github/workflows/build_doc.yml
+++ b/.github/workflows/build_doc.yml
@@ -56,7 +56,7 @@ jobs:
set -x
sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html
sudo pip install lxml
- sudo pip install 'pyquery==1.4.1' # it seems to be the last py2 compatible version
+ sudo pip install pyquery
wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen
sudo mv doxygen_exe /usr/bin/doxygen
sudo chmod +x /usr/bin/doxygen
diff --git a/.github/workflows/delete_doc.yml b/.github/workflows/delete_doc.yml
index de6c6e0e2a2..497013a51eb 100644
--- a/.github/workflows/delete_doc.yml
+++ b/.github/workflows/delete_doc.yml
@@ -20,7 +20,7 @@ jobs:
set -x
git config --global user.email "cgal@geometryfactory.com"
git config --global user.name "cgaltest"
- git clone https://maxGimeno:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
+ git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git
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 || true
diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h
index 630a569ebfb..215cbd65924 100644
--- a/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h
+++ b/AABB_tree/doc/AABB_tree/Concepts/AABBRayIntersectionTraits.h
@@ -37,7 +37,7 @@ public:
operator()(const Ray_3& r, const Primitive& primitive)`.
A common algorithm to compute the intersection between a bounding box and a ray is the
+ HREF="https://education.siggraph.org/static/HyperGraph/raytrace/rtinter3.htm">the
slab method.
*/
typedef unspecified_type Intersection_distance;
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp
index 1fa59ad88de..bdc2c17f627 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp
@@ -289,7 +289,7 @@ ArrangementPainterOstream>::operator<<(
QRectF seg_bb = this->convert(seg.bbox());
if (
this->clippingRect.isValid() &&
- !this->clippingRect.intersects(seg_bb) &
+ !this->clippingRect.intersects(seg_bb) &&
(!seg.is_horizontal() && !seg.is_vertical()))
{ return *this; }
diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h
index 8980c453104..a93004ad293 100644
--- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h
+++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h
@@ -631,7 +631,6 @@ namespace CartesianKernelFunctors {
typedef typename K::Point_2 Point_2;
typedef typename K::Line_2 Line_2;
typedef typename K::Equal_2 Equal_2;
- typedef typename K::Less_signed_distance_to_line_2 Less_signed_distance_to_line_2;
public:
typedef typename K::Comparison_result result_type;
@@ -641,7 +640,8 @@ namespace CartesianKernelFunctors {
const Point_2& c, const Point_2& d) const
{
CGAL_kernel_precondition_code(Equal_2 equal;)
- CGAL_kernel_precondition(! equal(a,b));
+ CGAL_kernel_precondition(! equal(a,b));
+
return cmp_signed_dist_to_lineC2( a.x(), a.y(),
b.x(), b.y(),
c.x(), c.y(),
@@ -651,10 +651,9 @@ namespace CartesianKernelFunctors {
result_type
operator()(const Line_2& l, const Point_2& p, const Point_2& q) const
{
- Less_signed_distance_to_line_2 less = K().less_signed_distance_to_line_2_object();
- if (less(l, p, q)) return SMALLER;
- if (less(l, q, p)) return LARGER;
- return EQUAL;
+ return cmp_signed_dist_to_directionC2(l.a(), l.b(),
+ p.x(), p.y(),
+ q.x(), q.y());
}
};
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_akl_toussaint.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_akl_toussaint.h
index f84b4b41c02..4df696cd96e 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_akl_toussaint.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_akl_toussaint.h
@@ -9,6 +9,7 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
+
\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
value type of `ForwardIterator` is defined.
@@ -36,6 +37,8 @@ functions that return instances of these types:
\sa `CGAL::ch_graham_andrew()`
\sa `CGAL::ch_jarvis()`
\sa `CGAL::ch_melkman()`
+\sa `CGAL::lower_hull_points_2()`
+\sa `CGAL::upper_hull_points_2()`
\sa `CGAL::convex_hull_2()`
\cgalHeading{Implementation}
@@ -49,7 +52,7 @@ points.
template
OutputIterator
ch_akl_toussaint(ForwardIterator first, ForwardIterator beyond,
-OutputIterator result,
-const Traits& ch_traits = Default_traits());
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits());
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_bykat.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_bykat.h
index 4273efd5f1d..03ca5875518 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_bykat.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_bykat.h
@@ -9,6 +9,7 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
+
\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
@@ -24,7 +25,7 @@ the concept `ConvexHullTraits_2` and their corresponding member
functions that return instances of these types:
- `Traits::Point_2`,
-
- `Traits::Less_signed_distance_to_line_2`,
+
- `Traits::Compare_signed_distance_to_line_2`,
- `Traits::Left_turn_2`,
- `Traits::Less_xy_2`,
- `Traits::Equal_2`.
@@ -36,6 +37,8 @@ functions that return instances of these types:
\sa `CGAL::ch_graham_andrew()`
\sa `CGAL::ch_jarvis()`
\sa `CGAL::ch_melkman()`
+\sa `CGAL::lower_hull_points_2()`
+\sa `CGAL::upper_hull_points_2()`
\sa `CGAL::convex_hull_2()`
\cgalHeading{Implementation}
@@ -44,14 +47,11 @@ This function implements the non-recursive variation of
Eddy's algorithm \cgalCite{e-nchap-77} described in \cgalCite{b-chfsp-78}.
This algorithm requires \f$ O(n h)\f$ time
in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points.
-
-
*/
template
OutputIterator
-ch_bykat( InputIterator first,
-InputIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits);
+ch_bykat(InputIterator first, InputIterator beyond,
+ OutputIterator result,
+ const Traits & ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_eddy.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_eddy.h
index 2a459913266..9a023d34070 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_eddy.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_eddy.h
@@ -9,6 +9,7 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
+
\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
@@ -25,7 +26,7 @@ functions that return instances of these types:
- `Traits::Point_2`,
- `Traits::Equal_2`,
-
- `Traits::Less_signed_distance_to_line_2`,
+
- `Traits::Compare_signed_distance_to_line_2`,
- `Traits::Left_turn_2`,
- `Traits::Less_xy_2`.
@@ -36,6 +37,8 @@ functions that return instances of these types:
\sa `CGAL::ch_graham_andrew()`
\sa `CGAL::ch_jarvis()`
\sa `CGAL::ch_melkman()`
+\sa `CGAL::lower_hull_points_2()`
+\sa `CGAL::upper_hull_points_2()`
\sa `CGAL::convex_hull_2()`
\cgalHeading{Implementation}
@@ -50,9 +53,8 @@ in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points.
*/
template
OutputIterator
-ch_eddy( InputIterator first,
-InputIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits);
+ch_eddy(InputIterator first, InputIterator beyond,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_graham_andrew.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_graham_andrew.h
index 1ec47707c41..20119b4243b 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_graham_andrew.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_graham_andrew.h
@@ -9,8 +9,8 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
-\pre The source range [`first`,`beyond`) does not contain `result`.
+\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
value type of `InputIteratore` is defined.
@@ -34,7 +34,6 @@ functions that return instances of these types:
\sa `CGAL::ch_akl_toussaint()`
\sa `CGAL::ch_bykat()`
\sa `CGAL::ch_eddy()`
-\sa `CGAL::ch_graham_andrew_scan()`
\sa `CGAL::ch_jarvis()`
\sa `CGAL::ch_melkman()`
\sa `CGAL::convex_hull_2()`
@@ -52,10 +51,9 @@ in the worst case for \f$ n\f$ input points.
*/
template
OutputIterator
-ch_graham_andrew( InputIterator first,
-InputIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits);
+ch_graham_andrew(InputIterator first, InputIterator beyond,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
@@ -125,8 +123,8 @@ template
OutputIterator
ch_graham_andrew_scan( BidirectionalIterator first,
-BidirectionalIterator beyond,
-OutputIterator result,
-const Traits& ch_traits = Default_traits);
+ BidirectionalIterator beyond,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h
index 54061777377..41478fb06f9 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h
@@ -9,6 +9,7 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
+
\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
@@ -36,6 +37,8 @@ functions that return instances of these types:
\sa `CGAL::ch_graham_andrew()`
\sa `CGAL::ch_jarvis_march()`
\sa `CGAL::ch_melkman()`
+\sa `CGAL::lower_hull_points_2()`
+\sa `CGAL::upper_hull_points_2()`
\sa `CGAL::convex_hull_2()`
\cgalHeading{Implementation}
@@ -44,14 +47,12 @@ This function uses the Jarvis march (gift-wrapping)
algorithm \cgalCite{j-ichfs-73}. This algorithm requires \f$ O(n h)\f$ time
in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points.
-
*/
template
OutputIterator
-ch_jarvis( ForwardIterator first,
-ForwardIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits);
+ch_jarvis(ForwardIterator first, ForwardIterator beyond,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
@@ -106,9 +107,9 @@ is an element of range [`first`,`beyond`).
template
OutputIterator
ch_jarvis_march(ForwardIterator first, ForwardIterator beyond,
-const Traits::Point_2& start_p,
-const Traits::Point_2& stop_p,
-OutputIterator result,
-const Traits& ch_traits = Default_traits);
+ const Traits::Point_2& start_p,
+ const Traits::Point_2& stop_p,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_melkman.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_melkman.h
index 8e89546ea15..d4375657e98 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_melkman.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_melkman.h
@@ -8,6 +8,7 @@ of the points in the range [`first`, `beyond`).
The resulting sequence is placed starting at
position `result`, and the past-the-end iterator for
the resulting sequence is returned.
+
\pre The source range [`first`,`beyond`) corresponds to a simple polyline. [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
@@ -35,6 +36,8 @@ functions that return instances of these types:
\sa `CGAL::ch_graham_andrew()`
\sa `CGAL::ch_jarvis()`
\sa `CGAL::ch_melkman()`
+\sa `CGAL::lower_hull_points_2()`
+\sa `CGAL::upper_hull_points_2()`
\sa `CGAL::convex_hull_2()`
\cgalHeading{Implementation}
@@ -42,12 +45,11 @@ functions that return instances of these types:
It uses an implementation of Melkman's algorithm \cgalCite{m-olcch-87}.
Running time of this is linear.
-
*/
template
OutputIterator
-ch_melkman( InputIterator first, InputIterator last,
-OutputIterator result,
-const Traits& ch_traits = Default_traits);
+ch_melkman(InputIterator first, InputIterator beyond,
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_2.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_2.h
index b948ed2db30..0e54242c874 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_2.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_2.h
@@ -13,10 +13,9 @@ The resulting sequence is placed starting at position
`result`, and the past-the-end iterator for the resulting
sequence is returned. It is not specified at which point the
cyclic sequence of extreme points is cut into a linear sequence.
+
\pre The source range [`first`,`beyond`) does not contain `result`.
-
-
\cgalHeading{Requirements}
@@ -27,7 +26,7 @@ the concept `ConvexHullTraits_2` and their corresponding member
functions that return instances of these types:
- `Traits::Point_2`,
-
- `Traits::Less_signed_distance_to_line_2`,
+
- `Traits::Compare_signed_distance_to_line_2`,
- `Traits::Equal_2`,
- `Traits::Less_xy_2`,
- `Traits::Less_yx_2`,
@@ -136,8 +135,8 @@ of \f$ O(n \log n)\f$ for \f$ n\f$ input points.
template
OutputIterator
lower_hull_points_2(InputIterator first, InputIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits );
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits );
} /* namespace CGAL */
@@ -195,12 +194,10 @@ This function uses Andrew's
variant of Graham's scan algorithm \cgalCite{a-aeach-79}, \cgalCite{m-mdscg-84}. The algorithm
has worst-case running time of \f$ O(n \log n)\f$ for \f$ n\f$ input points.
-
*/
template
OutputIterator
upper_hull_points_2(InputIterator first, InputIterator beyond,
-OutputIterator result,
-const Traits & ch_traits = Default_traits );
-
+ OutputIterator result,
+ const Traits& ch_traits = Default_traits);
} /* namespace CGAL */
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_constructive_traits_2.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_constructive_traits_2.h
index 39d690ceedd..74534126ab7 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_constructive_traits_2.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_constructive_traits_2.h
@@ -43,10 +43,10 @@ typedef R::Less_xy_2 Less_xy_2;
typedef R::Less_yx_2 Less_yx_2;
/*!
-
+This internal functor builds and cache the line on the first call to its `operator()`.
*/
-typedef CGAL::r_Less_dist_to_line
-Less_signed_distance_to_line_2;
+typedef unspecified_type
+Compare_signed_distance_to_line_2;
/*!
@@ -91,8 +91,8 @@ Less_yx_2 less_yx_2_object();
/*!
*/
-Less_signed_distance_to_line_2
-less_signed_distance_to_line_2_object();
+Compare_signed_distance_to_line_2
+compare_signed_distance_to_line_2_object();
/*!
diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_traits_2.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_traits_2.h
index 21a1d8cf381..5d3fb688ae0 100644
--- a/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_traits_2.h
+++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/convex_hull_traits_2.h
@@ -41,8 +41,8 @@ typedef R::Less_yx Less_yx_2;
/*!
*/
-typedef R::Less_signed_distance_to_line_2
-Less_signed_distance_to_line_2;
+typedef R::Compare_signed_distance_to_line_2
+Compare_signed_distance_to_line_2;
/*!
@@ -92,8 +92,8 @@ Less_yx_2 less_yx_2_object();
/*!
*/
-Less_signed_distance_to_line_2
-less_signed_distance_to_line_2_object();
+Compare_signed_distance_to_line_2
+compare_signed_distance_to_line_2_object();
/*!
diff --git a/Convex_hull_2/doc/Convex_hull_2/Concepts/ConvexHullTraits_2.h b/Convex_hull_2/doc/Convex_hull_2/Concepts/ConvexHullTraits_2.h
index 7a9b9e862fb..0bff4725d60 100644
--- a/Convex_hull_2/doc/Convex_hull_2/Concepts/ConvexHullTraits_2.h
+++ b/Convex_hull_2/doc/Convex_hull_2/Concepts/ConvexHullTraits_2.h
@@ -16,8 +16,6 @@ is specified with each function.
\cgalHasModel `CGAL::Projection_traits_yz_3`
\cgalHasModel `CGAL::Projection_traits_xz_3`
-\sa `IsStronglyConvexTraits_3`
-
*/
class ConvexHullTraits_2 {
@@ -66,18 +64,12 @@ typedef unspecified_type Left_turn_2;
/*!
Predicate object type that must provide
-`bool operator()(Point_2 p, Point_2 q,
-Point_2 r,Point_2 s)`, which returns `true` iff
-the signed distance from \f$ r\f$ to the line \f$ l_{pq}\f$ through \f$ p\f$ and \f$ q\f$
-is smaller than the distance from \f$ s\f$ to \f$ l_{pq}\f$. It is used to
-compute the point right of a line with maximum unsigned distance to
-the line. The predicate must provide a total order compatible
-with convexity, i.e., for any line segment \f$ s\f$ one of the
-endpoints
-of \f$ s\f$ is the smallest point among the points on \f$ s\f$, with respect to
-the order given by `Less_signed_distance_to_line_2`.
+`bool operator()(Point_2 p, Point_2 q, Point_2 r,Point_2 s)`,
+which compares the signed distance of \f$ r\f$ and \f$ s\f$ to the directed line \f$ l_{pq}\f$
+through \f$ p\f$ and \f$ q\f$.
+It is used to compute the point right of a line with maximum unsigned distance to the line.
*/
-typedef unspecified_type Less_signed_distance_to_line_2;
+typedef unspecified_type Compare_signed_distance_to_line_2;
/*!
Predicate object type that must provide
@@ -135,7 +127,7 @@ Less_yx_2 less_yx_2_object();
/*!
*/
-Less_signed_distance_to_line_2 less_signed_distance_to_line_2_object();
+Compare_signed_distance_to_line_2 compare_signed_distance_to_line_2_object();
/*!
diff --git a/Convex_hull_2/doc/Convex_hull_2/dependencies b/Convex_hull_2/doc/Convex_hull_2/dependencies
index a4d5f76715e..ba431f4d0a6 100644
--- a/Convex_hull_2/doc/Convex_hull_2/dependencies
+++ b/Convex_hull_2/doc/Convex_hull_2/dependencies
@@ -3,4 +3,5 @@ Kernel_23
STL_Extension
Algebraic_foundations
Circulator
+Convex_hull_3
Stream_support
diff --git a/Convex_hull_2/examples/Convex_hull_2/ch_graham_anderson.cpp b/Convex_hull_2/examples/Convex_hull_2/ch_graham_anderson.cpp
index 68fb6ca8109..9934f5728dd 100644
--- a/Convex_hull_2/examples/Convex_hull_2/ch_graham_anderson.cpp
+++ b/Convex_hull_2/examples/Convex_hull_2/ch_graham_anderson.cpp
@@ -12,8 +12,6 @@ OutputIterator
ch_graham_anderson( InputIterator first, InputIterator beyond,
OutputIterator result, const Traits& ch_traits)
{
- using namespace boost;
-
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Less_xy_2 Less_xy_2;
typedef typename Traits::Less_rotate_ccw_2 Less_rotate_ccw_2;
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
index 0ad2835420a..ae896d3e374 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
@@ -220,8 +220,6 @@ ch_akl_toussaint(ForwardIterator first, ForwardIterator last,
OutputIterator result,
const Traits& ch_traits)
{
- using namespace boost;
-
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Left_turn_2 Left_of_line;
// added
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h
index 2a4f0abe3a9..cd48b9b9e67 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h
@@ -34,15 +34,16 @@ ch_bykat(InputIterator first, InputIterator last,
OutputIterator result,
const Traits& ch_traits)
{
- using namespace boost;
+ typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Left_turn_2 Left_turn_2;
- typedef typename Traits::Less_signed_distance_to_line_2 Less_dist;
- typedef typename Traits::Equal_2 Equal_2;
+ typedef typename Traits::Compare_signed_distance_to_line_2 Compare_dist_2;
+ typedef typename Traits::Equal_2 Equal_2;
+ typedef typename Traits::Left_turn_2 Left_turn_2;
+ typedef typename Traits::Less_xy_2 Less_xy_2;
- Left_turn_2 left_turn = ch_traits.left_turn_2_object();
- Equal_2 equal_points = ch_traits.equal_2_object();
+ Equal_2 equal_points = ch_traits.equal_2_object();
+ Left_turn_2 left_turn = ch_traits.left_turn_2_object();
+ Less_xy_2 less_xy = ch_traits.less_xy_2_object();
if (first == last) return result;
@@ -79,12 +80,24 @@ ch_bykat(InputIterator first, InputIterator last,
for (;;)
{
- // This functor must be in the for loop so that the Convex_hull_constructive traits_2 works correctly
- Less_dist less_dist = ch_traits.less_signed_distance_to_line_2_object();
+ // This functor must be in the for loop so that the Convex_hull_constructive traits_2 works correctly
+ Compare_dist_2 cmp_dist = ch_traits.compare_signed_distance_to_line_2_object();
+
if ( l != r)
{
- Point_2 c = *std::min_element( l, r, [&less_dist,&a,&b](const Point_2&p1, const Point_2& p2)
- { return less_dist(a, b, p1, p2); });
+ // We need the farthest point, but since we are on the right side of the line,
+ // signed distances are negative. Hence std::min_element.
+ auto less_dist = [&a, &b, &cmp_dist, &less_xy](const Point_2&p1, const Point_2& p2) -> bool
+ {
+ CGAL::Comparison_result res = cmp_dist(a, b, p1, p2);
+ if(res == CGAL::EQUAL)
+ return less_xy(p1, p2);
+
+ return (res == CGAL::SMALLER);
+ };
+
+ Point_2 c = *std::min_element( l, r, less_dist);
+
H.push_back( b );
L.push_back( l );
R.push_back( l = std::partition(l, r, [&left_turn,&c,&b](const Point_2&p)
@@ -126,17 +139,18 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last,
OutputIterator result,
const Traits& ch_traits)
{
- using namespace boost;
+ typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Left_turn_2 Left_turn_2;
- typedef typename Traits::Less_signed_distance_to_line_2
- Less_dist;
- typedef typename std::vector< Point_2 >::iterator
- PointIterator;
- typedef typename Traits::Equal_2 Equal_2;
+ typedef typename Traits::Compare_signed_distance_to_line_2 Compare_dist_2;
+ typedef typename Traits::Equal_2 Equal_2;
+ typedef typename Traits::Left_turn_2 Left_turn_2;
+ typedef typename Traits::Less_xy_2 Less_xy_2;
- Equal_2 equal_points = ch_traits.equal_2_object();
+ typedef typename std::vector< Point_2 >::iterator PointIterator;
+
+ Equal_2 equal_points = ch_traits.equal_2_object();
+ Left_turn_2 left_turn = ch_traits.left_turn_2_object();
+ Less_xy_2 less_xy = ch_traits.less_xy_2_object();
if (first == last) return result;
@@ -172,21 +186,33 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last,
#endif // no postconditions ...
H.push_back( a );
L.push_back( Pbegin );
- Left_turn_2 left_turn = ch_traits.left_turn_2_object();
R.push_back( l = std::partition( Pbegin, Pend, [&left_turn,&a,&b](const Point_2&p)
{ return left_turn(a, b, p); }));
r = std::partition( l, Pend, [&left_turn,&a,&b](const Point_2&p)
{ return left_turn(b, a, p); });
- Less_dist less_dist = ch_traits.less_signed_distance_to_line_2_object();
for (;;)
{
+ // This functor must be in the for loop so that the Convex_hull_constructive traits_2 works correctly
+ Compare_dist_2 cmp_dist = ch_traits.compare_signed_distance_to_line_2_object();
+
if ( l != r)
{
if ( r-l > CGAL_ch_THRESHOLD )
{
- Point_2 c = *std::min_element( l, r, [&less_dist,&a,&b](const Point_2&p1, const Point_2& p2)
- { return less_dist(a, b, p1, p2); });
+ // We need the farthest point, but since we are on the right side of the line,
+ // signed distances are negative. Hence std::min_element.
+ auto less_dist = [&a, &b, &cmp_dist, &less_xy](const Point_2&p1, const Point_2& p2) -> bool
+ {
+ CGAL::Comparison_result res = cmp_dist(a, b, p1, p2);
+ if(res == CGAL::EQUAL)
+ return less_xy(p1, p2);
+
+ return (res == CGAL::SMALLER);
+ };
+
+ Point_2 c = *std::min_element( l, r, less_dist);
+
H.push_back( b );
L.push_back( l );
R.push_back( l = std::partition(l, r, [&left_turn,&c,&b](const Point_2&p)
@@ -199,15 +225,14 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last,
{
std::swap( a, *--l);
std::swap( b, *++r);
- if ( ch_traits.less_xy_2_object()(*l,*r) )
+ if ( less_xy(*l,*r) )
{
- std::sort(std::next(l), r,
- ch_traits.less_xy_2_object() );
+ std::sort(std::next(l), r, less_xy);
}
else
{
- std::sort(std::next(l), r, [&ch_traits](const Point_2&p1, const Point_2& p2)
- { return ch_traits.less_xy_2_object()(p2, p1); });
+ std::sort(std::next(l), r, [&less_xy](const Point_2&p1, const Point_2& p2)
+ { return less_xy(p2, p1); });
}
ch__ref_graham_andrew_scan(l, std::next(r), res, ch_traits);
std::swap( a, *l);
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h
index 19df2467657..c72f79f4c90 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h
@@ -34,13 +34,15 @@ ch__recursive_eddy(List& L,
ListIterator a_it, ListIterator b_it,
const Traits& ch_traits)
{
- using namespace boost;
+ typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Point_2 Point_2;
- typedef typename Traits::Left_turn_2 Left_turn_2;
- typedef typename Traits::Less_signed_distance_to_line_2 Less_dist;
+ typedef typename Traits::Compare_signed_distance_to_line_2 Compare_dist_2;
+ typedef typename Traits::Less_xy_2 Less_xy_2;
+ typedef typename Traits::Left_turn_2 Left_turn_2;
- Left_turn_2 left_turn = ch_traits.left_turn_2_object();
+ Compare_dist_2 cmp_dist = ch_traits.compare_signed_distance_to_line_2_object();
+ Left_turn_2 left_turn = ch_traits.left_turn_2_object();
+ Less_xy_2 less_xy = ch_traits.less_xy_2_object();
CGAL_ch_precondition( \
std::find_if(a_it, b_it, \
@@ -48,13 +50,23 @@ ch__recursive_eddy(List& L,
{ return left_turn(*b_it, *a_it, p); }) \
!= b_it );
+ const Point_2& a = *a_it;
+ const Point_2& b = *b_it;
ListIterator f_it = std::next(a_it);
- Less_dist less_dist = ch_traits.less_signed_distance_to_line_2_object();
- ListIterator
- c_it = std::min_element( f_it, b_it, // max before
- [&less_dist, a_it, b_it](const Point_2& p1, const Point_2& p2)
- { return less_dist(*a_it, *b_it, p1, p2); });
+
+ // We need the farthest point, but since we are on the right side of the line,
+ // signed distances are negative. Hence std::min_element.
+ auto less_dist = [&a, &b, &cmp_dist, &less_xy](const Point_2&p1, const Point_2& p2) -> bool
+ {
+ CGAL::Comparison_result res = cmp_dist(a, b, p1, p2);
+ if(res == CGAL::EQUAL)
+ return less_xy(p1, p2);
+
+ return (res == CGAL::SMALLER);
+ };
+
+ ListIterator c_it = std::min_element( f_it, b_it, less_dist);
Point_2 c = *c_it;
c_it = std::partition(f_it, b_it, [&left_turn, &c, a_it](const Point_2& p)
@@ -80,8 +92,6 @@ ch_eddy(InputIterator first, InputIterator last,
OutputIterator result,
const Traits& ch_traits)
{
- using namespace boost;
-
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Left_turn_2 Left_turn_2;
typedef typename Traits::Equal_2 Equal_2;
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
index e04da83d4ee..1ecdd0b7ea8 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
@@ -36,8 +36,6 @@ ch_jarvis_march(ForwardIterator first, ForwardIterator last,
OutputIterator result,
const Traits& ch_traits)
{
- using namespace boost;
-
if (first == last) return result;
typedef typename Traits::Less_rotate_ccw_2 Less_rotate_ccw;
typedef typename Traits::Equal_2 Equal_2;
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h
index 6ee62979250..4af027e992d 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h
@@ -15,14 +15,14 @@
#include
-
#ifndef CGAL_CH_NO_POSTCONDITIONS
#include
#endif // CGAL_CH_NO_POSTCONDITIONS
#include
-#include
-#include
+
+#include
+#include
namespace CGAL {
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/convexity_check_2_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
index 3e5b88d8d6a..ca7a5a24e55 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
@@ -181,8 +181,6 @@ ch_brute_force_chain_check_2(ForwardIterator1 first1,
ForwardIterator2 last2,
const Traits& ch_traits )
{
- using namespace boost;
-
typedef typename Traits::Left_turn_2 Left_turn_2;
ForwardIterator1 iter11;
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_projective_xy_traits_2.h b/Convex_hull_2/include/CGAL/Convex_hull_projective_xy_traits_2.h
deleted file mode 100644
index 00e54553eef..00000000000
--- a/Convex_hull_2/include/CGAL/Convex_hull_projective_xy_traits_2.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2001 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-//
-// $URL$
-// $Id$
-// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
-//
-//
-// Author(s) : Susan Hert
-
-#ifndef CGAL_CONVEX_HULL_PROJECTIVE_XY_TRAITS_2_H
-#define CGAL_CONVEX_HULL_PROJECTIVE_XY_TRAITS_2_H
-
-#include
-
-
-
-#define CGAL_DEPRECATED_HEADER ""
-#define CGAL_REPLACEMENT_HEADER ""
-#include
-
-#include
-
-namespace CGAL {
-
-template
-class Less_xy_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()) == SMALLER;
- }
-};
-
-template
-class Equal_xy_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()) == EQUAL;
- }
-};
-
-template
-class Less_yx_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()) == SMALLER;
- }
-};
-
-template
-class Left_turn_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
- {
- return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()) ==
- LEFT_TURN;
- }
-};
-
-template
-class Less_dist_to_line_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q,
- const Point_3& r, const Point_3& s) const
- {
- Comparison_result
- res = cmp_signed_dist_to_lineC2(p.x(), p.y(), q.x(), q.y(),
- r.x(), r.y(), s.x(), s.y());
- if ( res == LARGER )
- return false;
- else if ( res == SMALLER )
- return true;
- else
- return compare_lexicographically_xyC2(r.x(), r.y(), s.x(), s.y())
- == SMALLER;
- }
-};
-
-template
-class Less_rotate_ccw_plane_xy_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& r, const Point_3& p, const Point_3& q) const
- {
- Orientation orient =
- orientationC2(r.x(), r.y(), p.x(), p.y(), q.x(), q.y());
- if ( orient == LEFT_TURN )
- return true;
- else if ( orient == RIGHT_TURN )
- return false;
- else
- {
- if (p.x() == r.x() && p.y() == r.y()) return false;
- if (q.x() == r.x() && q.y() == r.y()) return true;
- if (p.x() == q.x() && p.y() == q.y()) return false;
- return
- collinear_are_ordered_along_lineC2(r.x(), r.y(),
- q.x(), q.y(), p.x(), p.y());
- }
- }
-};
-
-
-template
-class Convex_hull_projective_xy_traits_2
-{
-public:
- typedef Point_3 Point_2;
- typedef Less_xy_plane_xy_2 Less_xy_2;
- typedef Equal_xy_plane_xy_2 Equal_2;
- typedef Less_yx_plane_xy_2 Less_yx_2;
- typedef Left_turn_plane_xy_2 Left_turn_2;
- typedef Less_rotate_ccw_plane_xy_2 Less_rotate_ccw_2;
- typedef Less_dist_to_line_plane_xy_2
- Less_signed_distance_to_line_2;
- Less_xy_2
- less_xy_2_object() const
- { return Less_xy_2(); }
-
- Equal_2
- equal_2_object() const
- { return Equal_2(); }
-
- Less_yx_2
- less_yx_2_object() const
- { return Less_yx_2(); }
-
- Left_turn_2
- left_turn_2_object() const
- { return Left_turn_2(); }
-
- Less_rotate_ccw_2
- less_rotate_ccw_2_object() const
- { return Less_rotate_ccw_2(); }
-
- Less_signed_distance_to_line_2
- less_signed_distance_to_line_2_object() const
- { return Less_signed_distance_to_line_2(); }
-};
-
-}
-#endif // CGAL_CONVEX_HULL_PROJECTIVE_XY_TRAITS_2_H
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_projective_xz_traits_2.h b/Convex_hull_2/include/CGAL/Convex_hull_projective_xz_traits_2.h
deleted file mode 100644
index 382d9b8bfa8..00000000000
--- a/Convex_hull_2/include/CGAL/Convex_hull_projective_xz_traits_2.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) 2001 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-//
-// $URL$
-// $Id$
-// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
-//
-//
-// Author(s) : Susan Hert
-
-#ifndef CGAL_CONVEX_HULL_PROJECTIVE_XZ_TRAITS_2_H
-#define CGAL_CONVEX_HULL_PROJECTIVE_XZ_TRAITS_2_H
-
-#include
-
-
-#define CGAL_DEPRECATED_HEADER ""
-#define CGAL_REPLACEMENT_HEADER ""
-#include
-
-#include
-#include
-#include
-
-namespace CGAL {
-
-template
-class Less_xy_plane_xz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.x(), p.z(), q.x(), q.z()) == SMALLER;
- }
-};
-
-template
-class Equal_xy_plane_xz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.x(), p.z(), q.x(), q.z()) == EQUAL;
- }
-};
-
-template
-class Less_yx_plane_xz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.z(), p.x(), q.z(), q.x()) == SMALLER;
- }
-};
-
-template
-class Left_turn_plane_xz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
- {
- return orientationC2(p.x(), p.z(), q.x(), q.z(), r.x(), r.z())
- == LEFT_TURN;
- }
-};
-
-
-template
-class Less_dist_to_line_plane_xz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q,
- const Point_3& r, const Point_3& s) const
- {
- Comparison_result
- res = cmp_signed_dist_to_lineC2(p.x(), p.z(), q.x(), q.z(),
- r.x(), r.z(), s.x(), s.z());
- if ( res == LARGER )
- return false;
- else if ( res == SMALLER )
- return true;
- else
- return compare_lexicographically_xyC2(r.x(), r.z(), s.x(), s.z())
- == SMALLER;
- }
-};
-
-
-template
-class Less_rotate_ccw_plane_xz_2
-{
-public:
-
- typedef bool result_type;
-
- bool
- operator()(const Point_3& r, const Point_3& p, const Point_3& q) const
- {
- Orientation orient =
- orientationC2(r.x(), r.z(), p.x(), p.z(), q.x(), q.z());
- if ( orient == LEFT_TURN )
- return true;
- else if ( orient == RIGHT_TURN )
- return false;
- else
- {
- if (p.x() == r.x() && p.z() == r.z()) return false;
- if (q.x() == r.x() && q.z() == r.z()) return true;
- if (p.x() == q.x() && p.z() == q.z()) return false;
- return
- collinear_are_ordered_along_lineC2(r.x(), r.z(),
- q.x(), q.z(), p.x(), p.z());
- }
- }
-
-};
-
-
-
-template
-class Convex_hull_projective_xz_traits_2
-{
-public:
- typedef Point_3 Point_2;
- typedef Less_xy_plane_xz_2 Less_xy_2;
- typedef Equal_xy_plane_xz_2 Equal_2;
- typedef Less_yx_plane_xz_2 Less_yx_2;
- typedef Left_turn_plane_xz_2 Left_turn_2;
- typedef Less_rotate_ccw_plane_xz_2 Less_rotate_ccw_2;
- typedef Less_dist_to_line_plane_xz_2
- Less_signed_distance_to_line_2;
- Less_xy_2
- less_xy_2_object() const
- { return Less_xy_2(); }
-
- Equal_2
- equal_2_object() const
- { return Equal_2(); }
-
- Less_yx_2
- less_yx_2_object() const
- { return Less_yx_2(); }
-
- Left_turn_2
- left_turn_2_object() const
- { return Left_turn_2(); }
-
- Less_rotate_ccw_2
- less_rotate_ccw_2_object() const
- { return Less_rotate_ccw_2(); }
-
- Less_signed_distance_to_line_2
- less_signed_distance_to_line_2_object() const
- { return Less_signed_distance_to_line_2(); }
-
-};
-
-}
-
-#endif // CGAL_CONVEX_HULL_PROJECTIVE_XZ_TRAITS_2_H
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_projective_yz_traits_2.h b/Convex_hull_2/include/CGAL/Convex_hull_projective_yz_traits_2.h
deleted file mode 100644
index 34e43feff71..00000000000
--- a/Convex_hull_2/include/CGAL/Convex_hull_projective_yz_traits_2.h
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright (c) 2001 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-//
-// $URL$
-// $Id$
-// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
-//
-//
-// Author(s) : Susan Hert
-
-#ifndef CGAL_CONVEX_HULL_PROJECTIVE_YZ_TRAITS_2_H
-#define CGAL_CONVEX_HULL_PROJECTIVE_YZ_TRAITS_2_H
-
-#include
-
-
-#define CGAL_DEPRECATED_HEADER ""
-#define CGAL_REPLACEMENT_HEADER ""
-#include
-
-#include
-
-namespace CGAL {
-
-template
-class Less_xy_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.y(), p.z(), q.y(), q.z()) == SMALLER;
- }
-};
-
-template
-class Equal_xy_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.y(), p.z(), q.y(), q.z()) == EQUAL;
- }
-};
-
-template
-class Less_yx_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q) const
- {
- return
- compare_lexicographically_xyC2(p.z(), p.y(), q.z(), q.y()) == SMALLER;
- }
-};
-
-template
-class Left_turn_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
- {
- return orientationC2(p.y(), p.z(), q.y(), q.z(), r.y(), r.z())
- == LEFT_TURN;
- }
-};
-
-template
-class Left_of_line_plane_yz_2
-{
-public:
- Left_of_line_plane_yz_2(const Point_3& a, const Point_3& b):
- p_a(a), p_b(b)
- { }
-
- bool
- operator()(const Point_3& c) const
- {
- return orientationC2(p_a.y(), p_a.z(), p_b.y(), p_b.z(), c.y(), c.z()) ==
- LEFT_TURN;
- }
-private:
- Point_3 p_a;
- Point_3 p_b;
-};
-
-template
-class Less_dist_to_line_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& p, const Point_3& q,
- const Point_3& r, const Point_3& s) const
- {
- Comparison_result
- res = cmp_signed_dist_to_lineC2(p.y(), p.z(), q.y(), q.z(),
- r.y(), r.z(), s.y(), s.z());
- if ( res == LARGER )
- return false;
- else if ( res == SMALLER )
- return true;
- else
- return compare_lexicographically_xyC2(r.y(), r.z(), s.y(), s.z())
- == SMALLER;
- }
-};
-
-template
-class Less_rotate_ccw_plane_yz_2
-{
-public:
- typedef bool result_type;
-
- bool
- operator()(const Point_3& r, const Point_3& p, const Point_3& q) const
- {
- Orientation orient =
- orientationC2(r.y(), r.z(), p.y(), p.z(), q.y(), q.z());
- if ( orient == LEFT_TURN )
- return true;
- else if ( orient == RIGHT_TURN )
- return false;
- else
- {
- if (p.y() == r.y() && p.z() == r.z()) return false;
- if (q.y() == r.y() && q.z() == r.z()) return true;
- if (p.y() == q.y() && p.z() == q.z()) return false;
- return
- collinear_are_ordered_along_lineC2(r.y(), r.z(),
- q.y(), q.z(), p.y(), p.z());
- }
- }
-};
-
-
-
-template
-class Convex_hull_projective_yz_traits_2
-{
-public:
- typedef Point_3 Point_2;
- typedef Less_xy_plane_yz_2 Less_xy_2;
- typedef Equal_xy_plane_yz_2 Equal_2;
- typedef Less_yx_plane_yz_2 Less_yx_2;
- typedef Left_turn_plane_yz_2 Left_turn_2;
- typedef Less_dist_to_line_plane_yz_2
- Less_signed_distance_to_line_2;
- typedef Less_rotate_ccw_plane_yz_2 Less_rotate_ccw_plane_2;
-
- Less_xy_2
- less_xy_2_object() const
- { return Less_xy_2(); }
-
- Equal_2
- equal_2_object() const
- { return Equal_2(); }
-
- Less_yx_2
- less_yx_2_object() const
- { return Less_yx_2(); }
-
- Left_turn_2
- left_turn_2_object() const
- { return Left_turn_2(); }
-
- Less_signed_distance_to_line_2
- less_signed_distance_to_line_2_object() const
- { return Less_signed_distance_to_line_2(); }
-
- Less_rotate_ccw_plane_2
- less_rotate_ccw_plane_2_object() const
- { return Less_rotate_ccw_plane_2(); }
-};
-
-}
-
-#endif // CGAL_CONVEX_HULL_PROJECTIVE_YZ_TRAITS_2_H
diff --git a/Convex_hull_2/include/CGAL/Convex_hull_traits_adapter_2.h b/Convex_hull_2/include/CGAL/Convex_hull_traits_adapter_2.h
index cde365a97e7..f5aa3fe06d7 100644
--- a/Convex_hull_2/include/CGAL/Convex_hull_traits_adapter_2.h
+++ b/Convex_hull_2/include/CGAL/Convex_hull_traits_adapter_2.h
@@ -13,16 +13,12 @@
#ifndef CGAL_CONVEX_HULL_TRAITS_ADAPTER_2_H
#define CGAL_CONVEX_HULL_TRAITS_ADAPTER_2_H
-#include
-
#include
#include
-
namespace CGAL{
-
template
class Convex_hull_traits_adapter_2:public Base_traits{
PointPropertyMap ppmap_;
@@ -90,12 +86,12 @@ public:
}
};
- struct Less_signed_distance_to_line_2 : public Base_traits::Less_signed_distance_to_line_2{
- Less_signed_distance_to_line_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_signed_distance_to_line_2& base):
- Base_traits::Less_signed_distance_to_line_2(base),ppmap_(ppmap){}
+ struct Compare_signed_distance_to_line_2 : public Base_traits::Compare_signed_distance_to_line_2{
+ Compare_signed_distance_to_line_2(const PointPropertyMap& ppmap,const typename Base_traits::Compare_signed_distance_to_line_2& base):
+ Base_traits::Compare_signed_distance_to_line_2(base),ppmap_(ppmap){}
const PointPropertyMap& ppmap_;
bool operator()(Arg_type p,Arg_type q, Arg_type r, Arg_type s) const {
- return static_cast(this)->operator()(get(ppmap_,p),get(ppmap_,q),get(ppmap_,r),get(ppmap_,s));
+ return static_cast(this)->operator()(get(ppmap_,p),get(ppmap_,q),get(ppmap_,r),get(ppmap_,s));
}
};
@@ -103,7 +99,7 @@ public:
Left_turn_2 left_turn_2_object () const {return Left_turn_2(ppmap_,static_cast(this)->left_turn_2_object() );}
Orientation_2 orientation_2_object () const {return Orientation_2(ppmap_,static_cast(this)->orientation_2_object() );}
Less_rotate_ccw_2 less_rotate_ccw_2_object () const {return Less_rotate_ccw_2(ppmap_,static_cast(this)->less_rotate_ccw_2_object() );}
- Less_signed_distance_to_line_2 less_signed_distance_to_line_2_object () const {return Less_signed_distance_to_line_2(ppmap_,static_cast(this)->less_signed_distance_to_line_2_object() );}
+ Compare_signed_distance_to_line_2 compare_signed_distance_to_line_2_object () const {return Compare_signed_distance_to_line_2(ppmap_,static_cast(this)->compare_signed_distance_to_line_2_object() );}
Less_xy_2 less_xy_2_object () const {return Less_xy_2(ppmap_,static_cast(this)->less_xy_2_object() );}
Less_yx_2 less_yx_2_object () const {return Less_yx_2(ppmap_,static_cast(this)->less_yx_2_object() );}
@@ -113,6 +109,4 @@ public:
} //namespace CGAL
-#include
-
#endif //CGAL_CONVEX_HULL_TRAITS_ADAPTER_2_H
diff --git a/Convex_hull_2/include/CGAL/ch_bykat.h b/Convex_hull_2/include/CGAL/ch_bykat.h
index 6170bca3bcf..db8e27fbf98 100644
--- a/Convex_hull_2/include/CGAL/ch_bykat.h
+++ b/Convex_hull_2/include/CGAL/ch_bykat.h
@@ -23,7 +23,7 @@
namespace CGAL {
// same as |convex_hull_2(first,last,result)|. {\sc traits}:
-// uses |Traits::Point_2|, |Traits::Less_signed_distance_to_line_2|,
+// uses |Traits::Point_2|, |Traits::Compare_signed_distance_to_line_2|,
// |Traits::Left_turn_2|,, |Traits::Equal_2| and |Traits::Less_xy_2|.
template
OutputIterator
diff --git a/Convex_hull_2/include/CGAL/ch_eddy.h b/Convex_hull_2/include/CGAL/ch_eddy.h
index 4bfafca67b8..9f0f9ec229b 100644
--- a/Convex_hull_2/include/CGAL/ch_eddy.h
+++ b/Convex_hull_2/include/CGAL/ch_eddy.h
@@ -23,7 +23,7 @@
namespace CGAL {
// same as |convex_hull_2(first,last,result)|. {\sc traits}: uses
-// |Traits::Point_2|, |Traits::Less_signed_distance_to_line_2|,
+// |Traits::Point_2|, |Traits::Compare_signed_distance_to_line_2|,
// |Traits::Left_turn_2|, |Traits::Equal_2| and |Traits::Less_xy_2|.
template
OutputIterator
diff --git a/Convex_hull_2/include/CGAL/ch_function_objects_2.h b/Convex_hull_2/include/CGAL/ch_function_objects_2.h
deleted file mode 100644
index a64b5553b47..00000000000
--- a/Convex_hull_2/include/CGAL/ch_function_objects_2.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2002 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-//
-// $URL$
-// $Id$
-// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
-//
-//
-// Author(s) : Susan Hert
-
-#ifndef CGAL_CH_FUNCTION_OBJECTS_2_H
-#define CGAL_CH_FUNCTION_OBJECTS_2_H
-
-#include
-
-
-#include
-
-namespace CGAL {
-
-namespace internal {
-
-template
-class r_Less_dist_to_line
-{
-public:
- typedef bool result_type;
-
- typedef typename R::Point_2 Point;
- typedef typename R::Line_2 Line;
-
- r_Less_dist_to_line() : line_constructed( false )
- { }
-
- bool operator()(const Point& a, const Point& b,
- const Point& c, const Point& d) const
- {
- if (!line_constructed)
- {
- line_constructed = true;
- l_ab = Line(a,b);
- }
- Comparison_result res = compare_signed_distance_to_line(l_ab, c, d);
- if ( res == SMALLER )
- {
- return true;
- }
- else if ( res == EQUAL )
- {
- return lexicographically_xy_smaller( c, d );
- }
- else
- {
- return false;
- }
- }
-
-private:
- mutable bool line_constructed;
- mutable Line l_ab;
-};
-
-} // namespace internal
-
-} //namespace CGAL
-
-#endif // CGAL_CH_FUNCTION_OBJECTS_2_H
diff --git a/Convex_hull_2/include/CGAL/convex_hull_constructive_traits_2.h b/Convex_hull_2/include/CGAL/convex_hull_constructive_traits_2.h
index bdc71698181..4bc0c269bed 100644
--- a/Convex_hull_2/include/CGAL/convex_hull_constructive_traits_2.h
+++ b/Convex_hull_2/include/CGAL/convex_hull_constructive_traits_2.h
@@ -19,19 +19,62 @@
#include
-
-#include
+#include
namespace CGAL {
+namespace Convex_hulls_2 {
+namespace internal {
+
+template
+class Compare_signed_distance_to_cached_line_2
+ : public R::Compare_signed_distance_to_line_2
+{
+ typedef typename R::Compare_signed_distance_to_line_2 Base;
+
+public:
+ typedef CGAL::Comparison_result result_type;
+
+ typedef typename R::Point_2 Point;
+ typedef typename R::Line_2 Line;
+
+ Compare_signed_distance_to_cached_line_2(const Base& base_f)
+ : Base(base_f),
+ line_constructed(false)
+ { }
+
+ using Base::operator();
+
+ result_type operator()(const Point& a, const Point& b,
+ const Point& c, const Point& d) const
+ {
+ if(!line_constructed)
+ {
+ line_constructed = true;
+ l_ab = Line(a,b);
+ }
+
+ return operator()(l_ab, c, d);
+ }
+
+private:
+ mutable bool line_constructed;
+ mutable Line l_ab;
+};
+
+} // namespace internal
+} // namespace Convex_hulls_2
+
template
-class Convex_hull_constructive_traits_2 : public K_
+class Convex_hull_constructive_traits_2
+ : public K_
{
public:
typedef K_ K;
typedef typename K::Point_2 Point_2;
typedef typename K::Less_xy_2 Less_xy_2;
typedef typename K::Less_yx_2 Less_yx_2;
- typedef internal::r_Less_dist_to_line Less_signed_distance_to_line_2;
+ typedef Convex_hulls_2::internal::Compare_signed_distance_to_cached_line_2
+ Compare_signed_distance_to_line_2;
typedef typename K::Less_rotate_ccw_2 Less_rotate_ccw_2;
typedef typename K::Left_turn_2 Left_turn_2;
typedef typename K::Equal_2 Equal_2;
@@ -45,9 +88,12 @@ public:
less_yx_2_object() const
{ return Less_yx_2(); }
- Less_signed_distance_to_line_2
- less_signed_distance_to_line_2_object() const
- { return Less_signed_distance_to_line_2(); }
+ Compare_signed_distance_to_line_2
+ compare_signed_distance_to_line_2_object() const
+ {
+ return Compare_signed_distance_to_line_2(
+ this->K_::compare_signed_distance_to_line_2_object());
+ }
Less_rotate_ccw_2
less_rotate_ccw_2_object() const
@@ -62,15 +108,12 @@ public:
{ return Equal_2(); }
};
-
// for backward compatability
-
template
-class convex_hull_constructive_traits_2 :
- public Convex_hull_constructive_traits_2
-{
-};
+class convex_hull_constructive_traits_2
+ : public Convex_hull_constructive_traits_2
+{ };
-} //namespace CGAL
+} // namespace CGAL
#endif // CGAL_CONVEX_HULL_CONSTRUCTIVE_TRAITS_2_H
diff --git a/Convex_hull_2/test/Convex_hull_2/ch2_point_with_info.cpp b/Convex_hull_2/test/Convex_hull_2/ch2_point_with_info.cpp
index ec09b732d5d..72dee810a9a 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch2_point_with_info.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch2_point_with_info.cpp
@@ -1,14 +1,17 @@
-#include
#include
+
#include
#include
+
#include
+#include
+#include
+#include
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
-
template
struct Forward_bool_functor
: public F
@@ -51,7 +54,7 @@ struct CH_traits_for_point_ids
typedef CGAL::Convex_hull_traits_2 Base;
typedef Forward_bool_functor Less_xy_2;
typedef Forward_bool_functor Less_yx_2;
- typedef Forward_bool_functor Less_signed_distance_to_line_2;
+ typedef Forward_bool_functor Compare_signed_distance_to_line_2;
typedef Forward_bool_functor Less_rotate_ccw_2;
typedef Forward_bool_functor Left_turn_2;
typedef Forward_bool_functor Equal_2;
@@ -86,9 +89,9 @@ struct CH_traits_for_point_ids
return Less_yx_2(points);
}
- Less_signed_distance_to_line_2 less_signed_distance_to_line_2_object () const
+ Compare_signed_distance_to_line_2 compare_signed_distance_to_line_2_object () const
{
- return Less_signed_distance_to_line_2(points);
+ return Compare_signed_distance_to_line_2(points);
}
Less_rotate_ccw_2 less_rotate_ccw_2_object () const
@@ -128,5 +131,5 @@ int main()
assert( result.size() == 3 );
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch2_projection_3.cpp b/Convex_hull_2/test/Convex_hull_2/ch2_projection_3.cpp
index 31fdb40cb25..f9dd6532695 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch2_projection_3.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch2_projection_3.cpp
@@ -1,6 +1,8 @@
#include
+
#include
#include
+
#include
#include
@@ -8,18 +10,20 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Projection_traits_xy_3 Traits;
typedef Traits::Point_2 Point_2;
-int main(){
+int main()
+{
std::vector points;
std::ifstream input("data/CD500");
double x,y;
- while (input >> x >> y){
+ while(input >> x >> y)
+ {
points.push_back(Point_2(x,y,3.));
}
std::vector ch2;
-
CGAL::convex_hull_2(points.begin(),points.end(),std::back_inserter(ch2),Traits());
-
std::cout << ch2.size() << std::endl;
+
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp
index 54d23ac3f68..bb9bccab77c 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp
@@ -1,33 +1,9 @@
-// ============================================================================
-//
-// Copyright (c) 1999 The CGAL Consortium
-//
-//
-//
-//
-//
-// ----------------------------------------------------------------------------
-// release :
-// release_date :
-//
-// file : ch_test_CH.C
-// revision : $Id$
-// revision_date : $Date$
-// author(s) : Stefan Schirra
-//
-// coordinator : MPI, Saarbruecken
-// ============================================================================
+#include
#include
-#include
-#include
+
#include
-#include
-
-#include
-#include
-
#ifdef CGAL_USE_LEDA
#include
#include
@@ -37,28 +13,23 @@
#include
#endif
-#include
-
-int
-main()
+int main()
{
#ifdef CGAL_USE_LEDA
- CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous >
- cch_H_integer;
- std::cout << "Homogeneous: C ";
- CGAL::ch__batch_test( cch_H_integer );
+ CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous > cch_H_integer;
+ std::cout << "Homogeneous:" << std::endl;
+ CGAL::ch__batch_test(cch_H_integer);
#endif
#ifdef CGAL_USE_GMP
- CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous >
- cch_H_gmp;
- std::cout << "Homogeneous: C ";
- CGAL::ch__batch_test( cch_H_gmp );
+ CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous > cch_H_gmp;
+ std::cout << "Homogeneous:" << std::endl;
+ CGAL::ch__batch_test(cch_H_gmp);
#endif
- CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous >
- cch_H_double;
- std::cout << "Homogeneous: C ";
- CGAL::ch__batch_test( cch_H_double );
- return 0;
+ CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous > cch_H_double;
+ std::cout << "Homogeneous:" << std::endl;
+ CGAL::ch__batch_test(cch_H_double);
+
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_EPICK.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_EPICK.cpp
new file mode 100644
index 00000000000..71245612e34
--- /dev/null
+++ b/Convex_hull_2/test/Convex_hull_2/ch_test_EPICK.cpp
@@ -0,0 +1,18 @@
+#include
+
+#include
+
+#include
+
+int main()
+{
+ CGAL::Exact_predicates_inexact_constructions_kernel ch_EPICK;
+ std::cout << "EPICK:" << std::endl;
+ CGAL::ch__batch_test(ch_EPICK);
+
+ CGAL::Convex_hull_constructive_traits_2 cch_EPICK;
+ std::cout << "Constructive EPICK:" << std::endl;
+ CGAL::ch__batch_test(cch_EPICK);
+
+ return EXIT_SUCCESS;
+}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp
index abb4139ff1c..26a2c4dca9d 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp
@@ -1,31 +1,6 @@
-// ============================================================================
-//
-// Copyright (c) 1999 The CGAL Consortium
-//
-//
-//
-//
-//
-// ----------------------------------------------------------------------------
-// release :
-// release_date :
-//
-// file : ch_test_SC.C
-// revision : $Id$
-// revision_date : $Date$
-// author(s) : Stefan Schirra
-//
-// coordinator : MPI, Saarbruecken
-// ============================================================================
+#include
#include
-#include
-#include
-
-#include
-
-#include
-#include
#ifdef CGAL_USE_LEDA
#include
@@ -36,25 +11,23 @@
#include
#endif
-#include
-
-int
-main()
+int main()
{
#ifdef CGAL_USE_LEDA
- CGAL::Cartesian ch_C_rational;
- std::cout << "Cartesian: ";
- CGAL::ch__batch_test( ch_C_rational );
+ CGAL::Cartesian ch_C_rational;
+ std::cout << "Cartesian:" << std::endl;
+ CGAL::ch__batch_test(ch_C_rational);
#endif
#ifdef CGAL_USE_GMP
- CGAL::Cartesian > ch_C_Qgmp;
- std::cout << "Cartesian > >: ";
- CGAL::ch__batch_test( ch_C_Qgmp );
+ CGAL::Cartesian > ch_C_Qgmp;
+ std::cout << "Cartesian > >:" << std::endl;
+ CGAL::ch__batch_test(ch_C_Qgmp);
#endif
- CGAL::Cartesian ch_C_double;
- std::cout << "Cartesian: ";
- CGAL::ch__batch_test( ch_C_double );
- return 0;
+ CGAL::Cartesian ch_C_double;
+ std::cout << "Cartesian:" << std::endl;
+ CGAL::ch__batch_test(ch_C_double);
+
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp
index c0ddcb07d92..d8318360621 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp
@@ -1,31 +1,6 @@
-// ============================================================================
-//
-// Copyright (c) 1999 The CGAL Consortium
-//
-//
-//
-//
-//
-// ----------------------------------------------------------------------------
-// release :
-// release_date :
-//
-// file : ch_test_SH.C
-// revision : $Id$
-// revision_date : $Date$
-// author(s) : Stefan Schirra
-//
-// coordinator : MPI, Saarbruecken
-// ============================================================================
+#include
#include
-#include
-#include
-
-#include
-
-#include
-#include
#ifdef CGAL_USE_LEDA
#include
@@ -35,25 +10,24 @@
#ifdef CGAL_USE_GMP
#include
#endif
-#include
-int
-main()
+int main()
{
#ifdef CGAL_USE_LEDA
- CGAL::Homogeneous ch_H_integer;
- std::cout << "Homogeneous: ";
+ CGAL::Homogeneous ch_H_integer;
+ std::cout << "Homogeneous:" << std::endl;
CGAL::ch__batch_test( ch_H_integer );
#endif
#ifdef CGAL_USE_GMP
- CGAL::Homogeneous ch_H_gmp;
- std::cout << "Homogeneous: ";
+ CGAL::Homogeneous ch_H_gmp;
+ std::cout << "Homogeneous:" << std::endl;
CGAL::ch__batch_test( ch_H_gmp );
#endif
- CGAL::Homogeneous ch_H_double;
- std::cout << "Homogeneous: ";
+ CGAL::Homogeneous ch_H_double;
+ std::cout << "Homogeneous:" << std::endl;
CGAL::ch__batch_test( ch_H_double );
- return 0;
+
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp
index 3a5b9edf77e..521f1b41b5a 100644
--- a/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp
+++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp
@@ -1,32 +1,6 @@
-// ============================================================================
-//
-// Copyright (c) 1999 The CGAL Consortium
-//
-//
-//
-//
-//
-// ----------------------------------------------------------------------------
-// release :
-// release_date :
-//
-// file : ch_test_SS.C
-// revision : $Id$
-// revision_date : $Date$
-// author(s) : Stefan Schirra
-//
-// coordinator : MPI, Saarbruecken
-// ============================================================================
-
+#include
#include
-#include
-#include
-
-#include
-
-#include
-#include
#ifdef CGAL_USE_LEDA
#include
@@ -36,25 +10,24 @@
#ifdef CGAL_USE_GMP
#include
#endif
-#include
-int
-main()
+int main()
{
#ifdef CGAL_USE_LEDA
- CGAL::Simple_cartesian ch_S_rational;
- std::cout << "SimpleCartesian: ";
+ CGAL::Simple_cartesian ch_S_rational;
+ std::cout << "SimpleCartesian:" << std::endl;
CGAL::ch__batch_test( ch_S_rational );
#endif
#ifdef CGAL_USE_GMP
- CGAL::Simple_cartesian > ch_S_Qgmp;
- std::cout << "SimpleCartesian > >: ";
+ CGAL::Simple_cartesian > ch_S_Qgmp;
+ std::cout << "SimpleCartesian > >:" << std::endl;
CGAL::ch__batch_test( ch_S_Qgmp );
#endif
- CGAL::Simple_cartesian ch_S_double;
- std::cout << "SimpleCartesian: ";
+ CGAL::Simple_cartesian ch_S_double;
+ std::cout << "SimpleCartesian:" << std::endl;
CGAL::ch__batch_test( ch_S_double );
- return 0;
+
+ return EXIT_SUCCESS;
}
diff --git a/Convex_hull_2/test/Convex_hull_2/include/CGAL/_test_fct_ch_I_2.h b/Convex_hull_2/test/Convex_hull_2/include/CGAL/_test_fct_ch_I_2.h
index 1c7a4b24999..9570bcdb409 100644
--- a/Convex_hull_2/test/Convex_hull_2/include/CGAL/_test_fct_ch_I_2.h
+++ b/Convex_hull_2/test/Convex_hull_2/include/CGAL/_test_fct_ch_I_2.h
@@ -18,21 +18,243 @@
// coordinator : MPI, Saarbruecken
// ============================================================================
-
#ifndef _TEST_FCT_CH_I_2_H
#define _TEST_FCT_CH_I_2_H
-#include
#include
+#include
+
+#include
+
namespace CGAL {
template
-bool
-ch__batch_test( const Traits& chI );
+void ch__batch_test_simple(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
-} //namespace CGAL
+ std::cout << std::endl << " == Test Simple ==" << std::endl;
-#include
+ std::vector points;
+ points.push_back(Point_2( -10, 0, 1));
+ points.push_back(Point_2( -15, -1, 1));
+ points.push_back(Point_2( -7, -10, 1));
+ points.push_back(Point_2( -9, -20, 1));
+ points.push_back(Point_2( -3, -20, 1));
+ points.push_back(Point_2( 74, 0, 1));
+ points.push_back(Point_2( 1, 1, 1));
+ points.push_back(Point_2( 0, 100, 1));
+
+ assert(ch__test(points.begin(), points.end(), chI));
+}
+
+template
+void ch__batch_test_cocircular(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Cocircular ==" << std::endl;
+
+ std::vector cocircular_points;
+ cocircular_points.push_back(Point_2( 39, 80, 89));
+ cocircular_points.push_back(Point_2( 180, 299, 349));
+ cocircular_points.push_back(Point_2( -3, -4, 5));
+ cocircular_points.push_back(Point_2(-651, 260, 701));
+ cocircular_points.push_back(Point_2( 180, -19, 181));
+ cocircular_points.push_back(Point_2(-153, 104, 185));
+ cocircular_points.push_back(Point_2(-247, -96, 265));
+ cocircular_points.push_back(Point_2( -32, 255, 257));
+ cocircular_points.push_back(Point_2( 45, -28, 53));
+ cocircular_points.push_back(Point_2( -12, -35, 37));
+
+ assert(!ch_brute_force_check_2(cocircular_points.begin(), cocircular_points.end(),
+ cocircular_points.begin(), cocircular_points.end(), chI));
+ assert(ch_brute_force_check_2(cocircular_points.begin(), cocircular_points.begin(),
+ cocircular_points.begin(), cocircular_points.end(), chI));
+ assert(ch__test(cocircular_points.begin(), cocircular_points.end(), chI, ch_ALL, ch_CHECK_CONVEXITY));
+
+ std::vector extreme_points;
+ convex_hull_2(cocircular_points.begin(), cocircular_points.end(),
+ std::back_inserter(extreme_points), chI);
+
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.begin(), chI));
+ assert(is_cw_strongly_convex_2(extreme_points.rend(), extreme_points.rend(), chI));
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.begin() + 1, chI));
+ assert(is_cw_strongly_convex_2(extreme_points.begin(), extreme_points.begin() + 1, chI));
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.end(), chI));
+ assert(is_cw_strongly_convex_2(extreme_points.rbegin(), extreme_points.rend(), chI));
+}
+
+template
+void ch__batch_test_cocircular_ordered(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Cocircular (ordered) ==" << std::endl;
+
+ std::vector cocircular_points;
+ cocircular_points.push_back(Point_2( 180, -19, 181));
+ cocircular_points.push_back(Point_2( 45, -28, 53));
+ cocircular_points.push_back(Point_2( -12, -35, 37));
+ cocircular_points.push_back(Point_2( -3, -4, 5));
+ cocircular_points.push_back(Point_2(-247, -96, 265));
+ cocircular_points.push_back(Point_2(-651, 260, 701));
+ cocircular_points.push_back(Point_2(-153, 104, 185));
+ cocircular_points.push_back(Point_2( -32, 255, 257));
+ cocircular_points.push_back(Point_2( 39, 80, 89));
+ cocircular_points.push_back(Point_2( 180, 299, 349));
+
+ assert(!ch_brute_force_check_2(cocircular_points.begin(), cocircular_points.end(),
+ cocircular_points.begin(), cocircular_points.end(), chI));
+ assert(ch_brute_force_check_2(cocircular_points.begin(), cocircular_points.begin(),
+ cocircular_points.begin(), cocircular_points.end(), chI));
+ assert(ch__test(cocircular_points.begin(), cocircular_points.end(), chI, ch_ALL, ch_CHECK_CONVEXITY));
+
+ std::vector extreme_points;
+ convex_hull_2(cocircular_points.begin(), cocircular_points.end(),
+ std::back_inserter(extreme_points), chI);
+
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.begin(), chI));
+ assert(is_cw_strongly_convex_2(extreme_points.rend(), extreme_points.rend(), chI));
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.begin() + 1, chI));
+ assert(is_cw_strongly_convex_2(extreme_points.begin(), extreme_points.begin() + 1, chI));
+ assert(is_ccw_strongly_convex_2(extreme_points.begin(), extreme_points.end(), chI));
+ assert(is_cw_strongly_convex_2(extreme_points.rbegin(), extreme_points.rend(), chI));
+}
+
+template
+void ch__batch_test_collinear(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Collinear ==" << std::endl;
+
+ std::vector collinear_points;
+ collinear_points.push_back(Point_2( 16, 20, 1));
+ collinear_points.push_back(Point_2( 46, 40, 1));
+ collinear_points.push_back(Point_2( 76, 60, 1));
+ collinear_points.push_back(Point_2(106, 80, 1));
+ collinear_points.push_back(Point_2(-14, 0, 1));
+ collinear_points.push_back(Point_2(136, 100, 1));
+
+ assert(ch__test(collinear_points.begin(), collinear_points.end(), chI));
+}
+
+template
+void ch__batch_test_multiple(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Multiple ==" << std::endl;
+
+ std::vector multiple_points;
+ multiple_points.push_back(Point_2(17, 80, 1));
+ multiple_points.push_back(Point_2(17, 80, 1));
+ multiple_points.push_back(Point_2(17, 80, 1));
+ multiple_points.push_back(Point_2(17, 80, 1));
+
+ assert(ch_brute_force_check_2(multiple_points.begin(), multiple_points.end(),
+ multiple_points.begin(), multiple_points.begin() + 1, chI));
+ assert(is_ccw_strongly_convex_2(multiple_points.begin(), multiple_points.begin(), chI));
+
+ assert(ch__test(multiple_points.begin(), multiple_points.end(), chI));
+ assert(ch__test(multiple_points.begin() + 2, multiple_points.begin() + 3, chI));
+}
+
+template
+void ch__batch_test_iso_rectangle(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Iso Rectangle ==" << std::endl;
+
+ std::vector iso_rectangle_points;
+ iso_rectangle_points.push_back(Point_2( 15, 0, 1));
+ iso_rectangle_points.push_back(Point_2( 45, 0, 1));
+ iso_rectangle_points.push_back(Point_2( 70, 0, 10));
+ iso_rectangle_points.push_back(Point_2( 12, 0, 1));
+ iso_rectangle_points.push_back(Point_2( 56, 118, 1));
+ iso_rectangle_points.push_back(Point_2( 27, 118, 1));
+ iso_rectangle_points.push_back(Point_2( 56, 118, 1));
+ iso_rectangle_points.push_back(Point_2(112, 118, 1));
+ iso_rectangle_points.push_back(Point_2( 0, 9, 1));
+ iso_rectangle_points.push_back(Point_2( 0, 78, 1));
+ iso_rectangle_points.push_back(Point_2( 0, 16, 1));
+ iso_rectangle_points.push_back(Point_2( 0, 77, 1));
+ iso_rectangle_points.push_back(Point_2(150, 56, 1));
+ iso_rectangle_points.push_back(Point_2(150, 57, 1));
+ iso_rectangle_points.push_back(Point_2(150, 58, 1));
+ iso_rectangle_points.push_back(Point_2(150, 58, 1));
+
+ assert(ch__test(iso_rectangle_points.begin(), iso_rectangle_points.end(), chI));
+ assert(ch__test(iso_rectangle_points.begin(), iso_rectangle_points.begin()+3, chI));
+ assert(ch__test(iso_rectangle_points.begin()+4, iso_rectangle_points.begin()+7, chI));
+ assert(ch__test(iso_rectangle_points.begin()+5, iso_rectangle_points.begin()+5, chI));
+}
+
+// https://github.com/CGAL/cgal/issues/6723
+template
+void ch__batch_test_issue_6723(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test issue_6723 ==" << std::endl;
+
+ std::vector points = { Point_2( 4, 2, 1),
+ Point_2( 0, 0, 1),
+ Point_2(10, 0, 1),
+ Point_2( 3, 1, 1),
+ Point_2( 3,-1, 1),
+ Point_2( 2, 2, 1),
+ Point_2( 5, 2, 1),
+ Point_2( 9, 2, 1),
+ Point_2( 3, 2, 1) };
+
+ assert(ch__test(points.begin(), points.end(), chI));
+}
+
+template
+void ch__batch_test_random(const Traits& chI)
+{
+ using Point_2 = typename Traits::Point_2;
+
+ std::cout << std::endl << " == Test Random ==" << std::endl;
+
+ CGAL::Random rnd;
+ std::cout << "Random seed = " << rnd.get_seed() << std::endl;
+
+ std::vector points;
+
+ const int h = rnd.get_int(1, 100);
+ for(int i=0; i<10; ++i)
+ {
+ const int x = rnd.get_int(-100, 100);
+ const int y = rnd.get_int(-100, 100);
+ points.emplace_back(x, y, h);
+ }
+
+ assert(ch__test(points.begin(), points.end(), chI));
+}
+
+template