From eca5afe6eef5917fa0085aa253b72759149d7946 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 14 Aug 2025 17:58:18 +0300 Subject: [PATCH] Added draw() overloads that accept a bounding box and fixed the Approximate_2 concept documentation --- .../CGAL/draw_arrangement_2.h | 73 ++++++++++--------- .../Concepts/AosApproximatePointTraits_2.h | 4 +- .../Concepts/AosApproximateTraits_2.h | 2 + .../Concepts/AosTraits--ApproximatePoint_2.h | 28 +++++++ .../Concepts/AosTraits--Approximate_2.h | 8 +- .../PackageDescription.txt | 1 + 6 files changed, 70 insertions(+), 46 deletions(-) create mode 100644 Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ApproximatePoint_2.h diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h index e8748ae253c..7f2197f2aef 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h @@ -19,6 +19,8 @@ #include +#include "CGAL/Bbox_2.h" + #ifdef DOXYGEN_RUNNING namespace CGAL { @@ -26,8 +28,8 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2Draw * The function opens a new window and draws `arr`, an instance of the - * `CGAL::Arrangement_2` class template. Parameters of the drawing are taken - * from the optional graphics scene options parameter. + * `CGAL::Arrangement_on_surface_2` class template. Parameters of the drawing + * are taken from the optional graphics scene options parameter. * * A call to this function blocks the execution of the program until the drawing * window is closed. This function requires `CGAL_Qt6`, and is only available if @@ -35,57 +37,56 @@ namespace CGAL { * `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt6` and add the definition * `CGAL_USE_BASIC_VIEWER`. * - * \tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement - * traits concept. At this point it must be an instance of either - * `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. - * \tparam Dcel the \dcel type, a model of the `AosDcel` concept. + * \tparam GeometryTraits a geometry traits type, a model of a 2D arrangement + * geometry traits concept. Observe that not all geometery-traits models are + * supported. + * + * \tparam TopologyTraits a topology traits type, a model of the + * `AosTopologyTraits` concept. + * * \tparam GSOptions a model of `GraphicsSceneOptions` concept. * * \param arr the 2D arrangement to draw. - * \param gso the graphics scene options parameter. + * \param bbox a bounding box in parameter space. + * \param gso the graphics scene options. + * \param title the optional title of the window. * - * \sa `AosDcel` * \sa `AosTraits_2` + * \sa `AosTopologyTraits` + * \sa `GraphicsSceneOptions` */ -template -void draw(const Arrangement_2& arr, - const GSOptions& gso); + +template +void draw(const Arrangement_on_surface_2& arr, const BBox& bbox, const GSOptions& gso, + const char* title = "2D Arrangement on Surface"); /*! \ingroup PkgArrangementOnSurface2Draw * - * A shortcut to `CGAL::draw(arr, Graphics_scene_options{})`. + * A shortcut to `CGAL::draw(arr, bbox, Graphics_scene_options{})`, where `Aos` is `Arrangement_on_surface_2`. */ -template -void draw(const Arrangement_2& arr); + +template +void draw(const Arrangement_on_surface_2& arr, const BBox& bbox, + const char* title = "2D Arrangement on Surface"); /*! \ingroup PkgArrangementOnSurface2Draw * - * adds the vertices, edges and faces of `arr` into the given graphic scene - * `gs`. Parameters of the cells are taken from the optional graphics scene - * options parameter `gso`. Note that `gs` is not cleared before being filled - * (to enable to draw several data structures in the same basic viewer). - * - * \tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement - * traits concept. At this point it must be an instance of either - * `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. - * \tparam Dcel the \dcel type, a model of the `AosDcel` concept. - * \tparam GSOptions a model of `GraphicsSceneOptions` concept. - * - * \param arr the 2D arrangement to draw. - * \param gs the graphic scene to fill. - * \param gso the graphics scene options parameter. + * Similar to `CGAL::draw(arr, bbox, gso)`, where the bounding box `bbox` is computed to bound all points + * and curves of the arrangement in parameter space. */ -template -void add_to_graphics_scene(const Arrangement_2& arr, - CGAL::Graphics_scene& gs, const GSOptions& gso); + +template +void draw(const Arrangement_on_surface_2& arr, const GSOptions& gso, + const char* title = "2D Arrangement on Surface"); /*! \ingroup PkgArrangementOnSurface2Draw - * A shortcut to `CGAL::add_to_graphics_scene(arr, gs, - * Graphics_scene_options{})`. + * + * A shortcut to `CGAL::draw(arr, Graphics_scene_options{})`, where `Aos` is `Arrangement_on_surface_2`. */ -template -void add_to_graphics_scene(const Arrangement_2& arr, - CGAL::Graphics_scene& gs); + +template +void draw(const Arrangement_on_surface_2& arr, + const char* title = "2D Arrangement on Surface"); } /* namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h index 90b53ff56e5..367a8703ce3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h @@ -18,8 +18,6 @@ * \cgalHasModels{CGAL::Arr_rational_function_traits_2} * \cgalHasModelsEnd * - * \sa `AosConstructXMonotoneCurveTraits_2` - * \sa `AosXMonotoneTraits_2` * \sa `AosTraits_2` */ class AosApproximatePointTraits_2 { @@ -35,7 +33,7 @@ public: /// \name Functor Types /// @{ - /// models the concept `AosTraits::Approximate_2`. + /// models the concept `AosTraits::ApproximatePoint_2`. typedef unspecified_type Approximate_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h index 2020e723039..0fd9aca6959 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h @@ -17,6 +17,8 @@ * \cgalHasModelsEnd * * \sa `AosApproximatePointTraits_2` + * \sa `AosConstructXMonotoneCurveTraits_2` + * \sa `AosXMonotoneTraits_2` * \sa `draw()` */ class AosApproximateTraits_2 { diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ApproximatePoint_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ApproximatePoint_2.h new file mode 100644 index 00000000000..aec9d5970d1 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ApproximatePoint_2.h @@ -0,0 +1,28 @@ +namespace AosTraits { + +/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects + * \cgalConcept + * + * \cgalRefines{Functor} + * + * \cgalHasModelsBegin + * \cgalHasModels{AosApproximatePointTraits_2::Approximate_2} + * \cgalHasModels{AosApproximateTraits_2::Approximate_2} + * \cgalHasModelsEnd + */ +class ApproximatePoint_2 { +public: + /// \name Operations + /// A model of this concept must provide: + /// @{ + + /*! 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); + + /// @} +}; /* end AosTraits::Approximate_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h index a9712000aa9..22cfdfaee3e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h @@ -3,7 +3,7 @@ namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept * - * \cgalRefines{Functor} + * \cgalRefines{ApproximatePoint_2} * * \cgalHasModelsBegin * \cgalHasModels{AosApproximatePointTraits_2::Approximate_2} @@ -16,12 +16,6 @@ public: /// A model of this concept must provide: /// @{ - /*! 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); diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt index ea1b0b666e7..d7ccb6ba0bc 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt @@ -167,6 +167,7 @@ implemented as peripheral classes or as free (global) functions. \cgalCRPSection{Function Object Concepts} - `AosTraits::Approximate_2` +- `AosTraits::ApproximatePoint_2` - `AosTraits::AreMergeable_2` - `AosTraits::CompareX_2` - `AosTraits::CompareXy_2`