Some fixes (thanks Michael H.)

This commit is contained in:
Ron Wein 2006-11-08 11:39:49 +00:00
parent 52e2f1f327
commit 04b5f686c5
12 changed files with 8743 additions and 44 deletions

2
.gitattributes vendored
View File

@ -616,6 +616,8 @@ Envelope_2/doc_tex/Envelope_2/fig/ex_circle.eps -text svneol=unset#application/p
Envelope_2/doc_tex/Envelope_2/fig/ex_circle.fig -text svneol=unset#application/octet-stream
Envelope_2/doc_tex/Envelope_2/fig/ex_circle.gif -text svneol=unset#image/gif
Envelope_2/doc_tex/Envelope_2/fig/ex_circle.pdf -text svneol=unset#application/pdf
Envelope_2/doc_tex/Envelope_2/fig/lwrenv.eps -text svneol=unset#application/postscript
Envelope_2/doc_tex/Envelope_2/fig/lwrenv.pdf -text svneol=unset#application/pdf
Envelope_2/doc_tex/Envelope_2/fig/min_diag.eps -text svneol=unset#application/postscript
Envelope_2/doc_tex/Envelope_2/fig/min_diag.fig -text svneol=unset#application/octet-stream
Envelope_2/doc_tex/Envelope_2/fig/min_diag.gif -text svneol=unset#image/gif

View File

@ -1,3 +1,19 @@
\begin{figure}[!htp]
\begin{center}
\begin{ccTexOnly}
\includegraphics{Envelope_2/fig/lwrenv}
\end{ccTexOnly}
\label{fig:teaser}
\begin{ccHtmlOnly}
<p><center>
<img src="./fig/lwrenv.gif" border=0 alt="Lower Envelope">
</center>
\end{ccHtmlOnly}
\caption{The lower envelope of a set of line segments and hyperbolic
arc.}
\end{center}
\end{figure}
A continuous curve $C$ in $\reals^2$ is called {\em $x$-monotone}, if
every vertical line intersects it at a single point at most. For
@ -5,6 +21,8 @@ example, the circle $x^2 + y^2 = 1$ is {\em not} $xy$-monotone as the
vertical line $x = 0$ intersects it at $(0, -1)$ and at $(0, 1)$;
however, it is possible to split the circle into an upper part and a
lower part, such that both of these parts are $x$-monotone.
We consider vertical segments as {\em weakly} $x$-monotone, to properly
handle inputs that contain such vertical curves.
An $x$-monotone curve can be represented as a univariate function
$y = C(x)$, defined over some continuous range $R_C \subseteq \reals$.
@ -45,7 +63,7 @@ Given a set of $x$-monotone curves $\calC$, the {\em minimization
diagram} of $\calC$ is a subdivision of the $x$-axis into cells,
such that the identity of the curves that induce the lower envelope
over a specific cell of the subdivision (an edge or a vertex) is the
same. In non-degenerate situation, an edge --- which represents a
same. In non-degenerate situations, an edge --- which represents a
continuous interval on the $x$-axis --- is induced by a single
curve (or by no curves at all, if there are no $x$-monotone curves
defined over the interval), and a vertex is induced by a single curve
@ -62,11 +80,9 @@ the boundary of its range of definition $R_{C_k}$ onto the $x$-axis
and label the features it induces accordingly. Given a set
$\hat{\calC}$ of (non necessarily $x$-monotone) curves in $\reals^2$,
we subdivide each curve into a finite number of weakly $x$-monotone
curves,\footnote{We consider vertical segments as {\em weakly}
$x$-monotone, to handle degenerate inputs properly.} and obtain the set
$\calC$. Then, we split the set into two disjoint subsets $\calC_1$
and $\calC_2$, and we compute their envelope diagrams recursively.
Finally, we merge the diagrams, and we do this in linear time
curves, and obtain the set $\calC$. Then, we split the set into two
disjoint subsets $\calC_1$ and $\calC_2$, and we compute their envelope
diagrams recursively. Finally, we merge the diagrams in linear time by
traversing both diagrams in parallel.
\section{The Envelope Diagram}
@ -75,11 +91,11 @@ traversing both diagrams in parallel.
The package basically contains two sets of free functions:
\ccc{lower_envelope_x_monotone_2 (begin, end, diag)} (similarly
\ccc{upper_envelope_x_monotone_2()}) accepts a range of $x$-monotone
curves and computes the envelope diagram;
\ccc{upper_envelope_x_monotone_2()}) construct the envelope diagram
for a given range of $x$-monotone curves, while
\ccc{lower_envelope_2 (begin, end, diag)} (similarly
\ccc{upper_envelope_2()}) accepts a range of {\em arbitrary} (not
necessarily $x$-monotone) curves and computes the envelope diagram.
\ccc{upper_envelope_2()}) construct the envelope diagram for a
range of {\em arbitrary} (not necessarily $x$-monotone) curves.
In this section we explain more on the structure of the envelope
diagram these functions output.
@ -100,7 +116,7 @@ The minimization diagram is shown at the bottom, where
each diagram vertex points to the point associated with it, and the
labels of the segment that induce a diagram edge are displayed below
this edge. Note that there exists one edge that represents an overlap
(even if more than a single curve induces it), and there are also a
(i.e., there are two segments that induce it), and there are also a
few edges that represent empty intervals.\label{env2_fig:min_diag}}
\end{figure}
@ -116,12 +132,12 @@ Figure~\ref{env2_fig:min_diag} shows the lower envelope of a set of
eight line segments, and sketches the structure of their minimization
diagram. Each diagram vertex $v$ is associated with a point $p_v$ on
the envelope, which corresponds to either a curve endpoint
or to an intersection point of two curves (or more). The vertex is
or to an intersection point of two (or more) curves. The vertex is
therefore associated with a set of $x$-monotone curves that induce the
envelope over $p_v$. Each vertex is incident to two edges, one lying
to its left and the other to its right.
An edge in the envelope diagram represent a continuous portion of the
An edge in the envelope diagram represents a continuous portion of the
$x$-axis, and is associated with a set of $x$-monotone curves that
induce the envelope over this interval. Note that this set may be
empty if no $x$-monotone curves are defined over this interval. In
@ -144,12 +160,15 @@ Any model of the \ccRefName\ concept must define a geometric
traits class, which in turn defines the \ccc{Point_2} and
\ccc{X_monotone_curve_2} types defined with the diagram features.
The geometric traits class must be a model of the
\ccc{ArrangementXMonotoneTraits_2} concept in case we compute
\ccc{ArrangementXMonotoneTraits_2} concept in case we construct
envelopes of $x$-monotone curves. If we are interested in handling
arbitrary (not necessarily $x$-monotone) curves, the traits class
must be a model of the refined \ccc{ArrangementTraits_2} concept.
In the latter case, the traits class also defines a \ccc{Curve_2}
type.
must be a model of the \ccc{ArrangementTraits_2} concept. This
concepts refined the \ccc{ArrangementXMonotoneTraits_2} concept;
a traits class that models this concepts must also defines a
\ccc{Curve_2} type, representing an arbitrary planar curve, and
provide a functor for subdividing such curves into $x$-monotone
subcurves.
\section{Examples}
%=================

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -16,11 +16,13 @@
An edge record in an envelope diagram, which represents a continuous portion
of the $x$-axis. It is associated with a (possibly empty) set of curves that
induce the envelope over this portion of the $x$-axis. Note that all curves
in this set overlap of the interval represented by the edge.
in this set overlap over the interval represented by the edge.
\ccTypes
%=======
\ccNestedType{Size}{the size type (convertible to \ccc{size_t}).}
\ccNestedType{Vertex}{the corresponding diagram-vertex type.}
\ccNestedType{X_monotone_curve_2}{the $x$-monotone curve type.}
@ -55,10 +57,12 @@ in this set overlap of the interval represented by the edge.
{return a past-the-end iterator for the $x$-monotone curves associated with \ccVar.}
\ccMethod{Vertex_const_handle left() const;}
{returns the vertex lying to \ccVar's left.}
\ccGlue
{returns the vertex lying to \ccVar's left.
\ccPrecond{\ccVar\ is not the leftmost edge in the diagram.}}
\ccMethod{Vertex_const_handle right() const;}
{returns the vertex lying to \ccVar's right.}
{returns the vertex lying to \ccVar's right.
\ccPrecond{\ccVar\ is not the rightmost edge in the diagram.}}
\ccModifiers
%===========

View File

@ -14,7 +14,7 @@
%============
A vertex record in an envelope diagram. It is always associated with a point
on the lower (upper) envelope of a set of curves. A vertex is also
on the lower (upper) envelope of a non-empty set of curves. A vertex is also
associated with a set of $x$-monotone curves that induce the envelope
over this point. It is incident to two edges, one lying to its
left and the other to its right.
@ -22,6 +22,8 @@ left and the other to its right.
\ccTypes
%=======
\ccNestedType{Size}{the size type (convertible to \ccc{size_t}).}
\ccNestedType{Edge}{the corresponding diagram-edge type.}
\ccNestedType{Point_2}{the point type associated with the vertex.}

View File

@ -15,11 +15,14 @@
The default envelope-diagram class used by the envelops functions to represent
the lower or the upper envelope of a set of curves. It is parameterized by a
traits class, which is a model of the \ccc{ArrangementXMontoneTraits_2}
traits class, which is a model of the \ccc{ArrangementXMonotoneTraits_2}
concept, in case we handle only envelopes of $x$-monotone curves, or of the
refined \ccc{ArrangementTraits_2} concept in case we handle arbitrary planar
curves.
The space needed by this envelope-diagram class is linear in the size of
the minimization diagram, and traversing requires linear time.
\ccInclude{CGAL/Env_default_diagram_1.h}
\ccIsModel

View File

@ -13,16 +13,16 @@
\ccDefinition
%============
This concept defines the representation of an evelope diagram of a set
This concept defines the representation of an envelope diagram of a set
of planar curve. The {\em envelope diagram} is a subdivision of the $x$-axis
into $0$-dimensional cells ({\em vertices}) and $1$-dimensional cells
({\em edges}), such that the identity of the curves that induce the lower
envelope (or the upper envelope) over each cell is fixed.
A vertex in an envelope diagram is therefore associated with a point
on the lower (upper) envelope, and corresponds to either a curve endpoint
or to an intersection point of two curves (or more). The vertex is also
associated with a set of $x$-monotone curves that induce the envelope
on the envelope, and corresponds to either a curve endpoint
or to an intersection point of two (or more) curves. Therefore each vertex
is associated with a set of $x$-monotone curves that induce the envelope
over this point. Each vertex is incident to two edges, one lying to its
left and the other to its right.
@ -51,7 +51,7 @@ traits class, which in turn defines the \ccc{Point_2} and
\ccTypedef{typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;}
{the $x$-monotone curve type.}
\ccNestedType{Size}{the size type.}
\ccNestedType{Size}{the size type (convertible to \ccc{size_t}).}
\ccNestedType{Curve_const_iterator}
{an iterator for the $x$-monotone curves that induce a diagram feature.
@ -62,20 +62,25 @@ traits class, which in turn defines the \ccc{Point_2} and
\ccNestedType{Edge}{the edge type, a model of the concept \ccc{EnvelopeDiagramEdge}.}
\ccNestedType{Vertex_handle}
{a handle to a diagram vertex.
The \ccc{Vertex_const_handle} type is also defined.}
{a handle to a diagram vertex.}
\ccGlue
\ccNestedType{Vertex_const_handle}
{a non-mutable handle to a diagram vertex.}
\ccNestedType{Edge_handle}
{a handle to a diagram edge.
The \ccc{Edge_const_handle} type is also defined.}
{a handle to a diagram edge.}
\ccGlue
\ccNestedType{Edge_const_handle}
{a non-mutable handle to a diagram edge.}
\ccCreation
\ccCreationVariable{diag}
%========================
\ccConstructor{EnvelopeDiagram_1();}
{constructs an empty diagram containing one unbounded face,
which corresponds to the entire plane and has no originators.}
{constructs an empty diagram containing one unbounded edge,
which corresponds to the entire plane and has no $x$-monotone
curves that are associated with it.}
\ccConstructor{Envelope_diagram_1 (const Self& other);}
{copy constructor.}

View File

@ -11,7 +11,7 @@
\label{env2_ref_sec:intro}
% ========================
This package consits of functions that compute the lower (or upper)
This package consists of functions that compute the lower (or upper)
envelope of a set of arbitrary curves in 2D. The output is
represented as an envelope diagram, namely a subdivision of the
$x$-axis into intervals, such that the identity of the curves that

View File

@ -21,7 +21,7 @@
represented using the output minimization diagram \ccc{diag},
which must be a model of the \ccc{EnvelopeDiagram_1} concept.
\ccPrecond{The value-type of \ccc{InputIterator} is
\ccc{EnvelopeDiagram::Traits_2::X_monotone_curve_2}.}}
\ccc{EnvelopeDiagram::X_monotone_curve_2}.}}
\end{ccRefFunction}

View File

@ -21,7 +21,7 @@
represented using the output maximization diagram \ccc{diag},
which must be a model of the \ccc{EnvelopeDiagram_1} concept.
\ccPrecond{The value-type of \ccc{InputIterator} is
\ccc{EnvelopeDiagram::Traits_2::X_monotone_curve_2}.}}
\ccc{EnvelopeDiagram::X_monotone_curve_2}.}}
\end{ccRefFunction}

View File

@ -38,7 +38,7 @@ int main (int argc, char **argv)
return (1);
}
// Read the points from the file, and consturct their dual lines.
// Read the points from the file, and construct their dual lines.
unsigned int n;
int px, py;
std::vector<Point_2> points;
@ -48,7 +48,7 @@ int main (int argc, char **argv)
in_file >> n;
points.resize (n);
for (k = 0; k < n; k++)
for (k = 0; k < n; ++k)
{
in_file >> px >> py;
points[k] = Point_2 (px, py);
@ -74,9 +74,9 @@ int main (int argc, char **argv)
upper_envelope_x_monotone_2 (dual_lines.begin(), dual_lines.end(),
max_diag);
// Output the points along the boundary convex hull in a counterclockwise
// Output the points along the boundary convex hull in counterclockwise
// order. We start by traversing the minimization diagram from left to
// right, then the maximization diagram from left to right.
// right, then the maximization diagram from right to left.
Diagram_1::Edge_const_handle e = min_diag.leftmost();
std::cout << "The convex hull of " << points.size() << " input points:";
@ -87,12 +87,12 @@ int main (int argc, char **argv)
e = e->right()->right();
}
e = max_diag.leftmost();
while (e != max_diag.rightmost())
e = max_diag.rightmost();
while (e != max_diag.leftmost())
{
k = e->curve().data(); // The index of the dual point.
std::cout << " (" << points[k] << ')';
e = e->right()->right();
e = e->left()->left();
}
std::cout << std::endl;