modified doc according to first review

This commit is contained in:
Francisc 2013-08-01 13:49:26 +03:00
parent fa95497340
commit c817c461e2
8 changed files with 28 additions and 15 deletions

View File

@ -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. 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); 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 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 f is the face of the arrangement in which the visibility region is computed
\param out_arr is the output arrangement \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` \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 \return the face handle to the face in `out_arr` that represents the visibility region
*/ */

View File

@ -98,7 +98,9 @@ Returns whether an arrangement is attached to the visibility object
bool is_attached(); 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); 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 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 f is the face of the arrangement in which the visibility region is computed
\param out_arr is the output arrangement \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` \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 \return the face handle to the face in `out_arr` that represents the visibility region
*/ */

View File

@ -113,7 +113,9 @@ Returns whether an arrangement is attached to the visibility object
bool is_attached (); 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); 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 out_arr is the output arrangement
\param q is the query point from which the visibility region is computed \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 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` \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 \return the face handle to the face in `out_arr` that represents the visibility region
*/ */

View File

@ -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. 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); 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 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 f is the face of the arrangement in which the visibility region is computed
\param out_arr is the output arrangement \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` \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 \return the face handle to the face in `out_arr` that represents the visibility region
*/ */

View File

@ -91,6 +91,8 @@ Returns whether an arrangement is attached to the visibility object
/*! /*!
Attaches the given arrangement `arr` 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); void attach (const Input_arrangement_2 &arr);

View File

@ -7,12 +7,12 @@ namespace CGAL {
\authors Michael Hemmer, Kan Huang, Francisc Bungiu \authors Michael Hemmer, Kan Huang, Francisc Bungiu
\section visibility_2_introduction Introduction
\cgalFigureBegin{example_figure,visibility-teaser.png} \cgalFigureBegin{example_figure,visibility-teaser.png}
An example figure. An example figure.
\cgalFigureEnd \cgalFigureEnd
\section visibility_2_introduction Introduction
This package provides functionality to compute the visibility area within polygonal regions in two dimensions. 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$, 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$. where \f$\partial P \f$ denotes the boundary of \f$ P \f$.
@ -28,7 +28,7 @@ Non-regularized visibility and regularized visibility.
\cgalFigureEnd \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, 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 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) 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. 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, As the package is based on the \ref PkgArrangement2, a regular 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 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.
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. \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. The following example shows how to obtain the regularized and non-regularized visibility regions.

View File

@ -8,8 +8,8 @@
#include <istream> #include <istream>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Point_2<Kernel> Point_2; typedef Kernel::Point_2 Point_2;
typedef CGAL::Segment_2<Kernel> Segment_2; typedef Kernel::Segment_2 Segment_2;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2; typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;

View File

@ -75,6 +75,7 @@ public:
void detach() { void detach() {
p_arr = NULL; p_arr = NULL;
geom_traits = NULL; geom_traits = NULL;
vertices.clear();
} }
Input_arrangement_2 arr() { Input_arrangement_2 arr() {
@ -188,6 +189,7 @@ public:
segments.begin(), segments.begin(),
segments.end()); segments.end());
CGAL_precondition(out_arr.number_of_isolated_vertices() == 0); CGAL_precondition(out_arr.number_of_isolated_vertices() == 0);
CGAL_precondition(s.size() == 0);
conditional_regularize(out_arr, Regularization_tag()); conditional_regularize(out_arr, Regularization_tag());
vertices.clear(); vertices.clear();
} }
@ -266,7 +268,9 @@ public:
segments.begin(), segments.begin(),
segments.end()); segments.end());
CGAL_precondition(out_arr.number_of_isolated_vertices() == 0); CGAL_precondition(out_arr.number_of_isolated_vertices() == 0);
CGAL_precondition(s.size() == 0);
conditional_regularize(out_arr, Regularization_tag()); conditional_regularize(out_arr, Regularization_tag());
vertices.clear();
} }
void print_arrangement(const Arrangement_2 &arr) { void print_arrangement(const Arrangement_2 &arr) {