This commit is contained in:
Andreas Fabri 2012-09-23 15:28:32 +00:00
parent 91687a445c
commit 39561475cd
4 changed files with 32 additions and 43 deletions

View File

@ -3,7 +3,7 @@
\ingroup PkgPolygon2Concepts \ingroup PkgPolygon2Concepts
\cgalconcept \cgalconcept
The `Polygon_2` class and the functions that implement the The `CGAL::Polygon_2` class and the functions that implement the
functionality found in that class each are parameterized by a traits functionality found in that class each are parameterized by a traits
class that defines the primitives used in the algorithms. The concept class that defines the primitives used in the algorithms. The concept
`PolygonTraits_2` defines this common set of requirements. `PolygonTraits_2` defines this common set of requirements.
@ -94,7 +94,7 @@ typedef Hidden_type Compute_area_2;
/// @} /// @}
/// \name Operations /// \name Operations
CONVERROR Check if this needs to be spread\n/// The following functions that create instances of the above predicate object types must exist. /// The following functions that create instances of the above predicate object types must exist.
/// @{ /// @{
/*! /*!

View File

@ -25,14 +25,14 @@ The following algorithms are available:
All those operations take two forward iterators as parameters in order to All those operations take two forward iterators as parameters in order to
describe the polygon. These parameters have a point type as value type. describe the polygon. These parameters have a point type as value type.
The type Polygon_2 can be used to represent polygons. The type `Polygon_2` can be used to represent polygons.
Polygons are dynamic. Vertices can be modified, inserted and erased. Polygons are dynamic. Vertices can be modified, inserted and erased.
They provide the algorithms described above as member functions. They provide the algorithms described above as member functions.
Moreover, they provide ways of iterating over the vertices and edges. Moreover, they provide ways of iterating over the vertices and edges.
Currently, the Polygon_2 class is a nice wrapper around a container of Currently, the `Polygon_2` class is a nice wrapper around a container of
points, but little more. Especially, computed values are not cached. points, but little more. Especially, computed values are not cached.
That is, when the Polygon_2::is_simple() member function is called That is, when the `Polygon_2::is_simple()` member function is called
twice or more, the result is computed each time anew. twice or more, the result is computed each time anew.
\section Examples \section Examples
@ -62,8 +62,8 @@ are organized in parallel slices, generated by segmentation
of image data from a scanner. of image data from a scanner.
In order to avoid an explixit projection on the \c xy plane, one can In order to avoid an explixit projection on the \c xy plane, one can
use the traits class Projection_traits_xy_3 which is part of the 2D use the traits class `Projection_traits_xy_3` which is part of the 2D
and 3D Linear Geometric Kernel. and 3D Linear Geometric %Kernel.
\include projected_polygon.cpp \include projected_polygon.cpp

View File

@ -53,8 +53,7 @@ namespace CGAL {
/// can be any class that fulfills the requirements for an STL /// can be any class that fulfills the requirements for an STL
/// container. It defaults to the std::vector class. /// container. It defaults to the std::vector class.
/// ///
/// Implementation /// ### Implementation ###
/// --------------
/// ///
/// The methods `is_simple()`, `is_convex()`, `orientation()`, /// The methods `is_simple()`, `is_convex()`, `orientation()`,
/// `oriented_side()`, `bounded_side()`, `bbox()`, `area()`, `left_vertex()`, /// `oriented_side()`, `bounded_side()`, `bbox()`, `area()`, `left_vertex()`,
@ -63,11 +62,7 @@ namespace CGAL {
/// the corresponding global functions for information about which /// the corresponding global functions for information about which
/// algorithms were used and what complexity they have. /// algorithms were used and what complexity they have.
/// ///
/// Example
/// -------
/// The following code fragment creates a polygon and checks if it is convex.
///
/// \cgalexample{Polygon.cpp}
template <class Traits_P, class Container_P template <class Traits_P, class Container_P
= std::vector<typename Traits_P::Point_2> > = std::vector<typename Traits_P::Point_2> >
class Polygon_2 { class Polygon_2 {

View File

@ -50,7 +50,7 @@ namespace CGAL {
/// with the smallest `y`-coordinate is taken. /// with the smallest `y`-coordinate is taken.
/// ///
/// \requires `Traits` is a model of the concept `PolygonTraits_2`. /// \requires `Traits` is a model of the concept `PolygonTraits_2`.
/// In fact, only the members `Less_xy_2` and /// Only the members `Less_xy_2` and
/// `less_xy_2_object()` are used. /// `less_xy_2_object()` are used.
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
/// ///
@ -68,7 +68,7 @@ ForwardIterator left_vertex_2(ForwardIterator first,
/// with the largest `y`-coordinate is taken. /// with the largest `y`-coordinate is taken.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// In fact, only the members `Less_xy_2` and /// In fact, only the members `Less_xy_2` and
/// `less_xy_2_object()` are used. /// `less_xy_2_object()` are used.
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
@ -88,8 +88,8 @@ ForwardIterator right_vertex_2(ForwardIterator first,
/// with the largest `x`-coordinate is taken. /// with the largest `x`-coordinate is taken.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// In fact, only the members `Less_yx_2` and /// Only the members `Less_yx_2` and
/// `less_yx_2_object()` are used. /// `less_yx_2_object()` are used.
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
/// ///
@ -107,8 +107,8 @@ ForwardIterator top_vertex_2(ForwardIterator first,
/// with the smallest `x`-coordinate is taken. /// with the smallest `x`-coordinate is taken.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// In fact, only the members `Less_yx_2` and /// Only the members `Less_yx_2` and
/// `less_yx_2_object()` are used. /// `less_yx_2_object()` are used.
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
/// ///
@ -126,8 +126,8 @@ ForwardIterator bottom_vertex_2(ForwardIterator first,
/// Returns the bounding box of the range `[first,last)`. /// Returns the bounding box of the range `[first,last)`.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// In fact, only the members `Construct_bbox_2` and /// Only the members `Construct_bbox_2` and
/// `construct_bbox_2_object()` are used. /// `construct_bbox_2_object()` are used.
/// \requires The value type of `InputIterator` must be `Traits::Point_2`. /// \requires The value type of `InputIterator` must be `Traits::Point_2`.
/// ///
@ -146,7 +146,7 @@ Bbox_2 bbox_2(InputIterator first,
/// returns the area instead of taking it as a parameter. /// returns the area instead of taking it as a parameter.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2 /// `PolygonTraits_2.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Compute_area_2` : Computes the signed area of the /// - `Compute_area_2` : Computes the signed area of the
/// oriented triangle defined by 3 `Point_2` passed as arguments. /// oriented triangle defined by 3 `Point_2` passed as arguments.
@ -218,10 +218,10 @@ polygon_area_2( ForwardIterator first, ForwardIterator last,
return result; return result;
} }
/// The function is_convex_2 computes if a polygon is convex. /// Checks if the polygon is convex.
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Less_xy_2` /// - `Less_xy_2`
/// - `Orientation_2` /// - `Orientation_2`
@ -236,14 +236,12 @@ bool is_convex_2(ForwardIterator first,
ForwardIterator last, ForwardIterator last,
const Traits& traits); const Traits& traits);
/// The function is_simple_2 computes if a polygon is simple, that is, if the edges /// Checks if the polygon defined by the
/// iterator range `[first,last)` is simple, that is, if the edges
/// do not intersect, except consecutive edges in their common vertex. /// do not intersect, except consecutive edges in their common vertex.
/// ///
/// Checks if the polygon defined by the
/// iterator range `[first,last)` is simple.
///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Point_2` /// - `Point_2`
/// - `Less_xy_2` /// - `Less_xy_2`
@ -252,12 +250,11 @@ bool is_convex_2(ForwardIterator first,
/// - `orientation_2_object()` /// - `orientation_2_object()`
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
/// ///
/// Implementation /// ### Implementation##
/// --------------
/// ///
/// The simplicity test is implemented by means of a plane sweep algorithm. /// The simplicity test is implemented by means of a plane sweep algorithm.
/// The algorithm is quite robust when used with inexact number types. /// The algorithm is quite robust when used with inexact number types.
/// The running time is O(n log n), where n is the number of vertices of the /// The running time is `O(n log n)`, where n is the number of vertices of the
/// polygon. /// polygon.
/// ///
/// \sa `PolygonTraits_2 ` /// \sa `PolygonTraits_2 `
@ -270,9 +267,9 @@ bool is_simple_2(ForwardIterator first,
// In the following two functions we would like to use Traits::Point_2 // In the following two functions we would like to use Traits::Point_2
// instead of Point, but this is not allowed by g++ 2.7.2. // instead of Point, but this is not allowed by g++ 2.7.2.
/// ///
/// The function oriented_side_2 computes on which side of a polygon a point lies. /// Computes on which side of a polygon a point lies.
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Less_xy_2` /// - `Less_xy_2`
/// - `Compare_x_2` /// - `Compare_x_2`
@ -295,8 +292,7 @@ Oriented_side oriented_side_2(ForwardIterator first,
const Point& point, const Point& point,
const Traits& traits); const Traits& traits);
/// The function bounded_side_2 computes if a point lies inside a polygon. /// Computes if a point lies inside a polygon.
/// The function bounded_side_2 computes if a point lies inside a polygon.
/// The polygon is defined by the sequence of points `[first,last)`. /// The polygon is defined by the sequence of points `[first,last)`.
/// Being inside is defined by the odd-even rule. If we take a ray starting at the /// Being inside is defined by the odd-even rule. If we take a ray starting at the
/// point and extending to infinity (in any direction), we count the number of /// point and extending to infinity (in any direction), we count the number of
@ -307,7 +303,7 @@ Oriented_side oriented_side_2(ForwardIterator first,
/// ///
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Compare_x_2` /// - `Compare_x_2`
/// - `Compare_y_2` /// - `Compare_y_2`
@ -317,8 +313,7 @@ Oriented_side oriented_side_2(ForwardIterator first,
/// - `orientation_2_object()` /// - `orientation_2_object()`
/// \requires The value type of `ForwardIterator` must be `Traits::Point_2`, /// \requires The value type of `ForwardIterator` must be `Traits::Point_2`,
/// ///
/// Implementation /// ### Implementation ###
/// --------------
/// ///
/// The running time is linear in the number of vertices of the polygon. /// The running time is linear in the number of vertices of the polygon.
/// A horizontal ray is taken to count the number of intersections. /// A horizontal ray is taken to count the number of intersections.
@ -335,12 +330,11 @@ Bounded_side bounded_side_2(ForwardIterator first,
const Point& point, const Point& point,
const Traits& traits); const Traits& traits);
/// The function orientation_2 computes if a polygon is clockwise or counterclockwise /// Computes if a polygon is clockwise or counterclockwise oriented.
/// oriented.
/// \pre `is_simple_2(first, last, traits);` /// \pre `is_simple_2(first, last, traits);`
/// ///
/// \requires `Traits` is a model of the concept /// \requires `Traits` is a model of the concept
/// `PolygonTraits_2` /// `PolygonTraits_2`.
/// Only the following members of this traits class are used: /// Only the following members of this traits class are used:
/// - `Less_xy_2` /// - `Less_xy_2`
/// - `less_xy_2_object()` /// - `less_xy_2_object()`