mirror of https://github.com/CGAL/cgal
Use of global variable `CGAL_random' instead of `CGAL_Random()' as default parameter
Changes according to test report by M. Hoffmann (97/05/16)
This commit is contained in:
parent
e8f173cde0
commit
8b0342c6d4
|
|
@ -91,7 +91,7 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
\ccPostcond \ccc{\ccVar.is_empty()} = \ccc{true}.}
|
\ccPostcond \ccc{\ccVar.is_empty()} = \ccc{true}.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( const CGAL_Min_circle_2<I>&);}{
|
\ccConstructor{ CGAL_Min_circle_2( CGAL_Min_circle_2<I> const&);}{
|
||||||
copy constructor.}
|
copy constructor.}
|
||||||
|
|
||||||
\ccConstructor{ CGAL_Min_circle_2( Point const& p, I const& i = I());}{
|
\ccConstructor{ CGAL_Min_circle_2( Point const& p, I const& i = I());}{
|
||||||
|
|
@ -118,8 +118,8 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
CGAL_Min_circle_2( InputIterator first,
|
CGAL_Min_circle_2( InputIterator first,
|
||||||
InputIterator last,
|
InputIterator last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
introduces a variable \ccVar\ of type \ccClassTemplateName. It
|
introduces a variable \ccVar\ of type \ccClassTemplateName. It
|
||||||
is initialized to $mc(P)$ with $P$ being the set of points in
|
is initialized to $mc(P)$ with $P$ being the set of points in
|
||||||
the range [\ccc{first},\ccc{last}). If \ccc{randomize} is
|
the range [\ccc{first},\ccc{last}). If \ccc{randomize} is
|
||||||
|
|
@ -132,30 +132,34 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
\ccPrecond The value type of \ccc{first} and \ccc{last} is
|
\ccPrecond The value type of \ccc{first} and \ccc{last} is
|
||||||
\ccc{Point}.}
|
\ccc{Point}.}
|
||||||
|
|
||||||
\emph{Note:} Since most compilers do not support member templates yet,
|
{\em Note:} Since most compilers do not support member templates yet,
|
||||||
we provide specialized constructors instead. In the current release
|
we provide specialized constructors instead. In the current release
|
||||||
there are constructors for C arrays (using pointers as iterators) and
|
there are constructors for C arrays (using pointers as iterators) and
|
||||||
for STL sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
for the STL sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( const Point* first,
|
\ccConstructor{ CGAL_Min_circle_2( const Point* first,
|
||||||
const Point* last,
|
const Point* last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
STL-like constructor for random access iterators.}
|
STL-like constructor for random access iterators.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( list<Point>::const_iterator first,
|
\ccConstructor{ CGAL_Min_circle_2( list<Point>::const_iterator first,
|
||||||
list<Point>::const_iterator last,
|
list<Point>::const_iterator last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
STL-like constructor for sequence container list<Point>.}
|
STL-like constructor for sequence container list<Point>.}
|
||||||
|
|
||||||
|
\ccHidden
|
||||||
|
\ccConstructor{ ~CGAL_Min_circle_2( );}{
|
||||||
|
destructor.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccMemberFunction{ CGAL_Min_circle_2<I>&
|
\ccMemberFunction{ CGAL_Min_circle_2<I>&
|
||||||
operator = ( const CGAL_Min_circle_2<I>&);}{
|
operator = ( CGAL_Min_circle_2<I> const&);}{
|
||||||
assignment operator.}
|
assignment operator.}
|
||||||
|
|
||||||
% -----------------------------------------------------------------------------
|
% -----------------------------------------------------------------------------
|
||||||
|
|
@ -200,26 +204,25 @@ bounded side, i.e.\ its unbounded side equals the whole plane $\E_2$.
|
||||||
bounded_side( Point const& p) const;}{
|
bounded_side( Point const& p) const;}{
|
||||||
returns \ccc{CGAL_ON_BOUNDED_SIDE},\ccTexHtml{$\:$}{ }%
|
returns \ccc{CGAL_ON_BOUNDED_SIDE},\ccTexHtml{$\:$}{ }%
|
||||||
\ccc{CGAL_ON_BOUNDARY}, or \ccc{CGAL_ON_UNBOUNDED_SIDE}
|
\ccc{CGAL_ON_BOUNDARY}, or \ccc{CGAL_ON_UNBOUNDED_SIDE}
|
||||||
iff \ccc{p} lies inside, on the boundary, or outside of
|
iff \ccc{p} lies properly inside, on the boundary, or properly
|
||||||
\ccVar, resp.}
|
outside of \ccVar, resp.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool has_on_bounded_side( Point const& p) const;}{
|
\ccMemberFunction{ bool has_on_bounded_side( Point const& p) const;}{
|
||||||
returns \ccc{true}, iff \ccc{p} lies inside \ccVar.}
|
returns \ccc{true}, iff \ccc{p} lies properly inside \ccVar.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool has_on_boundary( Point const& p) const;}{
|
\ccMemberFunction{ bool has_on_boundary( Point const& p) const;}{
|
||||||
returns \ccc{true}, iff \ccc{p} lies on the boundary
|
returns \ccc{true}, iff \ccc{p} lies on the boundary
|
||||||
of \ccVar.}
|
of \ccVar.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool
|
\ccMemberFunction{ bool has_on_unbounded_side( Point const& p) const;}{
|
||||||
has_on_unbounded_side( Point const& p) const;}{
|
returns \ccc{true}, iff \ccc{p} lies properly outside of \ccVar.}
|
||||||
returns \ccc{true}, iff \ccc{p} lies outside of \ccVar.}
|
|
||||||
|
|
||||||
\ccMemberFunction{ bool is_empty( ) const;}{
|
\ccMemberFunction{ bool is_empty( ) const;}{
|
||||||
returns \ccc{true}, iff \ccVar\ is empty (this implies
|
returns \ccc{true}, iff \ccVar\ is empty (this implies
|
||||||
degeneracy).}
|
degeneracy).}
|
||||||
|
|
||||||
\ccMemberFunction{ bool is_degenerate( ) const;}{
|
\ccMemberFunction{ bool is_degenerate( ) const;}{
|
||||||
returns \ccc{true}, iff \ccVar\ is degenerate, i.e. if
|
returns \ccc{true}, iff \ccVar\ is degenerate, i.e.\ if
|
||||||
\ccVar\ is empty or equal to a single point, equivalently if
|
\ccVar\ is empty or equal to a single point, equivalently if
|
||||||
the number of support points is less than 2.}
|
the number of support points is less than 2.}
|
||||||
|
|
||||||
|
|
@ -245,7 +248,7 @@ An object \ccVar\ is valid, iff
|
||||||
\item[c)] $S$ is minimal, i.e.\ no support point is redundant.
|
\item[c)] $S$ is minimal, i.e.\ no support point is redundant.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
Using the ready-made implementation for the interface class with exact
|
Using the ready-made implementation for the interface class with exact
|
||||||
arithmetic as described in Section~\ref{sec:opt_I_Impl} garantees
|
arithmetic as described in Section~\ref{sec:opt_I_Impl} guarantees
|
||||||
validity of \ccVar. The following function is mainly intended for
|
validity of \ccVar. The following function is mainly intended for
|
||||||
debugging user supplied interface classes.
|
debugging user supplied interface classes.
|
||||||
|
|
||||||
|
|
@ -306,6 +309,8 @@ randomization can be useful in certain cases, we give an example.
|
||||||
|
|
||||||
Min_circle mc1( P, P+n); /* very slow */
|
Min_circle mc1( P, P+n); /* very slow */
|
||||||
Min_circle mc2( P, P+n, true); /* fast */
|
Min_circle mc2( P, P+n, true); /* fast */
|
||||||
|
|
||||||
|
delete[] P;
|
||||||
\end{cprog}
|
\end{cprog}
|
||||||
|
|
||||||
\end{ccClassTemplate}
|
\end{ccClassTemplate}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
\ccPostcond \ccc{\ccVar.is_empty()} = \ccc{true}.}
|
\ccPostcond \ccc{\ccVar.is_empty()} = \ccc{true}.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( const CGAL_Min_circle_2<I>&);}{
|
\ccConstructor{ CGAL_Min_circle_2( CGAL_Min_circle_2<I> const&);}{
|
||||||
copy constructor.}
|
copy constructor.}
|
||||||
|
|
||||||
\ccConstructor{ CGAL_Min_circle_2( Point const& p, I const& i = I());}{
|
\ccConstructor{ CGAL_Min_circle_2( Point const& p, I const& i = I());}{
|
||||||
|
|
@ -118,8 +118,8 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
CGAL_Min_circle_2( InputIterator first,
|
CGAL_Min_circle_2( InputIterator first,
|
||||||
InputIterator last,
|
InputIterator last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
introduces a variable \ccVar\ of type \ccClassTemplateName. It
|
introduces a variable \ccVar\ of type \ccClassTemplateName. It
|
||||||
is initialized to $mc(P)$ with $P$ being the set of points in
|
is initialized to $mc(P)$ with $P$ being the set of points in
|
||||||
the range [\ccc{first},\ccc{last}). If \ccc{randomize} is
|
the range [\ccc{first},\ccc{last}). If \ccc{randomize} is
|
||||||
|
|
@ -132,30 +132,34 @@ reconstructing $mc(P)$ from a given support set $S$ of $P$.
|
||||||
\ccPrecond The value type of \ccc{first} and \ccc{last} is
|
\ccPrecond The value type of \ccc{first} and \ccc{last} is
|
||||||
\ccc{Point}.}
|
\ccc{Point}.}
|
||||||
|
|
||||||
\emph{Note:} Since most compilers do not support member templates yet,
|
{\em Note:} Since most compilers do not support member templates yet,
|
||||||
we provide specialized constructors instead. In the current release
|
we provide specialized constructors instead. In the current release
|
||||||
there are constructors for C arrays (using pointers as iterators) and
|
there are constructors for C arrays (using pointers as iterators) and
|
||||||
for STL sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
for the STL sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( const Point* first,
|
\ccConstructor{ CGAL_Min_circle_2( const Point* first,
|
||||||
const Point* last,
|
const Point* last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
STL-like constructor for random access iterators.}
|
STL-like constructor for random access iterators.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccConstructor{ CGAL_Min_circle_2( list<Point>::const_iterator first,
|
\ccConstructor{ CGAL_Min_circle_2( list<Point>::const_iterator first,
|
||||||
list<Point>::const_iterator last,
|
list<Point>::const_iterator last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I() );}{
|
I const& i = I() );}{
|
||||||
STL-like constructor for sequence container list<Point>.}
|
STL-like constructor for sequence container list<Point>.}
|
||||||
|
|
||||||
|
\ccHidden
|
||||||
|
\ccConstructor{ ~CGAL_Min_circle_2( );}{
|
||||||
|
destructor.}
|
||||||
|
|
||||||
\ccHidden
|
\ccHidden
|
||||||
\ccMemberFunction{ CGAL_Min_circle_2<I>&
|
\ccMemberFunction{ CGAL_Min_circle_2<I>&
|
||||||
operator = ( const CGAL_Min_circle_2<I>&);}{
|
operator = ( CGAL_Min_circle_2<I> const&);}{
|
||||||
assignment operator.}
|
assignment operator.}
|
||||||
|
|
||||||
% -----------------------------------------------------------------------------
|
% -----------------------------------------------------------------------------
|
||||||
|
|
@ -200,26 +204,25 @@ bounded side, i.e.\ its unbounded side equals the whole plane $\E_2$.
|
||||||
bounded_side( Point const& p) const;}{
|
bounded_side( Point const& p) const;}{
|
||||||
returns \ccc{CGAL_ON_BOUNDED_SIDE},\ccTexHtml{$\:$}{ }%
|
returns \ccc{CGAL_ON_BOUNDED_SIDE},\ccTexHtml{$\:$}{ }%
|
||||||
\ccc{CGAL_ON_BOUNDARY}, or \ccc{CGAL_ON_UNBOUNDED_SIDE}
|
\ccc{CGAL_ON_BOUNDARY}, or \ccc{CGAL_ON_UNBOUNDED_SIDE}
|
||||||
iff \ccc{p} lies inside, on the boundary, or outside of
|
iff \ccc{p} lies properly inside, on the boundary, or properly
|
||||||
\ccVar, resp.}
|
outside of \ccVar, resp.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool has_on_bounded_side( Point const& p) const;}{
|
\ccMemberFunction{ bool has_on_bounded_side( Point const& p) const;}{
|
||||||
returns \ccc{true}, iff \ccc{p} lies inside \ccVar.}
|
returns \ccc{true}, iff \ccc{p} lies properly inside \ccVar.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool has_on_boundary( Point const& p) const;}{
|
\ccMemberFunction{ bool has_on_boundary( Point const& p) const;}{
|
||||||
returns \ccc{true}, iff \ccc{p} lies on the boundary
|
returns \ccc{true}, iff \ccc{p} lies on the boundary
|
||||||
of \ccVar.}
|
of \ccVar.}
|
||||||
|
|
||||||
\ccMemberFunction{ bool
|
\ccMemberFunction{ bool has_on_unbounded_side( Point const& p) const;}{
|
||||||
has_on_unbounded_side( Point const& p) const;}{
|
returns \ccc{true}, iff \ccc{p} lies properly outside of \ccVar.}
|
||||||
returns \ccc{true}, iff \ccc{p} lies outside of \ccVar.}
|
|
||||||
|
|
||||||
\ccMemberFunction{ bool is_empty( ) const;}{
|
\ccMemberFunction{ bool is_empty( ) const;}{
|
||||||
returns \ccc{true}, iff \ccVar\ is empty (this implies
|
returns \ccc{true}, iff \ccVar\ is empty (this implies
|
||||||
degeneracy).}
|
degeneracy).}
|
||||||
|
|
||||||
\ccMemberFunction{ bool is_degenerate( ) const;}{
|
\ccMemberFunction{ bool is_degenerate( ) const;}{
|
||||||
returns \ccc{true}, iff \ccVar\ is degenerate, i.e. if
|
returns \ccc{true}, iff \ccVar\ is degenerate, i.e.\ if
|
||||||
\ccVar\ is empty or equal to a single point, equivalently if
|
\ccVar\ is empty or equal to a single point, equivalently if
|
||||||
the number of support points is less than 2.}
|
the number of support points is less than 2.}
|
||||||
|
|
||||||
|
|
@ -245,7 +248,7 @@ An object \ccVar\ is valid, iff
|
||||||
\item[c)] $S$ is minimal, i.e.\ no support point is redundant.
|
\item[c)] $S$ is minimal, i.e.\ no support point is redundant.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
Using the ready-made implementation for the interface class with exact
|
Using the ready-made implementation for the interface class with exact
|
||||||
arithmetic as described in Section~\ref{sec:opt_I_Impl} garantees
|
arithmetic as described in Section~\ref{sec:opt_I_Impl} guarantees
|
||||||
validity of \ccVar. The following function is mainly intended for
|
validity of \ccVar. The following function is mainly intended for
|
||||||
debugging user supplied interface classes.
|
debugging user supplied interface classes.
|
||||||
|
|
||||||
|
|
@ -306,6 +309,8 @@ randomization can be useful in certain cases, we give an example.
|
||||||
|
|
||||||
Min_circle mc1( P, P+n); /* very slow */
|
Min_circle mc1( P, P+n); /* very slow */
|
||||||
Min_circle mc2( P, P+n, true); /* fast */
|
Min_circle mc2( P, P+n, true); /* fast */
|
||||||
|
|
||||||
|
delete[] P;
|
||||||
\end{cprog}
|
\end{cprog}
|
||||||
|
|
||||||
\end{ccClassTemplate}
|
\end{ccClassTemplate}
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,9 @@ small probability.
|
||||||
\clearpage
|
\clearpage
|
||||||
\section{Specification}
|
\section{Specification}
|
||||||
|
|
||||||
|
{\em Note:} Below some references are undefined, they refer to sections
|
||||||
|
in the \cgal\ Reference Manual.
|
||||||
|
|
||||||
\renewcommand{\ccSection}{\ccSubsection}
|
\renewcommand{\ccSection}{\ccSubsection}
|
||||||
\renewcommand{\ccFont}{\tt}
|
\renewcommand{\ccFont}{\tt}
|
||||||
\renewcommand{\ccEndFont}{}
|
\renewcommand{\ccEndFont}{}
|
||||||
|
|
@ -180,8 +183,8 @@ The class interface looks as follows.
|
||||||
@<Min_circle_2 private data members>
|
@<Min_circle_2 private data members>
|
||||||
|
|
||||||
// copying and assignment not allowed!
|
// copying and assignment not allowed!
|
||||||
CGAL_Min_circle_2( const CGAL_Min_circle_2<_I>&);
|
CGAL_Min_circle_2( CGAL_Min_circle_2<_I> const&);
|
||||||
CGAL_Min_circle_2<_I>& operator = ( const CGAL_Min_circle_2<_I>&);
|
CGAL_Min_circle_2<_I>& operator = ( CGAL_Min_circle_2<_I> const&);
|
||||||
|
|
||||||
// private member functions
|
// private member functions
|
||||||
@<Min_circle_2 private member functions declaration>
|
@<Min_circle_2 private member functions declaration>
|
||||||
|
|
@ -207,8 +210,8 @@ section, so we do not comment on it here.
|
||||||
@macro <Min_circle_2 public interface> = @begin
|
@macro <Min_circle_2 public interface> = @begin
|
||||||
// types
|
// types
|
||||||
typedef _I I;
|
typedef _I I;
|
||||||
typedef typename I::Point Point;
|
typedef typename _I::Point Point;
|
||||||
typedef typename I::Circle Circle;
|
typedef typename _I::Circle Circle;
|
||||||
typedef typename list<Point>::const_iterator Point_iterator;
|
typedef typename list<Point>::const_iterator Point_iterator;
|
||||||
typedef const Point * Support_point_iterator;
|
typedef const Point * Support_point_iterator;
|
||||||
|
|
||||||
|
|
@ -226,13 +229,14 @@ section, so we do not comment on it here.
|
||||||
CGAL_Min_circle_2( const Point* first,
|
CGAL_Min_circle_2( const Point* first,
|
||||||
const Point* last,
|
const Point* last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I());
|
I const& i = I());
|
||||||
CGAL_Min_circle_2( list<Point>::const_iterator first,
|
CGAL_Min_circle_2( list<Point>::const_iterator first,
|
||||||
list<Point>::const_iterator last,
|
list<Point>::const_iterator last,
|
||||||
bool randomize = false,
|
bool randomize = false,
|
||||||
CGAL_Random& random = CGAL_Random(),
|
CGAL_Random& random = CGAL_random,
|
||||||
I const& i = I());
|
I const& i = I());
|
||||||
|
~CGAL_Min_circle_2( );
|
||||||
|
|
||||||
// access functions
|
// access functions
|
||||||
int number_of_points ( ) const;
|
int number_of_points ( ) const;
|
||||||
|
|
@ -278,7 +282,7 @@ bring points to the front of the list in constant time. We use the
|
||||||
sequence container \ccc{list} from STL~\cite{sl-stl-95}.
|
sequence container \ccc{list} from STL~\cite{sl-stl-95}.
|
||||||
|
|
||||||
@macro <Min_circle_2 private data members> += @begin
|
@macro <Min_circle_2 private data members> += @begin
|
||||||
list<Point> points; // double linked list of points
|
list<Point> points; // doubly linked list of points
|
||||||
@end
|
@end
|
||||||
|
|
||||||
The support set $S$ of at most three support points is stored in an
|
The support set $S$ of at most three support points is stored in an
|
||||||
|
|
@ -287,9 +291,13 @@ given by \ccc{n_support_points}. During the computations, the set of
|
||||||
support points coincides with the set $B$ appearing in the pseudocode
|
support points coincides with the set $B$ appearing in the pseudocode
|
||||||
for $\mc(P,B)$, see Section~\ref{sec:algo}.
|
for $\mc(P,B)$, see Section~\ref{sec:algo}.
|
||||||
|
|
||||||
|
{\em Note:} The array of support points is allocated dynamically,
|
||||||
|
because the SGI compiler (mipspro CC 7.1) does not accept a static
|
||||||
|
array here.
|
||||||
|
|
||||||
@macro <Min_circle_2 private data members> += @begin
|
@macro <Min_circle_2 private data members> += @begin
|
||||||
int n_support_points; // number of support points
|
int n_support_points; // number of support points
|
||||||
Point support_points[ 3]; // array of support points
|
Point* support_points; // array of support points
|
||||||
@end
|
@end
|
||||||
|
|
||||||
Finally, an actual circle is stored in \ccc{min_circle}, by the end
|
Finally, an actual circle is stored in \ccc{min_circle}, by the end
|
||||||
|
|
@ -302,7 +310,7 @@ see Section~\ref{sec:algo}.
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@! ----------------------------------------------------------------------------
|
@! ----------------------------------------------------------------------------
|
||||||
\subsection{Constructors}
|
\subsection{Constructors and Destructor}
|
||||||
|
|
||||||
We provide several different constructors, which can be put into two
|
We provide several different constructors, which can be put into two
|
||||||
groups. The constructors in the first group, i.e. the more important
|
groups. The constructors in the first group, i.e. the more important
|
||||||
|
|
@ -312,9 +320,9 @@ this would be done by a single member template, but since most
|
||||||
compilers do not support member templates yet, we provide specialized
|
compilers do not support member templates yet, we provide specialized
|
||||||
constructors for C~arrays (using pointers as iterators) and for STL
|
constructors for C~arrays (using pointers as iterators) and for STL
|
||||||
sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
sequence containers \ccc{vector<Point>} and \ccc{list<Point>}.
|
||||||
Actually, the constructors for a C~array and a \ccc{vector<point>},
|
Actually, the constructors for a C~array and a \ccc{vector<point>} are
|
||||||
resp., are the same, since the random access iterator of
|
the same, since the random access iterator of \ccc{vector<Point>} is
|
||||||
\ccc{vector<Point>} is implemented as \ccc{Point*}.
|
implemented as \ccc{Point*}.
|
||||||
|
|
||||||
Both constructors of the first group copy the points into the
|
Both constructors of the first group copy the points into the
|
||||||
internal list \ccc{points}. If randomization is demanded, the points
|
internal list \ccc{points}. If randomization is demanded, the points
|
||||||
|
|
@ -329,13 +337,16 @@ compute $mc(P)=mc(P,\emptyset)$.
|
||||||
// STL-like constructor for C array and vector<Point>
|
// STL-like constructor for C array and vector<Point>
|
||||||
template < class I >
|
template < class I >
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
CGAL_Min_circle_2( const Point* first,
|
CGAL_Min_circle_2( const CGAL_Min_circle_2<I>::Point* first,
|
||||||
const Point* last,
|
const CGAL_Min_circle_2<I>::Point* last,
|
||||||
bool randomize,
|
bool randomize,
|
||||||
CGAL_Random& random,
|
CGAL_Random& random,
|
||||||
I const& i)
|
I const& i)
|
||||||
: ico( i)
|
: ico( i)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
// compute number of points
|
// compute number of points
|
||||||
if ( ( last-first) > 0) {
|
if ( ( last-first) > 0) {
|
||||||
|
|
||||||
|
|
@ -356,13 +367,16 @@ compute $mc(P)=mc(P,\emptyset)$.
|
||||||
// STL-like constructor for list<Point>
|
// STL-like constructor for list<Point>
|
||||||
template < class I >
|
template < class I >
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
CGAL_Min_circle_2( list<Point>::const_iterator first,
|
CGAL_Min_circle_2( list<CGAL_Min_circle_2<I>::Point>::const_iterator first,
|
||||||
list<Point>::const_iterator last,
|
list<CGAL_Min_circle_2<I>::Point>::const_iterator last,
|
||||||
bool randomize,
|
bool randomize,
|
||||||
CGAL_Random& random,
|
CGAL_Random& random,
|
||||||
I const& i)
|
I const& i)
|
||||||
: ico( i)
|
: ico( i)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
// compute number of points
|
// compute number of points
|
||||||
list<Point>::size_type n = 0;
|
list<Point>::size_type n = 0;
|
||||||
distance( first, last, n);
|
distance( first, last, n);
|
||||||
|
|
@ -404,15 +418,21 @@ building $mc(\emptyset)$.
|
||||||
CGAL_Min_circle_2( I const& i)
|
CGAL_Min_circle_2( I const& i)
|
||||||
: ico( i), n_support_points( 0)
|
: ico( i), n_support_points( 0)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
CGAL_optimisation_postcondition( is_empty());
|
CGAL_optimisation_postcondition( is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor for one point
|
// constructor for one point
|
||||||
template < class I >
|
template < class I >
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
CGAL_Min_circle_2( Point const& p, I const& i)
|
CGAL_Min_circle_2( CGAL_Min_circle_2<I>::Point const& p, I const& i)
|
||||||
: ico( i), points( 1, p), n_support_points( 1), min_circle( p)
|
: ico( i), points( 1, p), n_support_points( 1), min_circle( p)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
support_points[ 0] = p;
|
support_points[ 0] = p;
|
||||||
CGAL_optimisation_postcondition( is_degenerate());
|
CGAL_optimisation_postcondition( is_degenerate());
|
||||||
}
|
}
|
||||||
|
|
@ -420,9 +440,14 @@ building $mc(\emptyset)$.
|
||||||
// constructor for two points
|
// constructor for two points
|
||||||
template < class I >
|
template < class I >
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
CGAL_Min_circle_2( Point const& p1, Point const& p2, I const& i)
|
CGAL_Min_circle_2( CGAL_Min_circle_2<I>::Point const& p1,
|
||||||
|
CGAL_Min_circle_2<I>::Point const& p2,
|
||||||
|
I const& i)
|
||||||
: ico( i)
|
: ico( i)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
// store points
|
// store points
|
||||||
points.push_back( p1);
|
points.push_back( p1);
|
||||||
points.push_back( p2);
|
points.push_back( p2);
|
||||||
|
|
@ -434,12 +459,15 @@ building $mc(\emptyset)$.
|
||||||
// constructor for three points
|
// constructor for three points
|
||||||
template < class I >
|
template < class I >
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
CGAL_Min_circle_2( Point const& p1,
|
CGAL_Min_circle_2( CGAL_Min_circle_2<I>::Point const& p1,
|
||||||
Point const& p2,
|
CGAL_Min_circle_2<I>::Point const& p2,
|
||||||
Point const& p3,
|
CGAL_Min_circle_2<I>::Point const& p3,
|
||||||
I const& i)
|
I const& i)
|
||||||
: ico( i)
|
: ico( i)
|
||||||
{
|
{
|
||||||
|
// allocate support points' array
|
||||||
|
support_points = new Point[ 3];
|
||||||
|
|
||||||
// store points
|
// store points
|
||||||
points.push_back( p1);
|
points.push_back( p1);
|
||||||
points.push_back( p2);
|
points.push_back( p2);
|
||||||
|
|
@ -450,6 +478,18 @@ building $mc(\emptyset)$.
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
The destructor only frees the memory of the support points' array.
|
||||||
|
|
||||||
|
@macro <Min_circle_2 destructor> = @begin
|
||||||
|
template < class I > inline
|
||||||
|
CGAL_Min_circle_2<I>::
|
||||||
|
~CGAL_Min_circle_2( )
|
||||||
|
{
|
||||||
|
// free support points' array
|
||||||
|
delete[] support_points;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
@! ----------------------------------------------------------------------------
|
@! ----------------------------------------------------------------------------
|
||||||
\subsection{Access Functions}
|
\subsection{Access Functions}
|
||||||
|
|
||||||
|
|
@ -484,7 +524,7 @@ Then, we have the access functions for points and support points.
|
||||||
@macro <Min_circle_2 access functions> += @begin
|
@macro <Min_circle_2 access functions> += @begin
|
||||||
// access to points and support points
|
// access to points and support points
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
Point_iterator
|
CGAL_Min_circle_2<I>::Point_iterator
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
points_begin( ) const
|
points_begin( ) const
|
||||||
{
|
{
|
||||||
|
|
@ -492,7 +532,7 @@ Then, we have the access functions for points and support points.
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
Point_iterator
|
CGAL_Min_circle_2<I>::Point_iterator
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
points_end( ) const
|
points_end( ) const
|
||||||
{
|
{
|
||||||
|
|
@ -500,7 +540,7 @@ Then, we have the access functions for points and support points.
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
Support_point_iterator
|
CGAL_Min_circle_2<I>::Support_point_iterator
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
support_points_begin( ) const
|
support_points_begin( ) const
|
||||||
{
|
{
|
||||||
|
|
@ -508,7 +548,7 @@ Then, we have the access functions for points and support points.
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
Support_point_iterator
|
CGAL_Min_circle_2<I>::Support_point_iterator
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
support_points_end( ) const
|
support_points_end( ) const
|
||||||
{
|
{
|
||||||
|
|
@ -583,7 +623,7 @@ corresponding predicates of class \ccc{Circle}.
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
CGAL_Bounded_side
|
CGAL_Bounded_side
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
bounded_side( Point const& p) const
|
bounded_side( CGAL_Min_circle_2<I>::Point const& p) const
|
||||||
{
|
{
|
||||||
return( is_empty() ? CGAL_ON_UNBOUNDED_SIDE
|
return( is_empty() ? CGAL_ON_UNBOUNDED_SIDE
|
||||||
: min_circle.bounded_side( p));
|
: min_circle.bounded_side( p));
|
||||||
|
|
@ -592,7 +632,7 @@ corresponding predicates of class \ccc{Circle}.
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
bool
|
bool
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
has_on_bounded_side( Point const& p) const
|
has_on_bounded_side( CGAL_Min_circle_2<I>::Point const& p) const
|
||||||
{
|
{
|
||||||
return( ( ! is_empty()) && ( min_circle.has_on_bounded_side( p)));
|
return( ( ! is_empty()) && ( min_circle.has_on_bounded_side( p)));
|
||||||
}
|
}
|
||||||
|
|
@ -601,7 +641,7 @@ corresponding predicates of class \ccc{Circle}.
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
bool
|
bool
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
has_on_boundary( Point const& p) const
|
has_on_boundary( CGAL_Min_circle_2<I>::Point const& p) const
|
||||||
{
|
{
|
||||||
return( ( ! is_empty()) && ( min_circle.has_on_boundary( p)));
|
return( ( ! is_empty()) && ( min_circle.has_on_boundary( p)));
|
||||||
}
|
}
|
||||||
|
|
@ -609,7 +649,7 @@ corresponding predicates of class \ccc{Circle}.
|
||||||
template < class I > inline
|
template < class I > inline
|
||||||
bool
|
bool
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
has_on_unbounded_side( Point const& p) const
|
has_on_unbounded_side( CGAL_Min_circle_2<I>::Point const& p) const
|
||||||
{
|
{
|
||||||
return( ( is_empty()) || ( min_circle.has_on_unbounded_side( p)));
|
return( ( is_empty()) || ( min_circle.has_on_unbounded_side( p)));
|
||||||
}
|
}
|
||||||
|
|
@ -635,7 +675,7 @@ in Section~\ref{sec:algo}.
|
||||||
template < class I >
|
template < class I >
|
||||||
void
|
void
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
insert( Point const& p)
|
insert( CGAL_Min_circle_2<I>::Point const& p)
|
||||||
{
|
{
|
||||||
// p not in current circle?
|
// p not in current circle?
|
||||||
if ( has_on_unbounded_side( p)) {
|
if ( has_on_unbounded_side( p)) {
|
||||||
|
|
@ -715,7 +755,6 @@ respect to the number of support points, which may range from 0 to 3.
|
||||||
|
|
||||||
@macro <Min_circle_2 support set checks> = @begin
|
@macro <Min_circle_2 support set checks> = @begin
|
||||||
verr << " b)+c) support set checks..." << flush;
|
verr << " b)+c) support set checks..." << flush;
|
||||||
bool failed = false;
|
|
||||||
switch( number_of_support_points()) {
|
switch( number_of_support_points()) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -790,7 +829,7 @@ diameter of the circle.
|
||||||
|
|
||||||
If the number of support points is three (and they are distinct and
|
If the number of support points is three (and they are distinct and
|
||||||
not collinear), the circle through them is unique, and must therefore
|
not collinear), the circle through them is unique, and must therefore
|
||||||
equal \ccc{min_circle}. It is the smallest one defined by the three
|
equal \ccc{min_circle}. It is the smallest one containing the three
|
||||||
points if and only if the center of the circle lies inside or on the
|
points if and only if the center of the circle lies inside or on the
|
||||||
boundary of the triangle defined by the three points. The support set
|
boundary of the triangle defined by the three points. The support set
|
||||||
is minimal only if the center lies properly inside the triangle.
|
is minimal only if the center lies properly inside the triangle.
|
||||||
|
|
@ -853,7 +892,7 @@ noting that $|B| \leq 3$.
|
||||||
|
|
||||||
@macro <Min_circle_2 private member function `compute_circle'> = @begin
|
@macro <Min_circle_2 private member function `compute_circle'> = @begin
|
||||||
// compute_circle
|
// compute_circle
|
||||||
template < class I >
|
template < class I > inline
|
||||||
void
|
void
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
compute_circle( )
|
compute_circle( )
|
||||||
|
|
@ -892,7 +931,7 @@ function is directly modelled after the pseudocode above.
|
||||||
template < class I >
|
template < class I >
|
||||||
void
|
void
|
||||||
CGAL_Min_circle_2<I>::
|
CGAL_Min_circle_2<I>::
|
||||||
mc( Point_iterator const& last, int n_sp)
|
mc( CGAL_Min_circle_2<I>::Point_iterator const& last, int n_sp)
|
||||||
{
|
{
|
||||||
// compute circle through support points
|
// compute circle through support points
|
||||||
n_support_points = n_sp;
|
n_support_points = n_sp;
|
||||||
|
|
@ -944,7 +983,10 @@ representation and number type \ccc{integer}.
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
|
|
||||||
|
#include <LEDA/REDEFINE_NAMES.h>
|
||||||
typedef integer NT;
|
typedef integer NT;
|
||||||
|
#include <LEDA/UNDEFINE_NAMES.h>
|
||||||
|
|
||||||
typedef CGAL_Homogeneous<NT> R;
|
typedef CGAL_Homogeneous<NT> R;
|
||||||
typedef CGAL_Optimisation_default_interface_2<R> I;
|
typedef CGAL_Optimisation_default_interface_2<R> I;
|
||||||
typedef CGAL_Min_circle_2<I> Min_circle;
|
typedef CGAL_Min_circle_2<I> Min_circle;
|
||||||
|
|
@ -1109,6 +1151,10 @@ end of each file.
|
||||||
# include <CGAL/optimisation_assertions.h>
|
# include <CGAL/optimisation_assertions.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
// ----------
|
||||||
|
@<Min_circle_2 destructor>
|
||||||
|
|
||||||
// Access functions and predicates
|
// Access functions and predicates
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
@<Min_circle_2 access functions `number_of_...'>
|
@<Min_circle_2 access functions `number_of_...'>
|
||||||
|
|
@ -1119,6 +1165,10 @@ end of each file.
|
||||||
|
|
||||||
@<Min_circle_2 predicates>
|
@<Min_circle_2 predicates>
|
||||||
|
|
||||||
|
// Privat member functions
|
||||||
|
// -----------------------
|
||||||
|
@<Min_circle_2 private member function `compute_circle'>
|
||||||
|
|
||||||
#ifdef CGAL_INCLUDE_TEMPLATE_CODE
|
#ifdef CGAL_INCLUDE_TEMPLATE_CODE
|
||||||
# include <CGAL/Min_circle_2.C>
|
# include <CGAL/Min_circle_2.C>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1145,10 +1195,8 @@ end of each file.
|
||||||
// --------------
|
// --------------
|
||||||
@<Min_circle_2 validity check>
|
@<Min_circle_2 validity check>
|
||||||
|
|
||||||
// Privat member functions
|
// Privat member functions (continued)
|
||||||
// -----------------------
|
// -----------------------------------
|
||||||
@<Min_circle_2 private member function `compute_circle'>
|
|
||||||
|
|
||||||
@<Min_circle_2 private member function `mc'>
|
@<Min_circle_2 private member function `mc'>
|
||||||
|
|
||||||
@<end of file line>
|
@<end of file line>
|
||||||
|
|
@ -1197,6 +1245,7 @@ end of each file.
|
||||||
@! Bibliography
|
@! Bibliography
|
||||||
@! ============================================================================
|
@! ============================================================================
|
||||||
|
|
||||||
|
\clearpage
|
||||||
\bibliographystyle{plain}
|
\bibliographystyle{plain}
|
||||||
\bibliography{geom,cgal}
|
\bibliography{geom,cgal}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue