first version of CCPA

This commit is contained in:
Eric Berberich 2006-10-12 17:06:50 +00:00
parent 9b3148b2b3
commit 6a720eaef5
8 changed files with 564 additions and 0 deletions

View File

@ -0,0 +1,9 @@
\begin{ccPkgDescription}{Curve- and CurvePairAnalysis \label{Pkg:CurveAndCurvePairAnalysis}}
\ccPkgHowToCiteCgal{cgal:ccpa-bhkt}
\ccPkgSummary{
This package is ...
}
\ccPkgIntroducedInCGAL{3.?}
\ccPkgLicense{?}
\end{ccPkgDescription}

View File

@ -0,0 +1,8 @@
\ccUserChapter{Curve- and CurvePairAnalysis}
\label{chapter-curve-and-curvepair-analysis}
\ccChapterAuthor{Eric Berberich \and Michael Hemmer \and Menelaos Karavelas \and Monique Teillaud}
\input{Curve_and_curve_pair_analysis_2/PkgDescription}
\minitoc

View File

@ -0,0 +1,52 @@
\begin{ccRefConcept}{AlgebraicCurveKernel_2}
\ccDefinition
The \ccc{AlgebraicCurveKernel_2} concept is meant to provide the curved
kernel with all the algebraic functionalities on bivariate polynomials
required for the manipulation of arcs of algebraic curves of general degree
$\R^2$ using an $y$-per-$x$-view on the curves.
\ccTypes
A model of \ccc{AlgebraicCurveKernel_2} is supposed to provide
\ccNestedType{Coefficient}{A model of \ccc{IntegralDomain}. }
\ccNestedType{Polynomial_2}{A model of \ccc{Polynomial_2}, for
bivariate polynomials on an \ccc{IntegralDomain} coefficient type.
it must also be possible to perform \ccc{Canonicalize,
GcdUpToConstantFactor,
IntegralDivUpToConstantFactor,
MakeSquareFreeUpToConstantFactor, and
SquareFreeFactorizationUpToConstantFactor} on this type - maybe using a
traits class. Also needed some PolynomialConstruction concept
}
% TODO: Boundary: RealEmbeddable that is 'dense R'
\ccNestedType{Solution_2}{A model of
\ccc{AlgebraicCurveKernel_2::Solution_2}, for solutions of systems
of two bivariate polynomials of type \ccc{Polynomial_2}.}
\ccNestedType{CurvePairAnalysis_2}{A model of
\ccc{AlgebraicCurveKernel_2::CurvePairAnalysis_2},
for analysing a pair of curves
defined as two analyses of type \ccc{CurveAnalysis_2}.}
\ccNestedType{CurveAnalysis_2}{A model of
\ccc{CurvePairAnalyis_2::CurveAnalysis_2}, for analysing single
curves defined as bivariate polynomials of type \ccc{Polynomial_2}.}
\ccNestedType{Compare_x_2}{A model of the concept
\ccc{AlgebraicKernel_d_2::CompareX_2}.}
\ccGlue
\ccNestedType{Compare_y_2}{A model of the concept
\ccc{AlgebraicKernel_d_2::CompareY_2}.}
\ccGlue
\ccNestedType{Compare_xy_2}{A model of the concept
\ccc{AlgebraicKernel_d_2::CompareXY_2}.}
\end{ccRefConcept}

View File

@ -0,0 +1,184 @@
\begin{ccRefConcept}{CurveVerticalLine}
\ccDefinition
The \ccc{CurveVerticalLine} concept is meant to provide information
about the intersections of a curve with a vertical line at a given
finite $x$-coordinate. Note that a curve can have a vertical line component
at this coordinate and/or also non-vertical components intersecting
this vertical line. With the help of the concept's methods one is able
to compute the local topology of the curve at the given vertical line.
Note that vertical lines at $x = \pm\infty$ are not allowed, since different
events (curve end going to infinity with different non-horizontal asympotes)
would have equal $y$-coordinate ($\pm\infty$), which confuses more than it
helps. Note in addition that curve ends approaching the vertical asymptote
introduce an event (depending on whether approaching $+\infty$ or $-\infty$ -
but the event with coordinates $(x,-\infty)$, resp. $(x,+\infty)$, occur
only once, if they occur)
\ccTypes
\ccNestedType{Solution_1}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_1} concept
}
\ccNestedType{Solution_2}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_2} concept
}
\ccCreationVariable{cvl}
\ccAccessFunctions
\ccMethod{Solution_1 x();}{
returns the $x$-coordinate of the vertical line (always a finite value).
}
\ccMethod{bool covers_line();}{
returns \ccc{true} in case the given curve contains the vertical line as
a component
}
\ccMethod{unsigned int num_events();}{
returns number of distinct intersection of a curve with a
(fictious) vertical line ignoring a real vertical line component
of the curve at the given $x$-coordinate.
}
\ccMethod{Solution_2 get_solution_2(int j);}{
returns an object of type \ccc{Solution_2} for the $j$-th event
\ccPrecond{$0 \leq j < \mbox{num\_events()}$}
}
\ccMethod{std::pair< unsigned int, unsigned int > get_num_branches(int j);}{
returns the number of branches of the curve connected to $j$-th event
immediately to the left,
to the right, respectively, as a pair of \ccc{unsigned int} ignoring
vertical curve components at the given $x$-coordinate.
\ccPrecond{$0 \leq j < \mbox{num\_events()}$}
}
\ccMethod{bool has_event_of_curve();}{
returns \ccc{true} if curve has vertical line component or
curve $f$ has intersection with $f_y$ at $x$
}
%
%TODO: Do we want to have CVLs for minus and plus infinity as additional
%events? For the sake of a nice interface
%(see CurveAnalysis\_2) we want to have it: A user can then just ask for the
%behavior of the curve at $x = \pm\infty$. On the other side counting
%the number of intersection points is not well-defined: Consider several
%curve end with the same horizontal asymptote - are they equal or not?
%It's unsure whether one can compute the $y$-coordinates of these points -
%maybe even not the ``sign of infinity''. One solution is to forbid access
%to get\_solution\_2 for CurveVerticalLines with $x = \pm\infty$.
%
\end{ccRefConcept}
\begin{ccRefConcept}{CurveAnalysis_2}\footnote{There is no need
for curves to be algebraic, hence the generic name. Only the number
of events must be finite.}
\ccDefinition
The \ccc{CurveAnalysis_2} concept is meant to provide tools to analyse a single
curve. An analysis is meant to describe the curve's interesting points and how
they are connected. The analysis searches for {\it events}. Events only
occur at a finite number of $x$-coordinates. Each such coordinate defines
a CurveVerticalLine of an event. These coordinates also define open
{\it intervals} on the $x$-axis. CurveVerticalLines at values within one
such interval only differ in the values of the Solution\_2 entries.
Topological information are equal.
\ccRefines{
\ccc{DefaultConstructible, CopyConstructible, Assignable}
}
\ccTypes
\ccNestedType{Solution_1}
{Is a model of \ccc{AlgebraicCurveKernel_2::Solution_1} concept}
\ccNestedType{Solution_2}
{Is a model of \ccc{AlgebraicCurveKernel_2::Solution_2} concept}
\ccNestedType{Polynomial_2}{
Is a model of \ccc{AlgebraicCurveKernel_2::Polynomial_2}
concept.\\
Especially needed: Canonicalize, GcdUpToConstantFactor,
IntegralDivUpToConstantFactor,
MakeSquareFreeUpToConstantFactor, and
SquareFreeFactorizationUpToConstantFactor
}
\ccNestedType{Curve_vertical_ine}
{Is a model of the \ccc{CurveAnalysis_2::CurveVerticalLine} concept}
\ccCreation
\ccCreationVariable{ca}
\ccConstructor{CurveAnalysis_2(Polynomial_2 p);}
{constructs an analysis for the curve defined by p. The polynomial must
be squarefree.}
\begin{ccAdvanced}
\ccConstructor{template < class InputIterator >
CurveAnalysis_2(Polynomial_2 p, InputIterator begin, InputIterator end);}{
constructs an analysis for the curve defined by p. The polynomial must
be squarefree. The iterator range [begin,end) contains factors of
$\mbox{resultant}(p,p_y,y)$, i.e., define $x$-coordinates,
which allows to simplify the real root isolation within this layer.
The \ccc{value_type} of InputIterator is \ccc{Polynomial_2}.
This constructor has been introduced to enable an upper layer (CK) to use
additional knowledge on the problem.
}
\end{ccAdvanced}
\ccAccessFunctions
\ccMethod{Polynomial_2 get_polynomial_2();}{
returns the defining polynomial of the anyalsis
}
\ccMethod{unsigned int num_vertical_lines_with_event();}{
returns number of vertical lines that encode an event
}
%\ccMethod{void x_to_id(Solution_1 x, bool\& is_event, unsigned int\& i);}{
% For a given $x$, this method computes whether the vertical line at this $x$
% contains an event (\ccc{is_event} == \ccc{true}) and returns the id $i$
% of it. Otherwise, $i$ returns the id of the interval $x$ lies in.
%}
\ccMethod{Curve_vertical_line vertical_line_at_event(int i);}{
returns an instance of \ccc{CurveVerticalLine} at the $i$-th event
}
\ccMethod{Curve_vertical_line vertical_line_of_interval(int i);}{
returns an instance of \ccc{CurveVerticalLine} of the $i$-th interval
between $x$-events.
}
\ccMethod{Curve_vertical_line vertical_line_for_x(Solution_1 x,
CGAL::Sign perturb = CGAL::ZERO););}{
returns vertical\_line\_at\_event(i), if $x$ hits $i$-th event, otherwise
returns vertical\_line\_of\_interval(i), where $i$ is the id of the interval
$x$ lies in. If $pertub$ is CGAL::POSITIVE/CGAL::NEGATIVE, then a slighty
perturbed x is used (adding $\pm\epsilon$).
\ccPrecond{$x$ is finite}
}
\ccMethod{Curve_vertical_line vertical_line_at_exact_x(Solution_1 x);}{
returns an instance of \ccc{CurveVerticalLine} at the given $x$.
\ccPrecond{$x$ is finite}
}
Note that the access methods to vertical lines are not redundant! The ones
using an id-value are efficient for speed-ups (caching, avoids to search some
$x$, just one representative vertical line for an interval). The others
enables a user to compute vertical lines for given $x$, i.e. also to
$y$-coordinates at given $x$.
\end{ccRefConcept}

View File

@ -0,0 +1,205 @@
\begin{ccRefConcept}{CurvePairVerticalLine}
\ccDefinition
The \ccc{CurvePairVerticalLine} concept is meant to provide information
about the intersections of a pair of curves with a (fictious) vertical line
(ignoring vertical lines of the curves themselves). Each intersection of a
curve with the vertical line defined by some given $x$ induces an event.
An event can be asked for its coordinates (\ccc{Solution_2}) and the involved
curve(s). Note that the involvment also holds for curve ends approaching the
vertical asymptote. Again CurvePairVerticalLines at $x = \pm\infty$ are
not allowed.
\ccTypes
\ccNestedType{Solution_1}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_1} concept
}
\ccNestedType{Solution_2}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_2} concept
}
\ccCreationVariable{cpvl}
\ccAccessFunctions
\ccMethod{Solution_1 x();}{
returns the $x$-coordinate of the vertical line (always a finite value).
}
\ccMethod{unsigned int num_events();}{
returns number of distinct intersections of a pair of curves with a
(fictious) vertical line ignoring a real vertical line component
of the curves at the given $x$-coordinate.
}
\ccMethod{int get_y_position_of_event(int k, bool c);}{
returns the $y$-position of the $k$-th arc of the $c$-''th''
(0 or 1) curve in the sequence of events. Note that each event
is formed by the first, the second, or both curves.
\ccPrecond{$0 \leq j < \mbox{number of arcs defined for the curve at x()}$}
}
\ccMethod{int get_multiplicity_of_intersection_event(int j);}{
returns the multiplicity of intersection defined at event with position $j$
\ccPrecond{Both curves form event $j$}
\ccPrecond{$0 \leq j < \mbox{num\_events()}$}
}
\ccMethod{std::pair< int, int > curve_arcs_at_event(int j);}{
returns a pair of int indicating whether event $j$ is formed by
which arc numbers of the first and the second curve, or $-1$, if the
corresponding curve is not involved.
\ccPrecond{$0 \leq j < \mbox{num\_events()}$}
}
\ccMethod{Solution_2 get_solution_2(int j);}{
returns an object of type \ccc{Solution_2} for the $j$-the event
\ccPrecond{$0 \leq j < \mbox{num\_events()}$}
}
\ccMethod{bool has_event_of_curve();}{
returns \ccc{true} if curve has vertical line component or
curve $f$ has intersection with $f_y$ at $x$
}
\end{ccRefConcept}
\begin{ccRefConcept}{CurvePairAnalysis_2}
\ccDefinition
The \ccc{CurvePairAnalysis_2} concept is meant to provide tools to analyse
a pair of curves. An analysis is meant to describe the curve pair's
interesting points and how they are connected.
The analysis searches for {\it events}. Events only
occur at a finite number of $x$-coordinate. Each such coordinate is
covered by a CurvePairVerticalLine, originated by the events of a single curve
and also the intersections of two curves.
These coordinates also define open {\it intervals}
on the $x$-axis. CurvePairVerticalLines at values in between one such interval
differ only in the values of the Solution\_2 entries. Topological
information are equal.
\ccRefines{
\ccc{DefaultConstructible, CopyConstructible, Assignable}
}
\ccTypes
\ccNestedType{Solution_1}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_1} concept
}
\ccNestedType{Solution_2}{
Is a model of the \ccc{AlgebraicCurveKernel_2::Solution_2} concept
}
\ccNestedType{Polynomial_2}{
Is a model of \ccc{AlgebraicCurveKernel_2::Polynomial_2}
concept.\\
Especially needed: Canonicalize, GcdUpToConstantFactor,
IntegralDivUpToConstantFactor,
MakeSquareFreeUpToConstantFactor, and
SquareFreeFactorizationUpToConstantFactor
}
\ccNestedType{Curve_pair_vertical_line}
{Is a model of the \ccc{CurvePairAnalysis_2::CurvePairVerticalLine} concept}
\ccNestedType{Curve_analysis_2}
{Is a model of the \ccc{CurvePairAnalysis::CurveAnalysis_2} concept}
\ccCreation
\ccCreationVariable{cp}
\ccConstructor{CurvePairAnalysis_2(Curve_analysis_2 p1, Curve_analysis_2 p2);}
{constructs an analysis for the curve-pair defined by analyses given by
p1 and p2. The polynomials defining the analyses must be squarefree and
coprime.
}
\begin{ccAdvanced}
\ccConstructor{template < class InputIterator >
CurvePairAnalysis_2(Curve_analysis_2 p1, Curve_analysis_2 p2,
InputIterator begin, InputIterator end);}{
constructs an analysis for the pair of curves defined by $p1$ and $p2$.
The polynomials definining the analyses must be squarefree and coprime.
The iterator range [begin,end) contains factors of $\mbox{resultant}(p,q,y)$,
i.e., define $x$-coordinates,
which allows to simplify the real root isolation within this layer.
The \ccc{value_type} of InputIterator is \ccc{Polynomial_1}.
This constructor has been introduced to enable an upper layer (CK) to use
additional knowledge on the problem.
}
\end{ccAdvanced}
\ccAccessFunctions
\ccMethod{Curve_analysis_2 get_curve_analysis(bool c);}{
returns curve analyis for $c$-''th'' curve (0 or 1)
}
\ccMethod{unsigned int num_vertical_lines_with_event();}{
returns number of vertical lines that encode an event
}
%\ccMethod{void x_to_id(Solution_1 x, bool\& is_event, unsigned int\& i);}{
% For a given $x$, this method computes whether the vertical line at this $x$
% contains an event (\ccc{is_event} == \ccc{true}) and returns the id $i$
% of it. Otherwise, $i$ returns the id of the interval $x$ lies in.
%}
\ccMethod{int event_of_curve_analysis(unsigned int i, bool c);}{
Given the $i$-th event,
this method returns the id of the event of the corresponding curve
analysis $c$ (0 or 1), or $-1$, if the curve has no event at this coordinate.
}
\ccMethod{Curve_pair_vertical_line vertical_line_at_event(int i);}{
returns an instance of \ccc{CurvePairVerticalLine} at the $i$-th event
}
\ccMethod{Curve_pair_vertical_line vertical_line_of_interval(int i);}{
returns an instance of \ccc{CurvePairVerticalLine} of the $i$-th interval
between $x$-events.
}
\ccMethod{Curve_pair_vertical_line vertical_line_for_x(Solution_1 x,
CGAL::Sign perturb = CGAL::ZERO);}{
returns vertical\_line\_at\_event(i), if $x$ hits $i$-th event, otherwise
returns vertical\_line\_of\_interval(i), where $i$ is the id of the interval
$x$ lies in. If $pertub$ is CGAL::POSITIVE/CGAL::NEGATIVE, then a slighty
perturbed x is used (adding $\pm\epsilon$).
\ccPrecond{$x$ is finite}
}
\ccMethod{Curve_pair_vertical_line vertical_line_at_exact_x(Solution_1 x);}{
returns an instance of \ccc{CurvePairVerticalLine} at the given $x$
\ccPrecond{$x$ is finite}
}
Note that the access methods to vertical lines are not redundant! The ones
using an id-value are efficient for speed-ups (caching, avoids to search some
$x$, just one representative vertical line for an interval). The others
enables a user to compute vertical lines for given $x$, i.e. also to
$y$-coordinates at given $x$.
%Additionally note that we talk about 4 sequences of $x$-critical lines here.
%
%\begin{itemize}
%\item The sequence of CurveVerticalLines of $p$ where each CVL has been
%converted and merged with $q$ to a CVPL.
%\item The sequence of CurveVerticalLines of $q$ where each CVL has been
%converted and merged with $p$ to a CPVL.
%\item The sequence of CurvePairVerticalLines of the intersections of
%$p$ and $q$
%\item The merged sequence of CurvePairVerticalLines of the former three
%sequences. The method event\_id\_of\_x helps to find indeces in the first
%three sequences starting from an index in this sequence!
%\end{itemize}
\end{ccRefConcept}

View File

@ -0,0 +1,51 @@
\begin{ccRefConcept}{Solution_1}
\ccDefinition
The concept \ccc{Solution_1} is meant to store a coordinate ($x$, or $y$) of
a point on curve.
\ccRefines
\ccc{RealEmbeddable}
Remark: Michael Hemmer proposed to extend the concept \ccc{RealEmbeddable}
with the notion of compactification (adding/dealing with $\pm\infty$). A
valid model has to implement handling of infinity.
\begin{ccAdvanced}
\ccTypes
\ccTypedef{typedef typename Solution_1::Boundary Boundary;}{A NT being able
to represent values between two Solution\_1}
\ccCreationVariable{sol1}
\ccAccessFunctions
Is this type meant to be really abstract (only RealEmbeddable) or
do we want to have access
to certain entries? In general, it should be possible to use an appropriate
NT here, i.e., a NT that fits the needs of the CA/CPA.
TODO: Defining polynomial?
TODO: For some purposes (e.g., drawing, seperation) it is useful to have the
following methods:
\ccMethod{Boundary between(Solution_1 s);}{
returns a rational between \ccc{sol1} and \ccc{s}
\ccPrecond{sol1 != s}
}
\ccMethod{std::pair<Boundary,Boundary> s1.approximate(int prec);}{
Refines the representation to the given precision (binary digits
after point). Internally the precision can already be higher.
}
The advanced methods can be seen as a refined concept for enabling drawing.
Maybe, we can have it orthogonal to the normal concept.
\end{ccAdvanced}
\end{ccRefConcept}

View File

@ -0,0 +1,43 @@
\begin{ccRefConcept}{Solution_2}
\ccDefinition
The concept \ccc{Solution_2} is meant to store both coordinates of a point
on a curve.
\ccCreationVariable{sol2}
\ccAccessFunctions
\ccMethod{Solution_1 x();}{
returns $x$-coordinate.
May throw some exception if algebraic degree becomes to large.
Usual always computed and therefore easy to access.
}
\ccMethod{Solution_1 y();}{
returns $y$-coordinate.
May throw some exception if algebraic degree becomes to large.
Note that it can be costly to compute this value, so accessing it
should be handled with care.
}
\ccMethod{std::pair<Boundary,Boundary> s1.approximate_x(int prec);}{
Refines the representation of $x$ to the given precision
(binary digits after point).
Internally the precision can already be higher. Note that it can just
refer to x().approximate(), but it can be more efficient or just possible
to compute it without constructing the exact value.
}
\ccMethod{std::pair<Boundary,Boundary> s1.approximate_y(int prec);}{
Refines the representation of $y$ to the given precision
(binary digits after point).
Internally the precision can already be higher. Note that it can just
refer to y().approximate(), but it can be more efficient or just possible
to compute it without constructing the exact value.
}
\end{ccRefConcept}

View File

@ -0,0 +1,12 @@
\ccRefChapter{Curve- and CurvePairAnalysis}
Initial remark: The design is not symmetric in the coordinates, due to the fact
that people also only talk about ``vertical decomposition'' and not
``horizontal decompositions''. A {\it horizontal} version can easily
derived from the concept, if needed.
\input{Curve_and_curve_pair_analysis_2_ref/Solution_1}
\input{Curve_and_curve_pair_analysis_2_ref/Solution_2}
\input{Curve_and_curve_pair_analysis_2_ref/CurveAnalysis_2}
\input{Curve_and_curve_pair_analysis_2_ref/CurvePairAnalysis_2}
\input{Curve_and_curve_pair_analysis_2_ref/AlgebraicCurveKernel_2}