From c817c461e2af9c46ae2712928eb425fc6c41e09b Mon Sep 17 00:00:00 2001 From: Francisc Date: Thu, 1 Aug 2013 13:49:26 +0300 Subject: [PATCH] modified doc according to first review --- .../Preprocessed_rotational_sweep_visibility_2.h | 4 +++- .../CGAL/Rotational_sweep_visibility_2.h | 6 ++++-- .../doc/Visibility_2/CGAL/Simple_visibility_2.h | 6 ++++-- .../CGAL/Triangular_expansion_visibility_2.h | 4 +++- .../doc/Visibility_2/Concepts/Visibility_2.h | 2 ++ Visibility_2/doc/Visibility_2/visibility_2.txt | 13 ++++++------- .../examples/Visibility_2/simple_visibility_2.cpp | 4 ++-- Visibility_2/include/CGAL/Simple_visibility_2.h | 4 ++++ 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Visibility_2/doc/Visibility_2/CGAL/Preprocessed_rotational_sweep_visibility_2.h b/Visibility_2/doc/Visibility_2/CGAL/Preprocessed_rotational_sweep_visibility_2.h index d29f081162c..7cfa010d528 100644 --- a/Visibility_2/doc/Visibility_2/CGAL/Preprocessed_rotational_sweep_visibility_2.h +++ b/Visibility_2/doc/Visibility_2/CGAL/Preprocessed_rotational_sweep_visibility_2.h @@ -104,6 +104,8 @@ Returns whether an arrangement is attached to the visibility object /*! Attaches the given arrangement to the visibility object and does preprocessing. +In case the object is already attached to another arrangement, +the visibility object gets detached before being attached to 'arr'. */ void attach(const Input_arrangement_2 &arr); @@ -124,7 +126,7 @@ The visibility region of `q` will be stored in `out_arr`. \param q is the query point from which the visibility region is computed \param f is the face of the arrangement in which the visibility region is computed \param out_arr is the output arrangement -\pre `f` is a face of `this->arr()` +\pre `f` is a face of `this->arr()`, defined as a regular polygon \pre `q` is in the interior or on the boundary of the given face `f` \return the face handle to the face in `out_arr` that represents the visibility region */ diff --git a/Visibility_2/doc/Visibility_2/CGAL/Rotational_sweep_visibility_2.h b/Visibility_2/doc/Visibility_2/CGAL/Rotational_sweep_visibility_2.h index 1f58453251d..e9144cebf76 100644 --- a/Visibility_2/doc/Visibility_2/CGAL/Rotational_sweep_visibility_2.h +++ b/Visibility_2/doc/Visibility_2/CGAL/Rotational_sweep_visibility_2.h @@ -98,7 +98,9 @@ Returns whether an arrangement is attached to the visibility object bool is_attached(); /*! -Attaches the given arrangement to the visibility object +Attaches the given arrangement to the visibility object. +In case the object is already attached to another arrangement, +the visibility object gets detached before being attached to 'arr'. */ void attach(const Input_arrangement_2 &arr); @@ -119,7 +121,7 @@ The visibility region of `q` will be stored in `out_arr`. \param q is the query point from which the visibility region is computed \param f is the face of the arrangement in which the visibility region is computed \param out_arr is the output arrangement -\pre `f` is a face of `this->arr()` +\pre `f` is a face of `this->arr()`, defined as a regular polygon \pre `q` is in the interior or on the boundary of the given face `f` \return the face handle to the face in `out_arr` that represents the visibility region */ diff --git a/Visibility_2/doc/Visibility_2/CGAL/Simple_visibility_2.h b/Visibility_2/doc/Visibility_2/CGAL/Simple_visibility_2.h index f4d3b2708be..479eacf09b4 100644 --- a/Visibility_2/doc/Visibility_2/CGAL/Simple_visibility_2.h +++ b/Visibility_2/doc/Visibility_2/CGAL/Simple_visibility_2.h @@ -113,7 +113,9 @@ Returns whether an arrangement is attached to the visibility object bool is_attached (); /*! -Attaches the given arrangement to the visibility object +Attaches the given arrangement to the visibility object. +In case the object is already attached to another arrangement, +the visibility object gets detached before being attached to 'arr'. */ void attach (const Input_arrangement_2 &arr); @@ -134,7 +136,7 @@ The visibility region of `q` will be stored in `out_arr`. \param out_arr is the output arrangement \param q is the query point from which the visibility region is computed \param f is the face of the arrangement in which the visibility region is computed -\pre `f` is a face of `this->arr()` +\pre `f` is a face of `this->arr()`, defined as a regular polygon \pre `q` is in the interior or on the boundary of the given face `f` \return the face handle to the face in `out_arr` that represents the visibility region */ diff --git a/Visibility_2/doc/Visibility_2/CGAL/Triangular_expansion_visibility_2.h b/Visibility_2/doc/Visibility_2/CGAL/Triangular_expansion_visibility_2.h index 632a0f1061a..6f37c63de93 100644 --- a/Visibility_2/doc/Visibility_2/CGAL/Triangular_expansion_visibility_2.h +++ b/Visibility_2/doc/Visibility_2/CGAL/Triangular_expansion_visibility_2.h @@ -103,6 +103,8 @@ Returns whether an arrangement is attached to the visibility object /*! Attaches the given arrangement to the visibility object and does preprocessing. +In case the object is already attached to another arrangement, +the visibility object gets detached before being attached to 'arr'. */ void attach(const Input_arrangement_2 &arr); @@ -123,7 +125,7 @@ The visibility region of `q` will be stored in `out_arr`. \param q is the query point from which the visibility region is computed \param f is the face of the arrangement in which the visibility region is computed \param out_arr is the output arrangement -\pre `f` is a face of `this->arr()` +\pre `f` is a face of `this->arr()`, defined as a regular polygon \pre `q` is in the interior or on the boundary of the given face `f` \return the face handle to the face in `out_arr` that represents the visibility region */ diff --git a/Visibility_2/doc/Visibility_2/Concepts/Visibility_2.h b/Visibility_2/doc/Visibility_2/Concepts/Visibility_2.h index c98ed03361c..08510ce35c9 100644 --- a/Visibility_2/doc/Visibility_2/Concepts/Visibility_2.h +++ b/Visibility_2/doc/Visibility_2/Concepts/Visibility_2.h @@ -91,6 +91,8 @@ Returns whether an arrangement is attached to the visibility object /*! Attaches the given arrangement `arr` to the visibility object. +In case the object is already attached to another arrangement, +the visibility object gets detached before being attached to 'arr'. */ void attach (const Input_arrangement_2 &arr); diff --git a/Visibility_2/doc/Visibility_2/visibility_2.txt b/Visibility_2/doc/Visibility_2/visibility_2.txt index d930cc7ab2a..5d5a5ab0dc2 100644 --- a/Visibility_2/doc/Visibility_2/visibility_2.txt +++ b/Visibility_2/doc/Visibility_2/visibility_2.txt @@ -7,12 +7,12 @@ namespace CGAL { \authors Michael Hemmer, Kan Huang, Francisc Bungiu -\section visibility_2_introduction Introduction - \cgalFigureBegin{example_figure,visibility-teaser.png} An example figure. \cgalFigureEnd +\section visibility_2_introduction Introduction + This package provides functionality to compute the visibility area within polygonal regions in two dimensions. Let \f$ P \f$ be a regular polygon, i.e. with \f$ \partial P = \partial(P\setminus\partial P)\f$ and \f$\partial P \subset P\f$, where \f$\partial P \f$ denotes the boundary of \f$ P \f$. @@ -28,7 +28,7 @@ Non-regularized visibility and regularized visibility. \cgalFigureEnd -As demonstrated \cgalFigureRef{definition-fig} (1) the visibility region \f$ V_q \f$ of a query point \f$ q \f$ may not be +As demonstrated in \cgalFigureRef{definition-fig} (1) the visibility region \f$ V_q \f$ of a query point \f$ q \f$ may not be a regular polygon. All labeled points are collinear which implies that the point \f$ c \f$ is visible to \f$ q \f$, that is, the segment \f$ bc \f$ is part of the visibility area \f$ V_q \f$. However, in many cases the user is not interested in such low dimensional features that are caused by degeneracies. Also for some algorithms it is actually easier (and more efficient) @@ -55,11 +55,10 @@ Class | Function | Prepro Where \f$ n \f$ and \f$ h \f$ are the numbers of vertices and holes of input polygon respectively. -As the package is based on the \ref PkgArrangement2, a polygonal region is defined as a face within an Arrangement_2 of segments, -which we also refer to as the environment. At this point every visibility class template has two parameters, the Arrangement_2 class -and Regularization_tag, that is, the user decides at compile time whether the result is computed regularized or not. +As the package is based on the \ref PkgArrangement2, a regular polygonal region is defined as a face within an Arrangement_2 of segments +with Arr_segment_traits_2, which we also refer to as the environment. At this point every visibility class template has two parameters, the Arrangement_2 class and Regularization_tag, that is, the user decides at compile time whether the result is computed regularized or not. -As required by the `Visibility_2` concept, every class has two overloads of `visibility_region` functions to compute the visibility region of \f$ p \f$ in a bounded polygonal face \f$ F \f$. One is for the case when \f$ p \f$ is in the interior of \f$ F \f$. The other is for the case when \f$ p \f$ is on the boundary of \f$ F \f$. +As required by the `Visibility_2` concept, every class has two overloads of `visibility_region()` functions to compute the visibility region of \f$ p \f$ in a bounded polygonal face \f$ F \f$. One is for the case when \f$ p \f$ is in the interior of \f$ F \f$. The other is for the case when \f$ p \f$ is on the boundary of \f$ F \f$. \section simple_visibility_example Example of visibility in a simple polygon. The following example shows how to obtain the regularized and non-regularized visibility regions. diff --git a/Visibility_2/examples/Visibility_2/simple_visibility_2.cpp b/Visibility_2/examples/Visibility_2/simple_visibility_2.cpp index ecec86c2cf8..4c0b13b6afa 100644 --- a/Visibility_2/examples/Visibility_2/simple_visibility_2.cpp +++ b/Visibility_2/examples/Visibility_2/simple_visibility_2.cpp @@ -8,8 +8,8 @@ #include typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef CGAL::Point_2 Point_2; -typedef CGAL::Segment_2 Segment_2; +typedef Kernel::Point_2 Point_2; +typedef Kernel::Segment_2 Segment_2; typedef CGAL::Arr_segment_traits_2 Traits_2; typedef CGAL::Arrangement_2 Arrangement_2; diff --git a/Visibility_2/include/CGAL/Simple_visibility_2.h b/Visibility_2/include/CGAL/Simple_visibility_2.h index 93f43a9420c..d7e6d917299 100644 --- a/Visibility_2/include/CGAL/Simple_visibility_2.h +++ b/Visibility_2/include/CGAL/Simple_visibility_2.h @@ -75,6 +75,7 @@ public: void detach() { p_arr = NULL; geom_traits = NULL; + vertices.clear(); } Input_arrangement_2 arr() { @@ -188,6 +189,7 @@ public: segments.begin(), segments.end()); CGAL_precondition(out_arr.number_of_isolated_vertices() == 0); + CGAL_precondition(s.size() == 0); conditional_regularize(out_arr, Regularization_tag()); vertices.clear(); } @@ -266,7 +268,9 @@ public: segments.begin(), segments.end()); CGAL_precondition(out_arr.number_of_isolated_vertices() == 0); + CGAL_precondition(s.size() == 0); conditional_regularize(out_arr, Regularization_tag()); + vertices.clear(); } void print_arrangement(const Arrangement_2 &arr) {