Further clean up

This commit is contained in:
Efi Fogel 2024-09-09 15:25:21 +03:00
parent 7e11bd0c7e
commit a6c965b87f
1 changed files with 277 additions and 279 deletions

View File

@ -78,7 +78,7 @@ private:
using Self = Arr_polycurve_basic_traits_2<Subcurve_traits_2>; using Self = Arr_polycurve_basic_traits_2<Subcurve_traits_2>;
// Data members: // Data members:
const Subcurve_traits_2* m_subcurve_traits; // The base segment-traits class. const Subcurve_traits_2* m_subcurve_traits; // the base segment-traits class.
bool m_own_traits; bool m_own_traits;
protected: protected:
@ -92,8 +92,8 @@ public:
{} {}
/*! Construct from a subcurve traits. /*! Construct from a subcurve traits.
* \param seg_traits an already existing subcurve tarits which is passed will * \param seg_traits an already existing subcurve tarits, which is passed in;
* be used by the class. * it will be used by the class.
*/ */
Arr_polycurve_basic_traits_2(const Subcurve_traits_2* geom_traits) : Arr_polycurve_basic_traits_2(const Subcurve_traits_2* geom_traits) :
m_subcurve_traits(geom_traits), m_own_traits(false) {} m_subcurve_traits(geom_traits), m_own_traits(false) {}
@ -127,8 +127,8 @@ public:
// ArrangementBasicTraits concept. // ArrangementBasicTraits concept.
//@{ //@{
/*! An x monotone polycurve represents a continuous piecewise-linear /*! An \f$x\f$-monotone polycurve represents a continuous piecewise-linear
* curve which is either strongly x-monotone or vertical. Again, * curve which is either strongly \f$x\f$-monotone or vertical. Again,
* the polycurve is without degenerated subcurves. * the polycurve is without degenerated subcurves.
*/ */
using X_monotone_curve_2 = using X_monotone_curve_2 =
@ -136,7 +136,7 @@ public:
using Size = typename X_monotone_curve_2::Size; using Size = typename X_monotone_curve_2::Size;
using size_type = typename X_monotone_curve_2::size_type; using size_type = typename X_monotone_curve_2::size_type;
//! Compare the x-coordinates of two points. //! Compare the \f$x\f$-coordinates of two points.
class Compare_x_2 { class Compare_x_2 {
protected: protected:
using Polycurve_basic_traits_2 = using Polycurve_basic_traits_2 =
@ -153,38 +153,41 @@ public:
{} {}
public: public:
/*! Compare the x-coordinates of two directional points. /*! Compare the \f$x\f$-coordinates of two directional points.
* \param p1 the first directional point. * \param p1 the first directional point.
* \param p2 the second directional point. * \param p2 the second directional point.
* \return SMALLER - x(p1) < x(p2); * \return `SMALLER` - \f$x\f$(`p1`) < \f$x\f$(`p2`);
* EQUAL - x(p1) = x(p2); * `EQUAL` - \f$x\f$(`p1`) = \f$x\f$(`p2`);
* LARGER - x(p1) > x(p2). * `LARGER` - \f$x\f$(`p1`) > \f$x\f$(`p2`).
* \pre p1 does not lie on the boundary. * \pre p1 does not lie on the boundary.
* \pre p2 does not lie on the boundary. * \pre p2 does not lie on the boundary.
*/ */
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{ return m_poly_traits.subcurve_traits_2()->compare_x_2_object()(p1, p2); } { return m_poly_traits.subcurve_traits_2()->compare_x_2_object()(p1, p2); }
/*! Compare two ends of x-monotone curves in x. /*! Compare two ends of \f$x\f$-monotone curves in \f$x\f$.
* \param xs1 the first curve. * \param xs1 the first curve.
* \param ce1 the curve-end indicator of the first x-monotone curve xs1: * \param ce1 the curve-end indicator of the first \f$x\f$-monotone curve
* ARR_MIN_END - the minimal end of xs1 or * `xs1`:
* ARR_MAX_END - the maximal end of xs1. * `ARR_MIN_END` - the minimal end of `xs1` or
* `ARR_MAX_END` - the maximal end of `xs1`.
* \param p2 the second curve end. * \param p2 the second curve end.
*/ */
Comparison_result operator()(const X_monotone_subcurve_2& xs1, Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1, const Point_2& p2) Arr_curve_end ce1, const Point_2& p2)
{ return operator()(xs1, ce1, p2, All_sides_oblivious_category()); } { return operator()(xs1, ce1, p2, All_sides_oblivious_category()); }
/*! Compare two ends of x-monotone curves in x. /*! Compare two ends of \f$x\f$-monotone curves in x.
* \param xs1 the first curve. * \param xs1 the first curve.
* \param ce1 the curve-end indicator of the first x-monotone curve xs1: * \param ce1 the curve-end indicator of the first \f$x\f$-monotone curve
* ARR_MIN_END - the minimal end of xs1 or * `xs1`:
* ARR_MAX_END - the maximal end of xs1. * `ARR_MIN_END` - the minimal end of `xs1` or
* `ARR_MAX_END` - the maximal end of `xs1`.
* \param xs2 the second curve. * \param xs2 the second curve.
* \param ce2 the curve-end indicator of the second x-monoton curve xs2: * \param ce2 the curve-end indicator of the second \f$x\f$-monoton curve
* ARR_MIN_END - the minimal end of xs2 or * `xs2`:
* ARR_MAX_END - the maximal end of xs2. * `ARR_MIN_END` - the minimal end of `xs2` or
* `ARR_MAX_END` - the maximal end of `xs2`.
*/ */
Comparison_result operator()(const X_monotone_subcurve_2& xs1, Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1, Arr_curve_end ce1,
@ -313,40 +316,45 @@ public:
{} {}
public: public:
/*! Compare two directional points lexigoraphically: by x, then by y. /*! Compare two directional points lexigoraphically: by \f$x\f$, then by
* \f$y\f$.
* \param p1 the first endpoint directional point. * \param p1 the first endpoint directional point.
* \param p2 the second endpoint directional point. * \param p2 the second endpoint directional point.
* \return SMALLER - x(p1) < x(p2); * \return
* SMALLER - x(p1) = x(p2) and y(p1) < y(p2); * `SMALLER` - \f$x\f$(p1) < \f$x\f$(p2);
* EQUAL - x(p1) = x(p2) and y(p1) = y(p2); * `SMALLER` - \f$x\f$(p1) = \f$x\f$(p2) and \f$y\f$(p1) < \f$y\f$(p2);
* LARGER - x(p1) = x(p2) and y(p1) > y(p2); * `EQUAL` - \f$x\f$(p1) = \f$x\f$(p2) and \f$y\f$(p1) = \f$y\f$(p2);
* LARGER - x(p1) > x(p2). * `LARGER` - \f$x\f$(p1) = \f$x\f$(p2) and \f$y\f$(p1) > \f$y\f$(p2);
* \pre p1 does not lie on the boundary. * `LARGER` - \f$x\f$(p1) > \f$x\f$(p2).
* \pre p2 does not lie on the boundary. * \pre `p1` does not lie on the boundary.
* \pre `p2` does not lie on the boundary.
*/ */
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{ return m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p1, p2); } { return m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p1, p2); }
/*! Compare two ends of x-monotone curves lexicographically. /*! Compare two ends of \f$x\f$-monotone curves lexicographically.
* \param xs1 the first curve. * \param xs1 the first curve.
* \param ce1 the curve-end indicator of the first x-monotone curve xs1: * \param ce1 the curve-end indicator of the first \f$x\f$-monotone curve
* ARR_MIN_END - the minimal end of xs1 or * `xs1`:
* ARR_MAX_END - the maximal end of xs1. * `ARR_MIN_END` - the lexicographically smallest end of `xs1` or
* `ARR_MAX_END` - the lexicographically largest end of `xs1`.
* \param p2 the second curve end. * \param p2 the second curve end.
*/ */
Comparison_result operator()(const X_monotone_subcurve_2& xs1, Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1, const Point_2& p2) Arr_curve_end ce1, const Point_2& p2)
{ return operator()(xs1, ce1, p2, All_sides_oblivious_category()); } { return operator()(xs1, ce1, p2, All_sides_oblivious_category()); }
/*! Compare two ends of x-monotone curves lexicographically. /*! Compare two ends of \f$x\f$-monotone curves lexicographically.
* \param xs1 the first curve. * \param xs1 the first curve.
* \param ce1 the curve-end indicator of the first x-monotone curve xs1: * \param ce1 the curve-end indicator of the first \f$x\f$-monotone curve
* ARR_MIN_END - the minimal end of xs1 or * `xs1`:
* ARR_MAX_END - the maximal end of xs1. * `ARR_MIN_END` - the minimal end of `xs1` or
* `ARR_MAX_END` - the maximal end of `xs1`.
* \param xs2 the second curve. * \param xs2 the second curve.
* \param ce2 the curve-end indicator of the second x-monoton curve xs2: * \param ce2 the curve-end indicator of the second \f$x\f$-monoton curve
* ARR_MIN_END - the minimal end of xs2 or * `xs2`:
* ARR_MAX_END - the maximal end of xs2. * `ARR_MIN_END` - the minimal end of `xs2` or
* `ARR_MAX_END` - the maximal end of `xs2`.
*/ */
Comparison_result operator()(const X_monotone_subcurve_2& xs1, Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1, Arr_curve_end ce1,
@ -512,7 +520,7 @@ public:
/*! Obtain a Compare_xy_2 functor object. */ /*! Obtain a Compare_xy_2 functor object. */
Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); } Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); }
/*! A functor that obtain the lexicographically left endpoint of an /*! A functor that obtain the lexicographically smallest endpoint of an
* \f$x\f$-monotone curve. * \f$x\f$-monotone curve.
*/ */
class Construct_min_vertex_2 { class Construct_min_vertex_2 {
@ -531,25 +539,25 @@ public:
{} {}
public: public:
/*! Obtain the left endpoint of the x-monotone polycurve. The return type /*! Obtain the left endpoint of the \f$x\f$-monotone polycurve. The return
* is the same as the return type of the corresponding operator in the * type is the same as the return type of the corresponding operator in the
* functor of the subtraits, which is either by value or by reference. * functor of the subtraits, which is either by value or by reference.
* \param cv The polycurve curve. * \param xcv the polycurve curve.
* \return The left lexicographically endpoint. * \return the lexicographically smallest endpoint.
*/ */
using Subcurve_ctr = typename Subcurve_traits_2::Construct_min_vertex_2; using Subcurve_ctr = typename Subcurve_traits_2::Construct_min_vertex_2;
decltype(std::declval<Subcurve_ctr>(). decltype(std::declval<Subcurve_ctr>().
operator()(std::declval<X_monotone_subcurve_2>())) operator()(std::declval<X_monotone_subcurve_2>()))
operator()(const X_monotone_curve_2& cv) const { operator()(const X_monotone_curve_2& xcv) const {
CGAL_assertion(cv.number_of_subcurves() > 0); CGAL_assertion(xcv.number_of_subcurves() > 0);
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER) if (geom_traits->compare_endpoints_xy_2_object()(xcv[0]) == SMALLER)
return geom_traits->construct_min_vertex_2_object()(cv[0]); return geom_traits->construct_min_vertex_2_object()(xcv[0]);
else else
return geom_traits-> return geom_traits->
construct_min_vertex_2_object()(cv[cv.number_of_subcurves()-1]); construct_min_vertex_2_object()(xcv[xcv.number_of_subcurves()-1]);
} }
}; };
@ -557,7 +565,7 @@ public:
Construct_min_vertex_2 construct_min_vertex_2_object() const Construct_min_vertex_2 construct_min_vertex_2_object() const
{ return Construct_min_vertex_2(*this); } { return Construct_min_vertex_2(*this); }
/*! A functor that obtain the lexicographically right endpoint of an /*! A functor that obtain the lexicographically largest endpoint of an
* \f$x\f$-monotone curve. * \f$x\f$-monotone curve.
*/ */
class Construct_max_vertex_2 { class Construct_max_vertex_2 {
@ -576,11 +584,11 @@ public:
{} {}
public: public:
/*! Obtain the right endpoint of the x-monotone polycurve. The return type /*! Obtain the right endpoint of the \f$x\f$-monotone polycurve. The return
* is the same as the return type of the corresponding operator in the * type is the same as the return type of the corresponding operator in the
* functor of the subtraits, which is either by value or by reference. * functor of the subtraits, which is either by value or by reference.
* \param cv The polycurve. * \param xcv the polycurve.
* \return The right lexicographically endpoint. * \return the lexicographically largest endpoint.
*/ */
using Subcurve_ctr = typename Subcurve_traits_2::Construct_max_vertex_2; using Subcurve_ctr = typename Subcurve_traits_2::Construct_max_vertex_2;
decltype(std::declval<Subcurve_ctr>(). decltype(std::declval<Subcurve_ctr>().
@ -616,14 +624,15 @@ public:
{} {}
public: public:
/*! Check whether the given x-monotone curve is a vertical segment. /*! Check whether the given \f$x\f$-monotone curve is a vertical segment.
* \param cv The curve. * \param cv the curve.
* \return (true) if the curve is a vertical segment;(false) otherwise. * \return `true` if the curve is a vertical segment; `false` otherwise.
*/ */
bool operator()(const X_monotone_curve_2& cv) const { bool operator()(const X_monotone_curve_2& cv) const {
// An x-monotone polycurve can represent a vertical segment only if it /* An \f$x\f$-monotone polycurve can represent a vertical segment only if
// comprises vertical segments. If the first subcurve is vertical, * it comprises vertical segments. If the first subcurve is vertical,
// all subcurves are vertical in an x-monotone polycurve * all subcurves are vertical in an \f$x\f$-monotone polycurve
*/
return m_poly_traits.subcurve_traits_2()->is_vertical_2_object()(cv[0]); return m_poly_traits.subcurve_traits_2()->is_vertical_2_object()(cv[0]);
} }
}; };
@ -764,12 +773,13 @@ public:
public: public:
/*! Obtain the location of the given point with respect to the input curve. /*! Obtain the location of the given point with respect to the input curve.
* \param p The point. * \param p the point.
* \param xcv The polycurve curve. * \param xcv the polycurve curve.
* \pre p is in the x-range of cv. * \pre `p` is in the \f$x\f$-range of `xcv`.
* \return SMALLER if y(p) < cv(x(p)), i.e. the point is below the curve; * \return
* LARGER if y(p) > cv(x(p)), i.e. the point is above the curve; * `SMALLER` if \f$y\f$(p) < cv(x(p)), i.e. the point is below the curve;
* EQUAL if p lies on the curve. * `LARGER` if \f$y\f$(p) > cv(x(p)), i.e. the point is above the curve;
* `EQUAL` if `p` lies on the curve.
*/ */
Comparison_result operator()(const Point_2& p, Comparison_result operator()(const Point_2& p,
const X_monotone_curve_2& xcv) const const X_monotone_curve_2& xcv) const
@ -778,16 +788,16 @@ public:
/*! Obtain the location of the given curve_end with respect to the input /*! Obtain the location of the given curve_end with respect to the input
* curve. * curve.
* \param xcv The polycurve curve. * \param xcv The polycurve curve.
* \param ce the curve-end indicator of the x-monotone subcurve xl: * \param ce the curve-end indicator of the \f$x\f$-monotone subcurve xl:
* ARR_MIN_END - the minimal end of xl or * `ARR_MIN_END` - the minimal end of xl or
* ARR_MAX_END - the maximal end of xl. * `ARR_MAX_END` - the maximal end of xl.
* \param xcv The polycurve curve. * \param xcv The polycurve curve.
* \pre the curve-end is in the x-range of xcv. * \pre the curve-end is in the \f$x\f$-range of `xcv`.
* \return SMALLER if if y(xs, ce) < cv(x(xs, ce)), i.e. the curve-end * \return `SMALLER` if if \f$y\f$(xs, ce) < cv(x(xs, ce)), i.e. the
* is below the curve xcv; * curve-end is below the curve xcv;
* LARGER if y(xs, ce) > cv(x(xs, ce)), i.e. the curve-end is * `LARGER` if \f$y\f$(xs, ce) > cv(x(xs, ce)), i.e. the curve-end
* above the curve xcv; * is above the curve `xcv`;
* EQUAL if the curve-end lies on the curve xcv. * `EQUAL` if the curve-end lies on the curve `xcv`.
*/ */
Comparison_result operator()(const X_monotone_subcurve_2& xs1, Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1, Arr_curve_end ce1,
@ -818,15 +828,15 @@ public:
{} {}
public: public:
/*! Compare the y value of two x-monotone curves immediately to the left /*! Compare the y value of two \f$x\f$-monotone curves immediately to the
* of their intersection point. * left of their intersection point.
* \param cv1 The first polycurve curve. * \param cv1 the first polycurve curve.
* \param cv2 The second polycurve curve. * \param cv2 the second polycurve curve.
* \param p The intersection point. * \param p the intersection point.
* \pre The point p lies on both curves, and both of them must be also be * \pre the point `p` lies on both curves, and both of them must be also be
* defined(lexicographically) to its left. * defined (lexicographically) to its left.
* \return The relative position of cv1 with respect to cv2 immdiately to * \return the relative position of `cv1` with respect to `cv2` immdiately
* the left of p: SMALLER, LARGER or EQUAL. * to the left of `p`: `SMALLER`, `LARGER`, or `EQUAL`.
*/ */
Comparison_result operator()(const X_monotone_curve_2& cv1, Comparison_result operator()(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2, const X_monotone_curve_2& cv2,
@ -868,15 +878,15 @@ public:
{} {}
public: public:
/*! Compare the y value of two x-monotone curves immediately to the right /*! Compare the \f$y\f$-value of two \f$x\f$-monotone curves immediately to
* of their intersection point. * the right of their intersection point.
* \param cv1 The first curve. * \param cv1 the first curve.
* \param cv2 The second curve. * \param cv2 the second curve.
* \param p The intersection point. * \param p the intersection point.
* \pre The point p lies on both curves, and both of them must be also be * \pre the point `p` lies on both curves, and both of them must be also be
* defined(lexicographically) to its right. * defined (lexicographically) to its right.
* \return The relative position of cv1 with respect to cv2 immdiately to * \return the relative position of `cv1` with respect to `cv2` immdiately
* the right of p: SMALLER, LARGER or EQUAL. * to the right of `p`: `SMALLER`, `LARGER`, or `EQUAL`.
*/ */
Comparison_result operator()(const X_monotone_curve_2& cv1, Comparison_result operator()(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2, const X_monotone_curve_2& cv2,
@ -918,18 +928,18 @@ public:
public: public:
/*! Check whether the two points are the same. /*! Check whether the two points are the same.
* \param p1 The first point. * \param p1 the first point.
* \param p2 The second point. * \param p2 the second point.
* \return (true) if the two point are the same;(false) otherwise. * \return `true` if the two point are the same; `false` otherwise.
*/ */
bool operator()(const Point_2& p1, const Point_2& p2) const bool operator()(const Point_2& p1, const Point_2& p2) const
{ return m_poly_traits.subcurve_traits_2()->equal_2_object()(p1, p2); } { return m_poly_traits.subcurve_traits_2()->equal_2_object()(p1, p2); }
/*! Check whether the two x-monotone curves are the same (have the same /*! Check whether the two \f$x\f$-monotone curves are the same (have the
* graph). * same graph).
* \param cv1 The first curve. * \param cv1 the first curve.
* \param cv2 The second curve. * \param cv2 the second curve.
* \return(true) if the two curves are the same;(false) otherwise. * \return `true` if the two curves are the same; `false` otherwise.
*/ */
bool operator()(const X_monotone_curve_2& cv1, bool operator()(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2) const { const X_monotone_curve_2& cv2) const {
@ -1024,9 +1034,9 @@ public:
public: public:
/*! Compare the endpoints of an \(x\)-monotone curve lexicographically. /*! Compare the endpoints of an \(x\)-monotone curve lexicographically.
* (assuming the curve has a designated source and target points). * (assuming the curve has a designated source and target points).
* \param cv The curve. * \param cv the curve.
* \return SMALLER if the curve is oriented left-to-right; * \return `SMALLER` if `cv` is oriented left-to-right;
* LARGER if the curve is oriented right-to-left. * `LARGER` if `cv` is oriented right-to-left.
*/ */
Comparison_result operator()(const X_monotone_curve_2& xcv) const { Comparison_result operator()(const X_monotone_curve_2& xcv) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1062,13 +1072,13 @@ public:
{} {}
public: public:
/*! Construct the reversed \(x\)-monotone polycurve of the input. /*! Construct the reversed \f$x\f$-monotone polycurve of the input.
* Note that the functor constructs the opposites of _all_ subcurves * Note that the functor constructs the opposites of _all_ subcurves
* constituting xcv. * constituting `xcv`.
* \param xcv the \(x\)-monotone polycurve to be reveres * \param xcv the \f$x\f$-monotone polycurve to be reveres
* \pre xcv contains at least one subcurve * \pre xcv contains at least one subcurve
* \return An \(x\)-monotone polycurve with the same graph as the input xcv * \return an \f$x\f$-monotone polycurve with the same graph as the input
* only with a reverse orientation. * `xcv` only with a reverse orientation.
*/ */
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const { X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1186,10 +1196,10 @@ public:
{} {}
public: public:
/*! Obtain an x-monotone polycurve that consists of one given subcurve. /*! Obtain an \f$x\f$-monotone polycurve that consists of one given subcurve.
* \param seg input subcurve. * \param seg input subcurve.
* \pre seg is not degenerated. * \pre seg is not degenerated.
* \return An x-monotone polycurve with one subcurve. * \return an \f$x\f$-monotone polycurve with one subcurve.
*/ */
X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const { X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const {
CGAL_precondition_code CGAL_precondition_code
@ -1217,9 +1227,10 @@ public:
return X_monotone_curve_2(seg); return X_monotone_curve_2(seg);
} }
/*! Construct an x-monotone polycurve which is well-oriented from a range of /*! Construct an \f$x\f$-monotone polycurve, which is well-oriented, from a
* elements. * range of elements.
* \pre Range should from a continuous well-oriented x-monotone polycurve. * \pre the elements in the range should form a continuous well-oriented
* \f$x\f$-monotone polycurve.
*/ */
template <typename ForwardIterator> template <typename ForwardIterator>
X_monotone_curve_2 operator()(ForwardIterator begin, X_monotone_curve_2 operator()(ForwardIterator begin,
@ -1231,14 +1242,14 @@ public:
return constructor_impl(begin, end, Is_point()); return constructor_impl(begin, end, Is_point());
} }
/*! Construct an x-monotone polycurve from a range of points. /*! Construct an \f$x\f$-monotone polycurve from a range of points.
* The polycurve may be oriented left-to-right or right-to-left * The polycurve may be oriented left-to-right or right-to-left
* depending on the lexicographical order of the points in the * depending on the lexicographical order of the points in the input.
* input. * \pre range contains at least two points.
* \pre Range contains at least two points. * \pre no two consecutive points are the same.
* \pre No two consecutive points are the same. * \pre the points form an continuous well-oriented \f$x\f$-monotone
* \pre The points form an continuous well-oriented x-monotone polycurve. * polycurve.
* \post By the construction the returned polycurve is well-oriented. * \post by the construction the returned polycurve is well-oriented.
*/ */
template <typename ForwardIterator> template <typename ForwardIterator>
X_monotone_curve_2 constructor_impl(ForwardIterator /* begin */, X_monotone_curve_2 constructor_impl(ForwardIterator /* begin */,
@ -1246,18 +1257,18 @@ public:
std::true_type) const std::true_type) const
{ CGAL_error_msg("Cannot construct a polycurve from a range of points!"); } { CGAL_error_msg("Cannot construct a polycurve from a range of points!"); }
/*! Obtain an x-monotone polycurve from a range of subcurves. /*! Obtain an \f$x\f$-monotone polycurve from a range of subcurves.
* \param begin An iterator pointing to the first subcurve in the range. * \param begin An iterator pointing to the first subcurve in the range.
* \param end An iterator pointing to the past-the-end subcurve * \param end An iterator pointing to the past-the-end subcurve
* in the range. * in the range.
* \pre The range contains at least one subcurve. * \pre the range contains at least one subcurve.
* \pre Subcurves correspond to a well-oriented polycurve. That * \pre subcurves correspond to a well-oriented polycurve. That
* is, the target of the i-th subcurve is an source of the * is, the target of the i-th subcurve is an source of the
* (i+1)th subcurve. * (i+1)th subcurve.
* \pre The sequence of subcurves in the range forms a weak x-monotone * \pre the sequence of subcurves in the range forms a weak \f$x\f$-monotone
* polycurve. * polycurve.
* \pre The container should support bidirectional iteration. * \pre the container should support bidirectional iteration.
* \return A continuous, well-oriented x-monotone polycurve which * \return a continuous, well-oriented \f$x\f$-monotone polycurve ,which
* is directed either left-to-right or right-to-left * is directed either left-to-right or right-to-left
* depending on the subcurves in the input. * depending on the subcurves in the input.
*/ */
@ -1349,7 +1360,7 @@ public:
//@{ //@{
/*! A function object that obtains the parameter space of a geometric /*! A function object that obtains the parameter space of a geometric
* entity along the x-axis * entity along the \f$x\f$-axis
*/ */
class Parameter_space_in_x_2 { class Parameter_space_in_x_2 {
protected: protected:
@ -1367,23 +1378,23 @@ public:
{} {}
public: public:
/*! Obtains the parameter space at the end of a curve along the x-axis . /*! Obtains the parameter space at the end of a curve along the
* Note that if the curve-end coincides with a pole, then unless the curve * \f$x\f$-axis. Note that if the curve-end coincides with a pole, then
* coincides with the identification curve, the curve-end is considered to * unless the curve coincides with the identification curve, the curve-end
* be approaching the boundary, but not on the boundary. * is considered to be approaching the boundary, but not on the boundary.
* If the curve coincides with the identification curve, it is assumed to * If the curve coincides with the identification curve, it is assumed to
* be smaller than any other object. * be smaller than any other object.
* \param xcv the curve * \param xcv the curve
* \param ce the curve-end indicator: * \param ce the curve-end indicator:
* ARR_MIN_END - the minimal end of xc or * `ARR_MIN_END` - the minimal end of `xcv` or
* ARR_MAX_END - the maximal end of xc * `ARR_MAX_END` - the maximal end of `xcv`
* \return the parameter space at the ce end of the curve xcv. * \return the parameter space at the ce end of the curve xcv.
* ARR_LEFT_BOUNDARY - the curve approaches the identification curve * `ARR_LEFT_BOUNDARY` - the curve approaches the identification curve
* from the right at the curve left end. * from the right at the curve left end.
* ARR_INTERIOR - the curve does not approache the identification * `ARR_INTERIOR` - the curve does not approache the identification
* curve. * curve.
* ARR_RIGHT_BOUNDARY - the curve approaches the identification curve * `ARR_RIGHT_BOUNDARY` - the curve approaches the identification curve
* from the left at the curve right end. * from the left at the curve right end.
* \pre xcv does not coincide with the vertical identification curve. * \pre xcv does not coincide with the vertical identification curve.
*/ */
Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
@ -1398,10 +1409,10 @@ public:
return geom_traits->parameter_space_in_x_2_object()(xs, ce); return geom_traits->parameter_space_in_x_2_object()(xs, ce);
} }
/*! Obtains the parameter space at a point along the x-axis. /*! Obtains the parameter space at a point along the \f$x\f$-axis.
* \param p the point. * \param p the point.
* \return the parameter space at p. * \return the parameter space at `p`.
* \pre p does not lie on the vertical identification curve. * \pre `p` does not lie on the vertical identification curve.
*/ */
Arr_parameter_space operator()(const Point_2 p) const { Arr_parameter_space operator()(const Point_2 p) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1414,7 +1425,7 @@ public:
{ return Parameter_space_in_x_2(*this); } { return Parameter_space_in_x_2(*this); }
/*! A function object that obtains the parameter space of a geometric /*! A function object that obtains the parameter space of a geometric
* entity along the y-axis * entity along the \f$y\f$-axis
*/ */
class Parameter_space_in_y_2 { class Parameter_space_in_y_2 {
protected: protected:
@ -1432,23 +1443,23 @@ public:
{} {}
public: public:
/*! Obtains the parameter space at the end of an curve along the y-axis . /*! Obtains the parameter space at the end of an curve along the
* Note that if the curve-end coincides with a pole, then unless the curve * \f$y\f$-axis. Note that if the curve-end coincides with a pole, then
* coincides with the identification curve, the curve-end is considered to * unless the curve coincides with the identification curve, the curve-end
* be approaching the boundary, but not on the boundary. * is considered to be approaching the boundary, but not on the boundary.
* If the curve coincides with the identification curve, it is assumed to * If the curve coincides with the identification curve, it is assumed to
* be smaller than any other object. * be smaller than any other object.
* \param xcv the curve * \param xcv the curve
* \param ce the curve-end indicator: * \param ce the curve-end indicator:
* ARR_MIN_END - the minimal end of xcv or * `ARR_MIN_END` - the minimal end of `xcv` or
* ARR_MAX_END - the maximal end of xcv * `ARR_MAX_END` - the maximal end of `xcv`
* \return the parameter space at the ce end of the curve xcv. * \return the parameter space at the ce end of the curve xcv.
* ARR_BOTTOM_BOUNDARY - the curve approaches the south pole at the * `ARR_BOTTOM_BOUNDARY` - the curve approaches the south pole at the
* curve left end. * curve left end.
* ARR_INTERIOR - the curve does not approache a contraction * `ARR_INTERIOR` - the curve does not approache a contraction
* point. * point.
* ARR_TOP_BOUNDARY - the curve approaches the north pole at the * `ARR_TOP_BOUNDARY` - the curve approaches the north pole at the
* curve right end. * curve right end.
* There are no horizontal identification curves! * There are no horizontal identification curves!
*/ */
Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
@ -1463,9 +1474,9 @@ public:
return geom_traits->parameter_space_in_y_2_object()(xs, ce); return geom_traits->parameter_space_in_y_2_object()(xs, ce);
} }
/*! Obtains the parameter space at a point along the y-axis. /*! Obtains the parameter space at a point along the \f$y\f$-axis.
* \param p the point. * \param p the point.
* \return the parameter space at p. * \return the parameter space at `p`.
* \pre p does not lie on the horizontal identification curve. * \pre p does not lie on the horizontal identification curve.
* There are no horizontal identification curves! * There are no horizontal identification curves!
*/ */
@ -1479,8 +1490,8 @@ public:
Parameter_space_in_y_2 parameter_space_in_y_2_object() const Parameter_space_in_y_2 parameter_space_in_y_2_object() const
{ return Parameter_space_in_y_2(*this); } { return Parameter_space_in_y_2(*this); }
/*! A functor that compares the x-coordinate of curve-ends and points on the /*! A functor that compares the \f$x\f$-coordinate of curve-ends and points on
* boundary of the parameter space. * the boundary of the parameter space.
*/ */
class Compare_x_on_boundary_2 { class Compare_x_on_boundary_2 {
protected: protected:
@ -1498,46 +1509,46 @@ public:
{} {}
public: public:
/*! Compare the x-coordinates of a point with the x-coordinate of an /*! Compare the \f$x\f$-coordinates of a point with the \f$x\f$-coordinate
* x-curve-end on the boundary. * of an \f$x\f$-curve-end on the boundary.
* \param point the point. * \param point the point.
* \param xcv the x-curve, the endpoint of which is compared. * \param xcv the \f$x\f$-monotone curve, the endpoint of which is compared.
* \param ce the x-curve-end indicator: * \param ce the \f$x\f$-monotone curve-end indicator:
* ARR_MIN_END - the minimal end of xcv or * `ARR_MIN_END` - the minimal end of xcv or
* ARR_MAX_END - the maximal end of xcv. * `ARR_MAX_END` - the maximal end of xcv.
* \return the comparison result: * \return the comparison result:
* SMALLER - x(p) < x(xcv, ce); * `SMALLER` - \f$x\f$(`p`) < \f$x\f$(`xcv`, `ce`);
* EQUAL - x(p) = x(xcv, ce); * `EQUAL` - \f$x\f$(`p`) = \f$x\f$(`xcv`, `ce`);
* LARGER - x(p) > x(xcv, ce). * `LARGER` - \f$x\f$(`p`) > \f$x\f$(`xcv`, `ce`).
* \pre p lies in the interior of the parameter space. * \pre `p` lies in the interior of the parameter space.
* \pre the ce end of the x-curve xcv lies on the top boundary. * \pre the `ce` end of `xcv` lies on the top boundary.
* \pre xcv does not coincide with the vertical identification curve. * \pre `xcv` does not coincide with the vertical identification curve.
*/ */
Comparison_result operator()(const Point_2& point, Comparison_result operator()(const Point_2& point,
const X_monotone_curve_2& xcv, const X_monotone_curve_2& xcv,
Arr_curve_end ce) const Arr_curve_end ce) const
{ return operator()(point, xcv, ce, Bottom_or_top_sides_category()); } { return operator()(point, xcv, ce, Bottom_or_top_sides_category()); }
/*! Compare the x-coordinates of 2 curve-ends on the boundary of the /*! Compare the \f$x\f$-coordinates of 2 curve-ends on the boundary of the
* parameter space. * parameter space.
* \param xcv1 the first curve. * \param xcv1 the first curve.
* \param ce1 the first curve-end indicator: * \param ce1 the first curve-end indicator:
* ARR_MIN_END - the minimal end of xcv1 or * `ARR_MIN_END` - the minimal end of `xcv1` or
* ARR_MAX_END - the maximal end of xcv1. * `ARR_MAX_END` - the maximal end of `xcv1`.
* \param xcv2 the second curve. * \param xcv2 the second curve.
* \param ce2 the second curve-end indicator: * \param ce2 the second curve-end indicator:
* ARR_MIN_END - the minimal end of xcv2 or * `ARR_MIN_END` - the minimal end of `xcv2` or
* ARR_MAX_END - the maximal end of xcv2. * `ARR_MAX_END` - the maximal end of `xcv2`.
* \return the second comparison result: * \return the second comparison result:
* SMALLER - x(xcv1, ce1) < x(xcv2, ce2); * `SMALLER` - \f$\f$x(`xcv1`, `ce1`) < \f$x\f$(`xcv2`, `ce2`);
* EQUAL - x(xcv1, ce1) = x(xcv2, ce2); * `EQUAL` - \f$x\f$(`xcv1`, `ce1`) = \f$x\f$(`xcv2`, `ce2`);
* LARGER - x(xcv1, ce1) > x(xcv2, ce2). * `LARGER` - \f$x\f$(`xcv1`, `ce1`) > \f$x\f$(`xcv2`, `ce2`).
* \pre the ce1 end of the curve xcv1 lies on a pole (implying ce1 is * \pre the `ce1` end of `xcv1` lies on a pole (implying `xcv1` is
* vertical). * vertical).
* \pre the ce2 end of the curve xcv2 lies on a pole (implying ce2 is * \pre the `ce2` end of `xcv2` lies on a pole (implying `xcv2` is
* vertical). * vertical).
* \pre xcv1 does not coincide with the vertical identification curve. * \pre `xcv1` does not coincide with the vertical identification curve.
* \pre xcv2 does not coincide with the vertical identification curve. * \pre `xcv2` does not coincide with the vertical identification curve.
*/ */
Comparison_result operator()(const X_monotone_curve_2& xcv1, Comparison_result operator()(const X_monotone_curve_2& xcv1,
Arr_curve_end ce1, Arr_curve_end ce1,
@ -1546,8 +1557,8 @@ public:
{ return operator()(xcv1, ce1, xcv2, ce2, Bottom_or_top_sides_category()); } { return operator()(xcv1, ce1, xcv2, ce2, Bottom_or_top_sides_category()); }
private: private:
/*! \brief compares the x-coordinates of a point with the x-coordinate of /*! \brief compares the \f$x\f$-coordinates of a point with the
* an x-curve-end on the boundary. * \f$x\f$-coordinate of an \f$x\f$-monotone curve-end on the boundary.
*/ */
Comparison_result operator()(const Point_2& point, Comparison_result operator()(const Point_2& point,
const X_monotone_curve_2& xcv, const X_monotone_curve_2& xcv,
@ -1563,8 +1574,8 @@ public:
return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce); return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce);
} }
/*! \brief compares the x-coordinates of 2 curve-ends on the boundary of /*! \brief compares the \f$x\f$-coordinates of 2 curve-ends on the boundary
* the parameter space. * of the parameter space.
*/ */
Comparison_result operator()(const X_monotone_curve_2& xcv1, Comparison_result operator()(const X_monotone_curve_2& xcv1,
Arr_curve_end ce1, Arr_curve_end ce1,
@ -1587,24 +1598,16 @@ public:
} }
size_type get_curve_index(const X_monotone_curve_2& xcv, size_type get_curve_index(const X_monotone_curve_2& xcv,
const Arr_curve_end ce) const { const Arr_curve_end ce) const
//waqar:: dont know why it is opposite in Parameter_space_in_x... { return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1; }
// I think this is because of the way the subcurves are stored in the
// curve_vector.
// I am assuming that min end depends upon the direction and not the
// x-value.
// and also that min end subcurve is always placed at position 0 of the
// vector.
// Confirm with Eric.
return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
}
/*! Given a point p, an x-monotone curve C(t) = (X(t),Y(t)), /*! Given a point \f$p\f$, an x-monotone curve \f$C(t) = (X(t),Y(t))\f$,
* and an enumerator that specifies either the minimum end or the * and an enumerator that specifies either the minimum end or the
* maximum end of the curve, and thus maps to a parameter value * maximum end of the curve, and thus maps to a parameter value
* d in {0,1}, compare x_p and limit{t => d} X(t). * \f$d \in \{0,1\}\f$, compare x_p and limit{t => d} X(t).
* If the parameter space is unbounded, a precondition ensures that C has * If the parameter space is unbounded, a precondition ensures that \f$C\f$
* a vertical asymptote at its d-end; that is limit{t => d} X(t) is finite. * has a vertical asymptote at its \f$d\f$-end; that is
* limit{t => d} X(t) is finite.
*/ */
Comparison_result operator()(const Point_2& p, Comparison_result operator()(const Point_2& p,
const X_monotone_curve_2& xcv, const X_monotone_curve_2& xcv,
@ -1617,14 +1620,15 @@ public:
return cmp_x_on_boundary(p, xcv[index], ce); return cmp_x_on_boundary(p, xcv[index], ce);
} }
/*! Given two x-monotone curves C1(t) = (X1(t),Y1(t)) and /*! Given two \f$x\f$-monotone curves \f$C_1(t) = (X_1(t),Y_1(t))\f$ and
* C2(t) = (X2(t),Y2(t)) and two enumerators that specify either the * \f$C2_(t) = (X_2(t),Y_2(t))\f$ and two enumerators that specify either
* minimum ends or the maximum ends of the curves, and thus map to * the minimum ends or the maximum ends of the curves, and thus map to
* parameter values d1 in {0,1} and d2 in {0,1} for C1 and for C2, * parameter values \f$d_1 \in \{0,1\}\f$ and \f$d_2 \in \{0,1\}\f$ for
* respectively, compare limit{t => d1} X1(t) and limit{t => d2} X2(t). * \f$C_1\f$ and for \f$C_2\f$, respectively, compare
* limit{t => d1} X1(t) and limit{t => d2} X2(t).
* If the parameter space is unbounded, a precondition ensures that * If the parameter space is unbounded, a precondition ensures that
* C1 and C2 have vertical asymptotes at their respective ends; * \f$C_1\f$ and \f$C_2\f$ have vertical asymptotes at their respective
* that is, limit{t => d1} X1(t) and limit{t =? d2} X2(t) are finite. * ends; that is, limit{t => d1} X1(t) and limit{t =? d2} X2(t) are finite.
*/ */
Comparison_result operator()(const X_monotone_curve_2& xcv1, Comparison_result operator()(const X_monotone_curve_2& xcv1,
Arr_curve_end ce1/* for xcv1 */, Arr_curve_end ce1/* for xcv1 */,
@ -1653,7 +1657,7 @@ public:
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
{ return Compare_x_on_boundary_2(*this); } { return Compare_x_on_boundary_2(*this); }
/*! A functor that compares the \f$x-\f$coordinates of curve ends near the /*! A functor that compares the \f$x\f$-coordinates of curve ends near the
* boundary of the parameter space. * boundary of the parameter space.
*/ */
class Compare_x_near_boundary_2 { class Compare_x_near_boundary_2 {
@ -1672,18 +1676,8 @@ public:
public: public:
size_type get_curve_index(const X_monotone_curve_2& xcv, size_type get_curve_index(const X_monotone_curve_2& xcv,
const Arr_curve_end ce) const { const Arr_curve_end ce) const
//waqar:: dont know why it is opposite in Parameter_space_in_x... { return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1; }
// I think this is because of the way the subcurves are stored in the
// curve_vector.
// I am assuming that min end depends upon the direction and not the
// x-value.
// and also that min end subcurve is always placed at position 0 of the
// vector.
// Confirm with Eric.
size_type index = (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
return index;
}
Comparison_result operator()(const X_monotone_curve_2 xcv1, Comparison_result operator()(const X_monotone_curve_2 xcv1,
const X_monotone_curve_2 xcv2, const X_monotone_curve_2 xcv2,
@ -1700,7 +1694,7 @@ public:
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
{ return Compare_x_near_boundary_2(*this); } { return Compare_x_near_boundary_2(*this); }
/*! A functor that compares the y-coordinate of two given points /*! A functor that compares the \f$y\f$-coordinate of two given points
* that lie on the vertical identification curve. * that lie on the vertical identification curve.
*/ */
class Compare_y_on_boundary_2 { class Compare_y_on_boundary_2 {
@ -1719,15 +1713,15 @@ public:
{} {}
public: public:
/*! Compare the y-coordinate of two given points that lie on the vertical /*! Compare the \f$y\f$-coordinate of two given points that lie on the
* identification curve. * vertical identification curve.
* \param p1 the first point. * \param p1 the first point.
* \param p2 the second point. * \param p2 the second point.
* \return SMALLER - p1 is lexicographically smaller than p2; * \return `SMALLER` - `p1` is lexicographically smaller than `p2`;
* EQUAL - p1 and p2 coincides; * `EQUAL` - `p1` and `p2` coincides;
* LARGER - p1 is lexicographically larger than p2; * `LARGER` - `p1` is lexicographically larger than `p2`;
* \pre p1 lies on the vertical identification curve. * \pre `p1` lies on the vertical identification curve.
* \pre p2 lies on the vertical identification curve. * \pre `p2` lies on the vertical identification curve.
*/ */
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { Comparison_result operator()(const Point_2& p1, const Point_2& p2) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1739,7 +1733,7 @@ public:
Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
{ return Compare_y_on_boundary_2(*this); } { return Compare_y_on_boundary_2(*this); }
/*! A functor that compares the y-coordinates of curve-ends near the /*! A functor that compares the \f$y\f$-coordinates of curve-ends near the
* boundary of the parameter space. * boundary of the parameter space.
*/ */
class Compare_y_near_boundary_2 { class Compare_y_near_boundary_2 {
@ -1758,15 +1752,15 @@ public:
{} {}
public: public:
/*! Compare the y-coordinates of 2 curves at their ends near the boundary /*! Compare the \f$y\f$-coordinates of 2 curves at their ends near the
* of the parameter space. * boundary of the parameter space.
* \param xcv1 the first curve. * \param xcv1 the first curve.
* \param xcv2 the second curve. * \param xcv2 the second curve.
* \param ce the curve-end indicator: * \param ce the curve-end indicator:
* ARR_MIN_END - the minimal end or * `ARR_MIN_END` - the minimal end or
* ARR_MAX_END - the maximal end * `ARR_MAX_END` - the maximal end
* \return the second comparison result. * \return the second comparison result.
* \pre the ce ends of the curves xcv1 and xcv2 lie either on the left * \pre the `ce` ends of the curves `xcv1` and `xcv2` lie either on the left
* boundary or on the right boundary of the parameter space (implying * boundary or on the right boundary of the parameter space (implying
* that they cannot be vertical). * that they cannot be vertical).
* There is no horizontal identification curve! * There is no horizontal identification curve!
@ -1815,16 +1809,17 @@ public:
public: public:
/*! Determine whether a point lies in the vertical boundary. /*! Determine whether a point lies in the vertical boundary.
* \param p the point. * \param p the point.
* \return a Boolean indicating whether p lies in the vertical boundary. * \return a Boolean indicating whether `p` lies in the vertical boundary.
*/ */
bool operator()(const Point_2& p) const { bool operator()(const Point_2& p) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
return geom_traits->is_on_y_identification_2_object()(p); return geom_traits->is_on_y_identification_2_object()(p);
} }
/*! Determine whether an x-monotone curve lies in the vertical boundary. /*! Determine whether an \f$x\f$-monotone curve lies in the vertical
* \param xcv the x-monotone curve. * boundary.
* \return a Boolean indicating whether xcv lies in the vertical boundary. * \param xcv the \f$x\f$-monotone curve.
* \return a Boolean indicating whether `xcv` lies in the vertical boundary.
*/ */
bool operator()(const X_monotone_curve_2& xcv) const { bool operator()(const X_monotone_curve_2& xcv) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1859,16 +1854,17 @@ public:
public: public:
/*! Determine whether a point lies in the vertical boundary. /*! Determine whether a point lies in the vertical boundary.
* \param p the point. * \param p the point.
* \return a Boolean indicating whether p lies in the vertical boundary. * \return a Boolean indicating whether `p` lies in the vertical boundary.
*/ */
bool operator()(const Point_2& p) const { bool operator()(const Point_2& p) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
return geom_traits->is_on_x_identification_2_object()(p); return geom_traits->is_on_x_identification_2_object()(p);
} }
/*! Determine whether an x-monotone curve lies in the vertical boundary. /*! Determine whether an \f$x\f$-monotone curve lies in the vertical
* \param xcv the x-monotone curve. * boundary.
* \return a Boolean indicating whether xcv lies in the vertical boundary. * \param `xcv` the \f$x\f$-monotone curve.
* \return a Boolean indicating whether `xcv` lies in the vertical boundary.
*/ */
bool operator()(const X_monotone_curve_2& xcv) const { bool operator()(const X_monotone_curve_2& xcv) const {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
@ -1920,7 +1916,7 @@ public:
{} {}
public: public:
/*! Append a subcurve to an existing x-monotone polycurve at the back. /*! Append a subcurve to an existing \f$x\f$-monotone polycurve at the back.
*/ */
void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg) void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
const const
@ -2251,12 +2247,12 @@ public:
Trim_2(const Polycurve_basic_traits_2& traits) : m_poly_traits(traits) {} Trim_2(const Polycurve_basic_traits_2& traits) : m_poly_traits(traits) {}
public: public:
/*! \brief returns a trimmed version of the polycurve with src and tgt as /*! \brief returns a trimmed version of the polycurve with `source` and
* end points. * `target` as end points.
*/ */
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
const Point_2& source, const Point_2& source,
const Point_2& target)const const Point_2& target) const
{ {
const auto* geom_traits = m_poly_traits.subcurve_traits_2(); const auto* geom_traits = m_poly_traits.subcurve_traits_2();
auto min_vertex = geom_traits->construct_min_vertex_2_object(); auto min_vertex = geom_traits->construct_min_vertex_2_object();
@ -2309,15 +2305,15 @@ public:
auto trg_min_vertex = min_vertex(xcv[trg_id]); auto trg_min_vertex = min_vertex(xcv[trg_id]);
auto trg_max_vertex = max_vertex(xcv[trg_id]); auto trg_max_vertex = max_vertex(xcv[trg_id]);
//push the trimmed version of the source subcurve. // Push the trimmed version of the source subcurve.
// if(sorientation == SMALLER && source != src_max_vertex) // if (sorientation == SMALLER && source != src_max_vertex)
if ((orientation == SMALLER) && if ((orientation == SMALLER) &&
! geom_traits->equal_2_object()(src, src_max_vertex)) { ! geom_traits->equal_2_object()(src, src_max_vertex)) {
if (src_id != trg_id) if (src_id != trg_id)
trimmed_subcurves.push_back(trim(xcv[src_id], src, src_max_vertex)); trimmed_subcurves.push_back(trim(xcv[src_id], src, src_max_vertex));
else trimmed_subcurves.push_back(trim(xcv[src_id], src, trg)); else trimmed_subcurves.push_back(trim(xcv[src_id], src, trg));
} }
//else if(orientation == LARGER && source != src_min_vertex) // else if(orientation == LARGER && source != src_min_vertex)
else if ((orientation == LARGER) && else if ((orientation == LARGER) &&
! geom_traits->equal_2_object()(src, src_min_vertex)) { ! geom_traits->equal_2_object()(src, src_min_vertex)) {
if (src_id != trg_id) if (src_id != trg_id)
@ -2325,18 +2321,18 @@ public:
else trimmed_subcurves.push_back(trim(xcv[src_id], src, trg)); else trimmed_subcurves.push_back(trim(xcv[src_id], src, trg));
} }
//push the middle subcurves as they are. // Push the middle subcurves as they are.
for (size_t i = src_id+1; i < trg_id; ++i) for (size_t i = src_id+1; i < trg_id; ++i)
trimmed_subcurves.push_back(xcv[i]); trimmed_subcurves.push_back(xcv[i]);
//push the appropriately trimmed target subcurve. // Push the appropriately trimmed target subcurve.
if (src_id != trg_id) { if (src_id != trg_id) {
//if(orientation == SMALLER && target != trg_min_vertex) // if (orientation == SMALLER && target != trg_min_vertex)
if ((orientation == SMALLER) && if ((orientation == SMALLER) &&
! geom_traits->equal_2_object()(trg, trg_min_vertex)) ! geom_traits->equal_2_object()(trg, trg_min_vertex))
trimmed_subcurves.push_back(trim(xcv[trg_id], trg_min_vertex, trg)); trimmed_subcurves.push_back(trim(xcv[trg_id], trg_min_vertex, trg));
//else if (orientation == LARGER && target != trg_max_vertex) // else if (orientation == LARGER && target != trg_max_vertex)
else if ((orientation == LARGER) && else if ((orientation == LARGER) &&
! geom_traits->equal_2_object()(trg, trg_max_vertex)) ! geom_traits->equal_2_object()(trg, trg_max_vertex))
trimmed_subcurves.push_back(trim(xcv[trg_id], trg_max_vertex, trg)); trimmed_subcurves.push_back(trim(xcv[trg_id], trg_max_vertex, trg));
@ -2357,14 +2353,16 @@ protected:
* Roadmap: locate() should return an iterator to the located subcurve * Roadmap: locate() should return an iterator to the located subcurve
*/ */
/*! Obtain the index of the subcurve in the polycurve that contains the /*! Obtain the index of the subcurve in the polycurve that contains a point
* point q in its x-range. The function performs a binary search, so if the * \f$q\f$ in its \f$x\f$-range. The function performs a binary search, so if
* point q is in the x-range of the polycurve with n subcurves, the subcurve * the point \f$q\f$ is in the \f$x\f$-range of the polycurve with \f$n\f$
* containing it can be located in \cgalBigO{log n} operations. * subcurves, the subcurve containing it can be located in \cgalBigO{log n}
* \param cv The polycurve curve. * operations.
* \param q The point. * \param cv the polycurve curve.
* \return An index i such that q is in the x-range of cv[i]. * \param q the point.
* If q is not in the x-range of cv, returns INVALID_INDEX. * \return an index \f$i\f$ such that \f$q\f$ is in the \f$x\f$-range of
* `cv[i]`. If \f$q\f$ is not in the \f$x\f$-range of `cv`, returns
* `INVALID_INDEX`.
*/ */
template <typename Compare> template <typename Compare>
std::size_t locate_gen(const X_monotone_curve_2& cv, Compare compare) const { std::size_t locate_gen(const X_monotone_curve_2& cv, Compare compare) const {
@ -2501,9 +2499,9 @@ protected:
* of a curve. * of a curve.
* This implementation is used in the case where at least one side of the * This implementation is used in the case where at least one side of the
* parameter space is not oblivious. * parameter space is not oblivious.
* \param xcv (in) the given polycurve. * \param(in) xcv the given polycurve.
* \param xs (in) the given curve. * \param(in) xs the given curve.
* \param cd (in) the curve-end indicator. * \param(in) ce the curve-end indicator.
*/ */
std::size_t locate_impl(const X_monotone_curve_2& xcv, std::size_t locate_impl(const X_monotone_curve_2& xcv,
const X_monotone_subcurve_2& xs, const X_monotone_subcurve_2& xs,
@ -2547,8 +2545,8 @@ protected:
* of a curve. * of a curve.
* This implementation is used in the case where at least one side of the * This implementation is used in the case where at least one side of the
* parameter space is not oblivious. * parameter space is not oblivious.
* \param xcv (in) the given polycurve. * \param(in) xcv the given polycurve.
* \param p (in) the endpoint of a curve. * \param(in) p the endpoint of a curve.
*/ */
std::size_t locate_impl(const X_monotone_curve_2& xcv, std::size_t locate_impl(const X_monotone_curve_2& xcv,
const Point_2& p, const Point_2& p,
@ -2572,8 +2570,8 @@ protected:
* of a curve. * of a curve.
* This implementation is used in the case where all sides of the parameter * This implementation is used in the case where all sides of the parameter
* space is oblivious. * space is oblivious.
* \param xcv (in) the given polycurve. * \param(in) xcv the given polycurve.
* \param p (in) the endpoint of a curve. * \param(in) p the endpoint of a curve.
*/ */
std::size_t locate_impl(const X_monotone_curve_2& xcv, const Point_2& p, std::size_t locate_impl(const X_monotone_curve_2& xcv, const Point_2& p,
Arr_all_sides_oblivious_tag) const Arr_all_sides_oblivious_tag) const
@ -2599,13 +2597,13 @@ protected:
} }
/*! Find the index of the subcurve in the polycurve that is defined to the /*! Find the index of the subcurve in the polycurve that is defined to the
* left(or to the right) of the point q. * left (or to the right) of the point `q`.
* \param cv The polycurve curve. * \param cv the polycurve curve.
* \param q The point. * \param q the point.
* \param to_right(true) if we wish to locate a subcurve to the right of q, * \param to_right `true` if we wish to locate a subcurve to the right of q,
* (false) if we wish to locate a subcurve to its right. * `false` if we wish to locate a subcurve to its right.
* \return An index i such that subcurves[i] is defined to the left(or to the * \return an index \f$i\f$ such that subcurves[i] is defined to the left (or
* right) of q, or INVALID_INDEX if no such subcurve exists. * to the right) of `q`, or `INVALID_INDEX` if no such subcurve exists.
*/ */
std::size_t locate_side(const X_monotone_curve_2& cv, std::size_t locate_side(const X_monotone_curve_2& cv,
const Point_2& q, const bool& to_right) const { const Point_2& q, const bool& to_right) const {