Introduced new concept AosApproximateTraits_2

This commit is contained in:
Efi Fogel 2024-08-28 19:38:52 +03:00
parent 37e892df1d
commit d8e4cc40be
10 changed files with 429 additions and 346 deletions

View File

@ -32,7 +32,7 @@ namespace CGAL {
* same direction as a precondition. Moreover, `Arr_circle_segment_traits_2`
* supports the merging of curves of opposite directions.
*
* \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2}
* \cgalModels{AosTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2}
*
*/
template <typename Kernel>

View File

@ -80,7 +80,7 @@ namespace CGAL {
* to have the same direction as a precondition. Moreover, `Arr_conic_traits_2`
* supports the merging of curves of opposite directions.
*
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosDirectionalXMonotoneTraits_2}
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2}
*
* \cgalHeading{Types}
*/
@ -438,56 +438,13 @@ public:
Bbox_2 operator()(const X_monotone_curve_2& xcv) const { return bbox(xcv); }
};
/*! \name Auxiliary Functor definitions, used gor, e.g., the landmarks
* point-location strategy and the drawing function.
/*! \name Auxiliary Functor definitions.
*/
//@{
/// @{
typedef double Approximate_number_type;
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
typedef Approximate_kernel::Point_2 Approximate_point_2;
/*! \class Approximate_2
* A functor that approximates a point and an \f$x\f$-monotone curve.
*/
class Approximate_2 {
public:
/*! Obtain an approximation of a point coordinate.
* \param p The exact point.
* \param i The coordinate index (either 0 or 1).
* \pre `i` is either 0 or 1.
* \return An approximation of p's \f$x\f$-coordinate (if `i` == 0), or an
* approximation of p's \f$y\f$-coordinate (if `i` == 1).
*/
Approximate_number_type operator()(const Point_2& p, int i) const;
/*! Obtain an approximation of a point.
* \param p The exact point.
*/
Approximate_point_2 operator()(const Point_2& p) const;
/*! approximates a given \f$x\f$-monotone curve. It computes a sequence of
* approximate points that represent an approximate polyline, and inserts
* them into an output container given through an output iterator. The
* first and last points in the sequence are always approximations of the
* endpoints of the given arc.
*
* \param oi An output iterator for the output container.
* \param error The error bound of the polyline approximation. This is the
* Hausdorff distance between the arc and the polyline that
* approximates the arc.
* \param xcv The exact \f$x\f$-monotone arc.
* \param l2r A Boolean flag that indicates whether the arc direction is
* left to right.
* \return The past-the-end iterator of the output container.
*
* \pre Dereferencing `oi` must yield an object of type
* `Arr_conic_traits_2::Approximate_point_2`.
*/
template <typename OutputIterator>
OutputIterator operator()(OutputIterator oi, double error,
const X_monotone_curve_2& xcv,
bool l2r = true) const;
};
/// @}
/*! \class Trim_2
* A functor that trims a conic arc.
@ -521,9 +478,6 @@ public:
/*! Obtain a `Trim_2` functor. */
Trim_2 trim_2_object() const;
/*! Obtain an `Approximate_2` functor. */
Approximate_2 approximate_2_object() const;
/// @}
}; /* end Arr_conic_traits_2 */

View File

@ -39,7 +39,7 @@ namespace CGAL {
* normalized vector \f$(x,y)\f$ in the \f$xy\f$-plane that bisects the
* identification curve.
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosSphericalBoundaryTraits_2}
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosSphericalBoundaryTraits_2}
*/
template <typename Kernel, typename X, typename Y>
class Arr_geodesic_arc_on_sphere_traits_2 {

View File

@ -36,9 +36,9 @@ namespace CGAL {
* - `AosConstructCurveTraits_2`.
*
* If, in addition, the GeometryTraits_2 models the concept
* `AosApproximatePointTraits_2` then `Arr_polycurve_traits_2` models
* this concept as well. The same holds for the concept
* `AosOpenBoundaryTraits_2`. If no type is provided, then
* `AosApproximateTraits_2` (or `AosApproximatePointTraits_2`) then
* `Arr_polycurve_traits_2` models this concept as well. The same holds for the
* concept `AosOpenBoundaryTraits_2`. If no type is provided, then
* `Arr_segment_traits_2` (instantiated with
* `Exact_predicates_exact_constructions_kernel` as the kernel) is used.
* Otherwise,
@ -77,7 +77,7 @@ namespace CGAL {
* the macro `CGAL_ALWAYS_LEFT_TO_RIGHT` to 1 before any \cgal header is
* included.
*
* \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2,AosConstructXMonotoneCurveTraits_2,AosConstructCurveTraits_2,AosApproximatePointTraits_2
* \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2,AosConstructXMonotoneCurveTraits_2,AosConstructCurveTraits_2,AosApproximateTraits_2
* (if the type that substitutes the template parameter `SegmentTraits_2`
* models the concept as well)}
*

View File

@ -52,7 +52,7 @@ namespace CGAL {
* same direction as a precondition. Moreover, `Arr_segment_traits_2` supports
* the merging of curves of opposite directions.
*
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosDirectionalXMonotoneTraits_2}
* \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2}
*/
template <typename Kernel>
class Arr_segment_traits_2 : public Kernel {

View File

@ -7,6 +7,7 @@
* \cgalRefines{AosBasicTraits_2}
*
* \cgalHasModelsBegin
* \cgalHasModels{CGAL::Arr_circle_segment_traits_2<Kernel>}
* \cgalHasModels{CGAL::Arr_conic_traits_2<RatKernel,AlgKernel,NtTraits>}
* \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2}
* \cgalHasModels{CGAL::Arr_linear_traits_2<Kernel>}

View File

@ -0,0 +1,50 @@
/*! \ingroup PkgArrangementOnSurface2ConceptsTraits
* \cgalConcept
*
* The concept `AosApproximateTraits_2` refines the concept
* `AosApproximatePointTraits_2`. A model of this concept is able to
* approximate a point and a curve (in addition to the ability to apprximate the
* coordinates of a point).
*
* \cgalRefines{AosApproximatePointTraits_2}
*
* \cgalHasModelsBegin
* \cgalHasModels{CGAL::Arr_circle_segment_traits_2<Kernel>}
* \cgalHasModels{CGAL::Arr_conic_traits_2<RatKernel,AlgKernel,NtTraits>}
* \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2}
* \cgalHasModels{CGAL::Arr_polyline_traits_2<SegmentTraits_2>}
* \cgalHasModels{CGAL::Arr_segment_traits_2<Kernel>}
* \cgalHasModelsEnd
*
* \sa `AosApproximatePointTraits_2`
* \sa `draw()`
*/
class AosApproximateTraits_2 {
public:
/// \name Types
/// @{
//! the approximate kernel.
typedef unspecified_type Approximate_kernel;
//! the approximate point.
typedef unspecified_type Approximate_point_2;
/// @}
/// \name Functor Types
/// @{
/// models the concept `AosTraits::Approximate_2`.
typedef unspecified_type Approximate_2;
/// @}
/// \name Accessing Functor Objects
/// @{
///
Approximate_2 approximate_2_object() const;
/// @}
}

View File

@ -7,6 +7,7 @@ namespace AosTraits {
*
* \cgalHasModelsBegin
* \cgalHasModels{AosApproximatePointTraits_2::Approximate_2}
* \cgalHasModels{AosApproximateTraits_2::Approximate_2}
* \cgalHasModelsEnd
*/
class Approximate_2 {
@ -17,9 +18,36 @@ public:
/*! obtains an approximation of `p`'s \f$x\f$-coordinate (if `i == 0`), or of
* `p`'s \f$y\f$-coordinate (if `i == 1`).
* \pre `i` is either 0 or 1.
*/
CGAL::Approximate_number_type operator()(AosTraits::Point_2 p, int i);
/*! obtains an approximation of `p`.
*/
CGAL::Approximate_point_2 operator()(AosTraits::Point_2 p);
/*! approximates a given \f$x\f$-monotone curve. It computes a sequence of
* approximate points that represent an approximate polyline, and inserts
* them into an output container given through an output iterator. The
* first and last points in the sequence are always approximations of the
* endpoints of the given curve.
*
* \param xcv The exact \f$x\f$-monotone curve.
* \param error The error bound of the polyline approximation. This is the
* Hausdorff distance between the curve and the polyline that
* approximates the curve.
* \param oi An output iterator for the output container.
* \param l2r A Boolean flag that indicates whether the curve direction is
* left to right.
* \return The past-the-end iterator of the output container.
*
* \pre Dereferencing `oi` must yield an object of type
* `Arr_conic_traits_2::Approximate_point_2`.
*/
template <typename OutputIterator>
OutputIterator operator()(const X_monotone_curve_2& xcv, double error,
OutputIterator oi, bool l2r = true) const;
/// @}
}; /* end AosTraits::Approximate_2 */

View File

@ -112,6 +112,7 @@ implemented as peripheral classes or as free (global) functions.
\cgalCRPSection{Concepts}
- `AosApproximateTraits_2`
- `AosApproximatePointTraits_2`
- `AosBasicTopologyTraits`
- `AosBasicTraits_2`
@ -166,32 +167,32 @@ implemented as peripheral classes or as free (global) functions.
\cgalCRPSection{Function Object Concepts}
- `AosTraits::Approximate_2`
- `AosTraits::AreMergeable_2`
- `AosTraits::CompareX_2`
- `AosTraits::CompareXy_2`
- `AosTraits::ConstructMinVertex_2`
- `AosTraits::ConstructMaxVertex_2`
- `AosTraits::IsVertical_2`
- `AosTraits::IsOnXIdentification_2`
- `AosTraits::IsOnYIdentification_2`
- `AosTraits::CompareYAtX_2`
- `AosTraits::CompareYAtXLeft_2`
- `AosTraits::CompareYAtXRight_2`
- `AosTraits::Equal_2`
- `AosTraits::ParameterSpaceInX_2`
- `AosTraits::ParameterSpaceInY_2`
- `AosTraits::ConstructMinVertex_2`
- `AosTraits::ConstructMaxVertex_2`
- `AosTraits::CompareXOnBoundary_2`
- `AosTraits::CompareYOnBoundary_2`
- `AosTraits::CompareXNearBoundary_2`
- `AosTraits::CompareYNearBoundary_2`
- `AosTraits::CompareXOnBoundaryOfCurveEnd_2`
- `AosTraits::Intersect_2`
- `AosTraits::Split_2`
- `AosTraits::AreMergeable_2`
- `AosTraits::Merge_2`
- `AosTraits::MakeXMonotone_2`
- `AosTraits::Approximate_2`
- `AosTraits::ConstructXMonotoneCurve_2`
- `AosTraits::ConstructCurve_2`
- `AosTraits::ConstructXMonotoneCurve_2`
- `AosTraits::Equal_2`
- `AosTraits::Intersect_2`
- `AosTraits::IsVertical_2`
- `AosTraits::IsOnXIdentification_2`
- `AosTraits::IsOnYIdentification_2`
- `AosTraits::MakeXMonotone_2`
- `AosTraits::Merge_2`
- `AosTraits::ParameterSpaceInX_2`
- `AosTraits::ParameterSpaceInY_2`
- `AosTraits::Split_2`
\cgalCRPSection{Classes}