mirror of https://github.com/CGAL/cgal
fixed req. vs. precond.; fixed iterator name; made example an include of
a program; added implementation section
This commit is contained in:
parent
1c191a6abd
commit
5b0c8b87be
|
|
@ -11,17 +11,17 @@ Function for testing the $y$-monotonicity of a sequence of points.
|
|||
\ccFunction{
|
||||
template<class InputIterator, class Traits>
|
||||
bool
|
||||
is_y_monotone_2(InputIterator first, InputIterator last,
|
||||
is_y_monotone_2(InputIterator first, InputIterator beyond,
|
||||
const Traits& traits);
|
||||
}
|
||||
{
|
||||
Determines if the sequence of points in the range
|
||||
[\ccc{first}, \ccc{last}) define a $y$-monotone
|
||||
[\ccc{first}, \ccc{beyond}) define a $y$-monotone
|
||||
polygon or not. If so, the function returns \ccc{true}, otherwise it
|
||||
returns \ccc{false}.
|
||||
}
|
||||
|
||||
\ccHeading{Preconditions}
|
||||
\ccHeading{Requirements}
|
||||
\ccIndexSubitem[C]{is_y_monotone_2}{preconditions}
|
||||
\begin{enumerate}
|
||||
\item \ccc{Traits} is a model of the concept IsYMonotoneTraits\_2.%
|
||||
|
|
@ -29,57 +29,31 @@ returns \ccc{false}.
|
|||
\item \ccc{InputIterator::value_type} should be \ccc{Traits::Point_2}.
|
||||
\end{enumerate}
|
||||
|
||||
The default traits class \ccc{Default_traits} is the \cgal\ \ccc{Kernel_traits_2}
|
||||
class,
|
||||
The default traits class \ccc{Default_traits} is the kernel in which the
|
||||
type \ccc{InputIterator::value_type} is defined.%
|
||||
\ccIndexTraitsClassDefault{is_y_monotone_2}
|
||||
with the representation type determined by \ccc{InputIterator::value_type}.
|
||||
|
||||
\ccSeeAlso
|
||||
\ccRefIdfierPage{CGAL::Is_y_monotone_2<Traits>} \\
|
||||
\ccRefIdfierPage{CGAL::y_monotone_partition_2} \\
|
||||
\ccRefIdfierPage{CGAL::y_monotone_partition_is_valid_2}
|
||||
|
||||
\ccImplementation
|
||||
|
||||
This function requires $O(n)$ time for a polygon with $n$ vertices.
|
||||
|
||||
\ccExample
|
||||
|
||||
The following code fragment computes a $y$-monotone partitioning
|
||||
of the simple polygon \ccc{P} using the default
|
||||
The following program computes a $y$-monotone partitioning
|
||||
of a polygon using the default
|
||||
traits class and stores the partition polygons in the list
|
||||
\ccc{partition_polys}. It then asserts that each of the partition
|
||||
polygons is, in fact, a $y$-monotone polygon. (Note that this
|
||||
assertion is superfluous unless the postcondition checking done
|
||||
polygons is, in fact, a $y$-monotone polygon and that the partition
|
||||
is valid. (Note that the
|
||||
assertions are superfluous unless the postcondition checking done
|
||||
by \ccc{y_monotone_partition_2} has been turned off during compilation.)
|
||||
|
||||
\begin{verbatim}
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Partition_traits_2.h>
|
||||
#include <CGAL/partition_2.h>
|
||||
#include <CGAL/is_y_monotone_2.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Cartesian<double> R;
|
||||
typedef CGAL::Polygon_traits_2<R> Traits;
|
||||
typedef Traits::Point_2 Point_2;
|
||||
typedef Traits::Polygon_2 Polygon_2
|
||||
|
||||
Polygon_2 P;
|
||||
std::list<Polygon_2> partition_polys;
|
||||
|
||||
// ...
|
||||
// insert vertices into P to create a simple CCW-oriented polygon
|
||||
// ...
|
||||
CGAL::y_monotone_partition_2(P.vertices_begin(),
|
||||
P.vertices_end(),
|
||||
std::back_inserter(partition_polys));
|
||||
|
||||
std::list<Polygon_2>::const_iterator poly_it;
|
||||
for (poly_it = partition_polys.begin(); poly_it != partition_polys.end();
|
||||
poly_it++)
|
||||
{
|
||||
assert(CGAL::is_y_monotone_2((*poly_it).vertices_begin(),
|
||||
(*poly_it).vertices_end()));
|
||||
}
|
||||
\end{verbatim}
|
||||
\ccIncludeExampleCode{Partition_2/y_monotone_ex.C}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,17 @@ OutputIterator y_monotone_partition_2(InputIterator first,
|
|||
const Traits& traits = Default_traits);
|
||||
}
|
||||
{
|
||||
computes a partition of the simple, counterclockwise-oriented polygon defined
|
||||
by the points in the range [\ccc{first}, \ccc{last}) into $y$-monotone
|
||||
computes a partition of the polygon defined
|
||||
by the points in the range [\ccc{first}, \ccc{beyond}) into $y$-monotone
|
||||
polygons. The counterclockwise-oriented partition polygons are written to
|
||||
the sequence starting at position \ccc{result}. The past-the-end iterator for
|
||||
the resulting sequence of polygons is returned.
|
||||
\ccPrecond The points in the range [\ccc{first}, \ccc{beyond}) define a
|
||||
simple, counterclockwise-oriented polygon.
|
||||
%\ccIndexSubitem[C]{y_monotone_partition_2}{preconditions}
|
||||
}
|
||||
|
||||
\ccHeading{Requirements}
|
||||
%\ccIndexSubitem[C]{y_monotone_partition_2}{preconditions}
|
||||
\begin{enumerate}
|
||||
\item \ccc{Traits} is a model of the concept YMonotonePartitionTraits\_2%
|
||||
\ccIndexMainItem[c]{YMonotonePartitionTraits_2} and, for the purposes
|
||||
|
|
@ -36,8 +38,6 @@ the resulting sequence of polygons is returned.
|
|||
\item \ccc{InputIterator::value_type} should be \ccc{Traits::Point_2},
|
||||
which should also be the type of the points stored in an object
|
||||
of type \ccc{Traits::Polygon_2}.
|
||||
\item Points in the range $[first, beyond)$ must define a simple polygon
|
||||
whose vertices are oriented counterclockwise.
|
||||
\end{enumerate}
|
||||
|
||||
The default traits class \ccc{Default_traits} is \ccc{Partition_traits_2},
|
||||
|
|
@ -53,41 +53,22 @@ with the representation type determined by \ccc{InputIterator::value_type}.
|
|||
|
||||
\ccImplementation
|
||||
|
||||
This function implements the algorithm presented by de Bert \textit{et al.}
|
||||
This function implements the algorithm presented by de Berg \textit{et al.}
|
||||
\cite{bkos-cgaa-97} which requires $O(n \log n)$ time
|
||||
and $O(n)$ space for a polygon with $n$ vertices.
|
||||
|
||||
\ccExample
|
||||
|
||||
|
||||
The following code fragment will compute a $y$-monotone partitioning
|
||||
of the simple polygon \ccc{P} using the default
|
||||
traits class and store the partition polygons in the list
|
||||
\ccc{partition_polys}.
|
||||
The following program computes a $y$-monotone partitioning
|
||||
of a polygon using the default
|
||||
traits class and stores the partition polygons in the list
|
||||
\ccc{partition_polys}. It then asserts that each partition polygon
|
||||
produced is, in fact, $y$-monotone and that the partition is valid.
|
||||
(Note that these assertions are superfluous unless the postcondition
|
||||
checking for \ccc{y_monotone_partition_2} has been turned off.)
|
||||
|
||||
\begin{verbatim}
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Polygon_traits_2.h>
|
||||
#include <CGAL/partition_2.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Cartesian<double> R;
|
||||
typedef CGAL::Polygon_traits_2<R> Traits;
|
||||
typedef Traits::Point_2 Point_2;
|
||||
typedef std::list<Point_2> Container;
|
||||
typedef CGAL::Polygon_2<Traits, Container> Polygon_2;
|
||||
|
||||
Polygon_2 P;
|
||||
std::list<Polygon_2> partition_polys;
|
||||
|
||||
// ...
|
||||
// insert vertices into P to create a simple CCW-oriented polygon
|
||||
// ...
|
||||
CGAL::y_monotone_partition_2(P.vertices_begin(),
|
||||
P.vertices_end(),
|
||||
std::back_inserter(partition_polys));
|
||||
\end{verbatim}
|
||||
\ccIncludeExampleCode{Partition_2/y_monotone_ex.C}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@ Function for testing the $y$-monotonicity of a sequence of points.
|
|||
\ccFunction{
|
||||
template<class InputIterator, class Traits>
|
||||
bool
|
||||
is_y_monotone_2(InputIterator first, InputIterator last,
|
||||
is_y_monotone_2(InputIterator first, InputIterator beyond,
|
||||
const Traits& traits);
|
||||
}
|
||||
{
|
||||
Determines if the sequence of points in the range
|
||||
[\ccc{first}, \ccc{last}) define a $y$-monotone
|
||||
[\ccc{first}, \ccc{beyond}) define a $y$-monotone
|
||||
polygon or not. If so, the function returns \ccc{true}, otherwise it
|
||||
returns \ccc{false}.
|
||||
}
|
||||
|
||||
\ccHeading{Preconditions}
|
||||
\ccHeading{Requirements}
|
||||
\ccIndexSubitem[C]{is_y_monotone_2}{preconditions}
|
||||
\begin{enumerate}
|
||||
\item \ccc{Traits} is a model of the concept IsYMonotoneTraits\_2.%
|
||||
|
|
@ -29,57 +29,31 @@ returns \ccc{false}.
|
|||
\item \ccc{InputIterator::value_type} should be \ccc{Traits::Point_2}.
|
||||
\end{enumerate}
|
||||
|
||||
The default traits class \ccc{Default_traits} is the \cgal\ \ccc{Kernel_traits_2}
|
||||
class,
|
||||
The default traits class \ccc{Default_traits} is the kernel in which the
|
||||
type \ccc{InputIterator::value_type} is defined.%
|
||||
\ccIndexTraitsClassDefault{is_y_monotone_2}
|
||||
with the representation type determined by \ccc{InputIterator::value_type}.
|
||||
|
||||
\ccSeeAlso
|
||||
\ccRefIdfierPage{CGAL::Is_y_monotone_2<Traits>} \\
|
||||
\ccRefIdfierPage{CGAL::y_monotone_partition_2} \\
|
||||
\ccRefIdfierPage{CGAL::y_monotone_partition_is_valid_2}
|
||||
|
||||
\ccImplementation
|
||||
|
||||
This function requires $O(n)$ time for a polygon with $n$ vertices.
|
||||
|
||||
\ccExample
|
||||
|
||||
The following code fragment computes a $y$-monotone partitioning
|
||||
of the simple polygon \ccc{P} using the default
|
||||
The following program computes a $y$-monotone partitioning
|
||||
of a polygon using the default
|
||||
traits class and stores the partition polygons in the list
|
||||
\ccc{partition_polys}. It then asserts that each of the partition
|
||||
polygons is, in fact, a $y$-monotone polygon. (Note that this
|
||||
assertion is superfluous unless the postcondition checking done
|
||||
polygons is, in fact, a $y$-monotone polygon and that the partition
|
||||
is valid. (Note that the
|
||||
assertions are superfluous unless the postcondition checking done
|
||||
by \ccc{y_monotone_partition_2} has been turned off during compilation.)
|
||||
|
||||
\begin{verbatim}
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Partition_traits_2.h>
|
||||
#include <CGAL/partition_2.h>
|
||||
#include <CGAL/is_y_monotone_2.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Cartesian<double> R;
|
||||
typedef CGAL::Polygon_traits_2<R> Traits;
|
||||
typedef Traits::Point_2 Point_2;
|
||||
typedef Traits::Polygon_2 Polygon_2
|
||||
|
||||
Polygon_2 P;
|
||||
std::list<Polygon_2> partition_polys;
|
||||
|
||||
// ...
|
||||
// insert vertices into P to create a simple CCW-oriented polygon
|
||||
// ...
|
||||
CGAL::y_monotone_partition_2(P.vertices_begin(),
|
||||
P.vertices_end(),
|
||||
std::back_inserter(partition_polys));
|
||||
|
||||
std::list<Polygon_2>::const_iterator poly_it;
|
||||
for (poly_it = partition_polys.begin(); poly_it != partition_polys.end();
|
||||
poly_it++)
|
||||
{
|
||||
assert(CGAL::is_y_monotone_2((*poly_it).vertices_begin(),
|
||||
(*poly_it).vertices_end()));
|
||||
}
|
||||
\end{verbatim}
|
||||
\ccIncludeExampleCode{Partition_2/y_monotone_ex.C}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,17 @@ OutputIterator y_monotone_partition_2(InputIterator first,
|
|||
const Traits& traits = Default_traits);
|
||||
}
|
||||
{
|
||||
computes a partition of the simple, counterclockwise-oriented polygon defined
|
||||
by the points in the range [\ccc{first}, \ccc{last}) into $y$-monotone
|
||||
computes a partition of the polygon defined
|
||||
by the points in the range [\ccc{first}, \ccc{beyond}) into $y$-monotone
|
||||
polygons. The counterclockwise-oriented partition polygons are written to
|
||||
the sequence starting at position \ccc{result}. The past-the-end iterator for
|
||||
the resulting sequence of polygons is returned.
|
||||
\ccPrecond The points in the range [\ccc{first}, \ccc{beyond}) define a
|
||||
simple, counterclockwise-oriented polygon.
|
||||
%\ccIndexSubitem[C]{y_monotone_partition_2}{preconditions}
|
||||
}
|
||||
|
||||
\ccHeading{Requirements}
|
||||
%\ccIndexSubitem[C]{y_monotone_partition_2}{preconditions}
|
||||
\begin{enumerate}
|
||||
\item \ccc{Traits} is a model of the concept YMonotonePartitionTraits\_2%
|
||||
\ccIndexMainItem[c]{YMonotonePartitionTraits_2} and, for the purposes
|
||||
|
|
@ -36,8 +38,6 @@ the resulting sequence of polygons is returned.
|
|||
\item \ccc{InputIterator::value_type} should be \ccc{Traits::Point_2},
|
||||
which should also be the type of the points stored in an object
|
||||
of type \ccc{Traits::Polygon_2}.
|
||||
\item Points in the range $[first, beyond)$ must define a simple polygon
|
||||
whose vertices are oriented counterclockwise.
|
||||
\end{enumerate}
|
||||
|
||||
The default traits class \ccc{Default_traits} is \ccc{Partition_traits_2},
|
||||
|
|
@ -53,41 +53,22 @@ with the representation type determined by \ccc{InputIterator::value_type}.
|
|||
|
||||
\ccImplementation
|
||||
|
||||
This function implements the algorithm presented by de Bert \textit{et al.}
|
||||
This function implements the algorithm presented by de Berg \textit{et al.}
|
||||
\cite{bkos-cgaa-97} which requires $O(n \log n)$ time
|
||||
and $O(n)$ space for a polygon with $n$ vertices.
|
||||
|
||||
\ccExample
|
||||
|
||||
|
||||
The following code fragment will compute a $y$-monotone partitioning
|
||||
of the simple polygon \ccc{P} using the default
|
||||
traits class and store the partition polygons in the list
|
||||
\ccc{partition_polys}.
|
||||
The following program computes a $y$-monotone partitioning
|
||||
of a polygon using the default
|
||||
traits class and stores the partition polygons in the list
|
||||
\ccc{partition_polys}. It then asserts that each partition polygon
|
||||
produced is, in fact, $y$-monotone and that the partition is valid.
|
||||
(Note that these assertions are superfluous unless the postcondition
|
||||
checking for \ccc{y_monotone_partition_2} has been turned off.)
|
||||
|
||||
\begin{verbatim}
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Polygon_traits_2.h>
|
||||
#include <CGAL/partition_2.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Cartesian<double> R;
|
||||
typedef CGAL::Polygon_traits_2<R> Traits;
|
||||
typedef Traits::Point_2 Point_2;
|
||||
typedef std::list<Point_2> Container;
|
||||
typedef CGAL::Polygon_2<Traits, Container> Polygon_2;
|
||||
|
||||
Polygon_2 P;
|
||||
std::list<Polygon_2> partition_polys;
|
||||
|
||||
// ...
|
||||
// insert vertices into P to create a simple CCW-oriented polygon
|
||||
// ...
|
||||
CGAL::y_monotone_partition_2(P.vertices_begin(),
|
||||
P.vertices_end(),
|
||||
std::back_inserter(partition_polys));
|
||||
\end{verbatim}
|
||||
\ccIncludeExampleCode{Partition_2/y_monotone_ex.C}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue