From bb7ff87c8dc78bdfe6bcadeea2596bb4cc01d602 Mon Sep 17 00:00:00 2001 From: Michael Hemmer Date: Thu, 7 Nov 2013 18:26:03 +0100 Subject: [PATCH] changes according to Sebastien --- ...eprocessed_rotational_sweep_visibility_2.h | 10 +++---- .../CGAL/Rotational_sweep_visibility_2.h | 8 +++--- .../CGAL/Simple_polygon_visibility_2.h | 26 +++++++++---------- .../CGAL/Triangular_expansion_visibility_2.h | 8 +++--- .../doc/Visibility_2/PackageDescription.txt | 5 ++-- .../doc/Visibility_2/visibility_2.txt | 23 +++++++++------- 6 files changed, 41 insertions(+), 39 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 fec2afad89e..08ffac2671b 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 @@ -6,7 +6,7 @@ namespace CGAL { a polygon that may have holes. \details The class template comprises the implementation of the algorithm of Takao Asano and Tetsuo Asano \cite aaghi-vpsesp-85. The algorithm, as the name of the class template suggests, requires preprocessing. -The preprocessing takes \f$ O(n^2)\f$ time and \f$ O(n^2)\f$ space. With the help of preprocessing, the query time is reduced to \f$O(n)\f$. +The preprocessing takes \f$ O(n^2)\f$ time and \f$ O(n^2)\f$ space, which reduces the query time to \f$O(n)\f$. \tparam Arrangement_2 is the type of input polygonal environment and output visibility polygon. @@ -121,25 +121,25 @@ Access to the attached arrangement const Input_arrangement_2& arr() const; /*! -Computes the visibility region for the given query point `q` in the +Computes the visibility region of `q` in the face `f` of the arrangement that is attached to the visibility object. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \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()` and represents a valid polygon. +\pre `f` is a face of `arr()` and represents a valid polygon. \pre `q` is in the interior of the given face `f` \return a handle to the face in `out_arr` that represents the visibility region */ typename Output_arrangement_2::Face_handle compute_visibility(const Point_2& q, const Face_const_handle f, Output_arrangement_2& out_arr) const; /*! -Computes the visibility region for the given query point `q` that is on `e`.If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. +Computes the visibility region of `q` that is on `e`. If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \param e the halfedge on which `q` is located \param out_arr is the output arrangement -\pre `e` is a halfedge of `this->arr()` +\pre `e` is a halfedge of `arr()` \pre `q` is on `e` \pre `q` equals to `e->target()->point()` if `q` is an endpoint of `e` \return a 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 04c28d34d93..f26745ba930 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 @@ -115,25 +115,25 @@ Access to the attached arrangement const Input_arrangement_2& arr() const; /*! -Computes the visibility region for the given query point `q` in the +Computes the visibility region of `q` in the face `f` of the arrangement that is attached to the visibility object. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \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()` and represents a valid polygon. +\pre `f` is a face of `arr()` and represents a valid polygon. \pre `q` is in the interior of the given face `f` \return a handle to the face in `out_arr` that represents the visibility region */ typename Output_arrangement_2::Face_handle compute_visibility(const Point_2& q, const Face_const_handle f, Output_arrangement_2& out_arr) const; /*! -Computes the visibility region for the given query point `q` that is on `e`.If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. +Computes the visibility region of `q` that is on `e`. If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \param e the halfedge on which `q` is located \param out_arr is the output arrangement -\pre `e` is a halfedge of `this->arr()` +\pre `e` is a halfedge of `arr()` \pre `q` is on `e` \pre `q` equals to `e->target()->point()` if `q` is an endpoint of `e` \return a handle to the face in `out_arr` that represents the visibility region diff --git a/Visibility_2/doc/Visibility_2/CGAL/Simple_polygon_visibility_2.h b/Visibility_2/doc/Visibility_2/CGAL/Simple_polygon_visibility_2.h index ab7caeaeb37..f7ecbab5a9b 100644 --- a/Visibility_2/doc/Visibility_2/CGAL/Simple_polygon_visibility_2.h +++ b/Visibility_2/doc/Visibility_2/CGAL/Simple_polygon_visibility_2.h @@ -5,17 +5,15 @@ namespace CGAL { \brief This class is a model of the concept `Visibility_2` can answer visibility queries within a simple polygon with no holes. -\details This class implements the algorithm of B.Joe and R.B.Simpson \cite bjrb-clvpa-87 to -obtain the visibility region, based on a scan of the boundary of the polygon and the notion -of angular displacement as a control variable. The algorithm is a modification and extension -of the linear time algorithm of Lee \cite dtl-voasp-83. It computes the visibility region from a -viewpoint that is in the interior or on the boundary of the polygon. +\details This class implements the algorithm of B.Joe and R.B.Simpson \cite bjrb-clvpa-87. +The algorithm is a modification and extension of the linear time algorithm of Lee \cite dtl-voasp-83. +It computes the visibility region from a viewpoint that is in the interior or on the boundary of the polygon. -The algorithm uses a stack to manipulate the vertices, and ultimately yields the visibility -region. For each scanned edge, at most 2 points are pushed onto the stack. Overall, it -will have at most 2\f$ n \f$ points pushed and popped, thus the time and space complexities of the -algorithm are \f$ O(n) \f$ even in case of degeneracies such as needles, where n is the number of -the vertices of the polygon. +While scanning the boundary the algorithm uses a stack to manipulate the vertices, and ultimately +yields the visibility region. For each scanned edge, at most 2 points are pushed onto the stack. +Overall, at most 2\f$ n \f$ points are pushed or popped. Thus, the time and space complexities of the +algorithm are \f$ O(n) \f$ even in case of degeneracies such as needles, where \f$ n \f$ +is the number of the vertices of the polygon. \tparam Arrangement_2 is the type of input polygonal environment and output visibility region. @@ -128,13 +126,13 @@ Access to the attached arrangement const Input_arrangement_2& arr() const; /*! -Computes the visibility region for the given query point `q` in the +Computes the visibility region of `q` in the face `f` of the arrangement that is attached to the visibility object. The visibility region of `q` will be stored in `out_arr`. \param out_arr is the output arrangement \param q is the query point \param f is the face of the arrangement in which the visibility region is computed -\pre `f` is a face of `this->arr()` and represents a valid polygon. +\pre `f` is a face of `arr()` and represents a valid polygon. \pre `q` is in the interior of the given face `f` \return a handle to the face in `out_arr` that represents the visibility region */ @@ -142,12 +140,12 @@ The visibility region of `q` will be stored in `out_arr`. /*! -Computes the visibility region for the given query point `q` that is on `e`.If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. +Computes the visibility region of `q` that is on `e`. If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \param e the halfedge on which `q` is located \param out_arr is the output arrangement -\pre `e` is a halfedge of `this->arr()` +\pre `e` is a halfedge of `arr()` \pre `q` is on `e` \pre `q` equals to `e->target()->point()` if `q` is an endpoint of `e` \return a 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 b30945183ba..7963692299f 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 @@ -125,13 +125,13 @@ Access to the attached arrangement const Input_arrangement_2& arr() const; /*! -Computes the visibility region for the given query point `q` in the +Computes the visibility region of `q` in the face `f` of the arrangement that is attached to the visibility object. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \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()` and represents a valid polygon. +\pre `f` is a face of `arr()` and represents a valid polygon. \pre `q` is in the interior of the given face `f` \return a handle to the face in `out_arr` that represents the visibility region */ @@ -139,12 +139,12 @@ The visibility region of `q` will be stored in `out_arr`. /*! -Computes the visibility region for the given query point `q` that is on `e`.If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. +Computes the visibility region of `q` that is on `e`. If `q` is an interior point of `e`, the computed visibility region is restricted to the halfplane indicated by `e`. If `q` is an endpoint of `e`, the visibility region is restricted by `e` and its next. The visibility region of `q` will be stored in `out_arr`. \param q is the query point \param e the halfedge on which `q` is located \param out_arr is the output arrangement -\pre `e` is a halfedge of `this->arr()` +\pre `e` is a halfedge of `arr()` \pre `q` is on `e` \pre `q` equals to `e->target()->point()` if `q` is an endpoint of `e` \return a handle to the face in `out_arr` that represents the visibility region diff --git a/Visibility_2/doc/Visibility_2/PackageDescription.txt b/Visibility_2/doc/Visibility_2/PackageDescription.txt index b0eeb4a0a7f..b847749c8b9 100644 --- a/Visibility_2/doc/Visibility_2/PackageDescription.txt +++ b/Visibility_2/doc/Visibility_2/PackageDescription.txt @@ -9,9 +9,8 @@ \cgalPkgPicture{visibility-teaser-thumbnail.png} \cgalPkgSummaryBegin \cgalPkgAuthors{Michael Hemmer, Kan Huang, Francisc Bungiu} -\cgalPkgDesc{This package provides functionality to compute the visibility area -of a point within polygonal regions in two dimensions. The 2D Visibility component offers -several variants for visibility computation amidst linear geometry in the plane.} +\cgalPkgDesc{This package provides several variants to compute +the visibility area of a point within polygonal regions in two dimensions.} \cgalPkgManuals{Chapter_2D_Visibility_Computation,PkgVisibility_2} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin diff --git a/Visibility_2/doc/Visibility_2/visibility_2.txt b/Visibility_2/doc/Visibility_2/visibility_2.txt index fe963a3307a..6b406fb6fd6 100644 --- a/Visibility_2/doc/Visibility_2/visibility_2.txt +++ b/Visibility_2/doc/Visibility_2/visibility_2.txt @@ -14,14 +14,19 @@ namespace CGAL { This package provides functionality to compute the visibility region within polygonal regions in two dimensions. Using the terminology of the package \ref PkgBooleanSetOperations2Summary, we expect the input polygon -\f$ P \f$ to be a valid polygon or a valid polygon with holes, -that is, we expect \f$ P \f$ to be closed (\f$\partial P \subset P\f$) and each boundary loop -(only one outer boundary loop in case of no holes) to be relatively simple. +\f$ P \f$ to be a valid polygon or a valid polygon with holes (definition see below). Given two points \f$ p \f$ and \f$ q \f$ in \f$ P \f$, they are said to be visible to each other iff the segment \f$ pq \subset P \f$, note that \f$\partial P \subset P\f$. For a query point \f$ q \in P \f$, the set of points that are visible from \f$ q \f$ is defined as the visibility region of \f$ q \f$, denoted by \f$ V_q \f$ + +Definition [Valid Polygon]: +A polygon \f$ P \f$ is valid if \f$ P \f$ is closed (\f$\partial P \subset P\f$) +and each boundary loop (only one outer boundary loop in case of no holes) is simple. +See also \ref PkgBooleanSetOperations2Summary. + + \subsection visibility_2_degeneracies Degeneracies and Regularization \cgalFigureBegin{definition-fig, example1.png} @@ -60,8 +65,8 @@ the means to define a family of algorithms, each implemented by a separate class algorithms are made interchangeable, letting the algorithm in use vary according to the user choice.} for answering queries. Similar to the point-location case, some of the strategies require preprocessing. Thus, before a visibility object is used to answer visibility queries, it must be attached to an arrangement object (subsequently also referred to as the environment). -Since a viability object observers changes to the attached arrangement it is possible to -also modify the arrangement after attaching the visibility object. +Afterwards the visibility object observers changes to the attached arrangement. +Thus, it is possible to modify the arrangement after attaching the visibility object. However, this should be avoided as this also requires an update of the auxiliary data structures in the attached object. @@ -77,10 +82,10 @@ The package provides the following models of the `Visibility_2` concept: Class | Function | Preprocessing | Query |Algorithm -------------------------------|-----------------------------------------------------|-------------------------------|-----------------------------------|------------------------------- - `Simple_polygon_visibility_2` | simple valid polygons | No |\f$ O(n) \f$ time and \f$ O(n) \f$ space | paper of B.Joe and R.B.Simpson \cite bjrb-clvpa-87 - `Rotational_sweep_visibility_2` | valid polygons with holes | No | \f$ O(n\log n) \f$ time and \f$ O(n) \f$ space | paper of T.Asano \cite ta-aeafvpprh-85 -`Triangular_expansion_visibility_2` | valid polygons with holes | \f$ O(n) \f$ time and \f$ O(n) \f$ space | \f$ O(nh) \f$ time and \f$ O(n) \f$ space. | reference is unknown. - `Preprocessed_rotational_sweep_visibility_2` | valid polygons with holes | \f$ O(n^2) \f$ time and \f$ O(n^2) \f$ space | \f$ O(n) \f$ time and \f$ O(n) \f$ space | paper of Takao Asano, Tetsuo Asano etc \cite aaghi-vpsesp-85 + `Simple_polygon_visibility_2` | simple valid polygons | No |\f$ O(n) \f$ time and \f$ O(n) \f$ space | B.Joe and R.B.Simpson \cite bjrb-clvpa-87 + `Rotational_sweep_visibility_2` | valid polygons with holes | No | \f$ O(n\log n) \f$ time and \f$ O(n) \f$ space | T.Asano \cite ta-aeafvpprh-85 +`Triangular_expansion_visibility_2` | valid polygons with holes | \f$ O(n) \f$ time and \f$ O(n) \f$ space | \f$ O(nh) \f$ time and \f$ O(n) \f$ space. | new + `Preprocessed_rotational_sweep_visibility_2` | valid polygons with holes | \f$ O(n^2) \f$ time and \f$ O(n^2) \f$ space | \f$ O(n) \f$ time and \f$ O(n) \f$ space | Takao Asano, Tetsuo Asano etc \cite aaghi-vpsesp-85 Where \f$ n \f$ is the number of vertices of \f$ f \f$ and \f$ h \f$ is the number of holes+1.