some minor changes to prevent warnings for gcc -Wall.

This commit is contained in:
Michael Hoffmann 1998-09-25 14:44:51 +00:00
parent 8b1c8a357d
commit f6d5760c79
25 changed files with 371 additions and 88 deletions

View File

@ -1,4 +1,4 @@
demo/Matrix_search/README
demo/${PACKAGE}/README
---------------------------
Interactive demo programs of some optimisation algorithms in CGAL.

View File

@ -24,17 +24,42 @@
// Demo program: All Furthest Neighbors for a Convex Polygon
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POLYGON_2_H
#include <CGAL/Polygon_2.h>
#endif // CGAL_POLYGON_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#include <CGAL/all_furthest_neighbors_2.h>
#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
#ifndef CGAL_SQUARED_DISTANCE_2_H
#include <CGAL/squared_distance_2.h>
#endif // CGAL_SQUARED_DISTANCE_2_H
#ifndef CGAL_IO_WINDOW_STREAM_H
#include <CGAL/IO/Window_stream.h>
#endif // CGAL_IO_WINDOW_STREAM_H
#ifndef CGAL_PROTECT_LEDA_POINT_SET_H
#include <LEDA/point_set.h>
#define CGAL_PROTECT_LEDA_POINT_SET_H
#endif // CGAL_PROTECT_LEDA_POINT_SET_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
typedef double FT;
typedef CGAL_Cartesian< FT > R;

View File

@ -24,21 +24,55 @@
// Demo program: Compute extremal polygons of a convex polygon
// ============================================================================
#ifndef CGAL_PROTECT_STDLIB_H
#include <stdlib.h>
#define CGAL_PROTECT_STDLIB_H
#endif // CGAL_PROTECT_STDLIB_H
#ifndef CGAL_PROTECT_STDIO_H
#include <stdio.h>
#define CGAL_PROTECT_STDIO_H
#endif // CGAL_PROTECT_STDIO_H
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_SEGMENT_2_H
#include <CGAL/Segment_2.h>
#endif // CGAL_SEGMENT_2_H
#ifndef CGAL_SQUARED_DISTANCE_2_H
#include <CGAL/squared_distance_2.h>
#endif // CGAL_SQUARED_DISTANCE_2_H
#ifndef CGAL_CONVEX_HULL_2_H
#include <CGAL/convex_hull_2.h>
#endif // CGAL_CONVEX_HULL_2_H
#ifndef CGAL_CIRCULATOR_H
#include <CGAL/circulator.h>
#endif // CGAL_CIRCULATOR_H
#ifndef CGAL_COPY_N_H
#include <CGAL/copy_n.h>
#endif // CGAL_COPY_N_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_EXTREMAL_POLYGON_2_H
#include <CGAL/extremal_polygon_2.h>
#endif // CGAL_EXTREMAL_POLYGON_2_H
#ifndef CGAL_IO_LEDA_WINDOW_H
#include <CGAL/IO/leda_window.h>
#endif // CGAL_IO_LEDA_WINDOW_H
#ifndef CGAL_PROTECT_LEDA_POINT_SET_H
#include <LEDA/point_set.h>
#define CGAL_PROTECT_LEDA_POINT_SET_H
#endif // CGAL_PROTECT_LEDA_POINT_SET_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
typedef double FT;
typedef CGAL_Cartesian< FT > RepClass;

View File

@ -24,21 +24,56 @@
// 2-4-Centering Axis-Parallel 2D-Rectangles - demo program
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_ISO_RECTANGLE_2_H
#include <CGAL/Iso_rectangle_2.h>
#endif // CGAL_ISO_RECTANGLE_2_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_IO_LEDA_WINDOW_H
#include <CGAL/IO/leda_window.h>
#endif // CGAL_IO_LEDA_WINDOW_H
#ifndef CGAL_IO_OSTREAM_ITERATOR_H
#include <CGAL/IO/Ostream_iterator.h>
#endif // CGAL_IO_OSTREAM_ITERATOR_H
#ifndef CGAL_IO_ISTREAM_ITERATOR_H
#include <CGAL/IO/Istream_iterator.h>
#endif // CGAL_IO_ISTREAM_ITERATOR_H
#ifndef CGAL_RECTANGULAR_P_CENTER_2_H
#include <CGAL/rectangular_p_center_2.h>
#endif // CGAL_RECTANGULAR_P_CENTER_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_COPY_N_H
#include <CGAL/copy_n.h>
#endif // CGAL_COPY_N_H
#ifndef CGAL_LEDA_REAL_H
#include <CGAL/leda_real.h>
#endif // CGAL_LEDA_REAL_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
#ifndef CGAL_PROTECT_ALGO_H
#include <algo.h>
#define CGAL_PROTECT_ALGO_H
#endif // CGAL_PROTECT_ALGO_H
#ifndef CGAL_PROTECT_FUNCTION_H
#include <function.h>
#define CGAL_PROTECT_FUNCTION_H
#endif // CGAL_PROTECT_FUNCTION_H
#ifndef CGAL_PROTECT_STDLIB_H
#include <stdlib.h>
#define CGAL_PROTECT_STDLIB_H
#endif // CGAL_PROTECT_STDLIB_H
typedef double FT;
// typedef leda_real FT;
@ -59,7 +94,10 @@ typedef ostream_iterator< Square_2 > Ostream_iterator_square;
typedef CGAL_Istream_iterator< Point_2, leda_window>
Istream_iterator_point;
#ifndef CGAL_PROTECT_TIME_H
#include <time.h>
#define CGAL_PROTECT_TIME_H
#endif // CGAL_PROTECT_TIME_H
static time_t Measure;
static long long int measure;
#define MEASURE(comm) \

View File

@ -16,7 +16,7 @@ for the vertices of a convex polygon.
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{all_furthest_neighbors.html}
{Definition of function CGAL_all_furthest_neighbors}
{Definition of function \ccc{CGAL_all_furthest_neighbors}}
\ccTexHtml{}{
<H3>All Furthest Neighbors</H3>

View File

@ -22,7 +22,7 @@ two predefined traits classes to compute a maximum area (see section
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_maximum_area_inscribed_k_gon.html}
{Function Declaration of CGAL_maximum_area_inscribed_k_gon}
{Function Declaration of \ccc{CGAL_maximum_area_inscribed_k_gon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}
@ -86,7 +86,7 @@ two predefined traits classes to compute a maximum area (see section
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_maximum_perimeter_inscribed_k_gon.html}
{Function Declaration of CGAL_maximum_perimeter_inscribed_k_gon}
{Function Declaration of \ccc{CGAL_maximum_perimeter_inscribed_k_gon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}
@ -155,7 +155,7 @@ two predefined traits classes to compute a maximum area (see section
\begin{ccAdvanced}
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_general_extremal_polygons.html}
{Function Declaration of CGAL_extremal_polygon}
{Function Declaration of \ccc{CGAL_extremal_polygon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}

View File

@ -16,7 +16,7 @@
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{monotone_matrix_search.html}
{Function Declaration of CGAL_monotone_matrix_search}
{Function Declaration of \ccc{CGAL_monotone_matrix_search}}
\ccTexHtml{}{
<H3>Monotone Matrix Search</H3>

View File

@ -17,7 +17,7 @@ minimal distance between both sets is minimized.
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{rectangular_p_centers.html}
{Definition of function CGAL_rectangular_p_center_2}
{Definition of function \ccc{CGAL_rectangular_p_center_2}}
\ccTexHtml{}{
<H3>Rectangular <I>p</I>-Centers</H3>
@ -28,30 +28,30 @@ minimal distance between both sets is minimized.
More formally the problem can be defined as follows.
\ccTexHtml{Given a finite set ${\cal P}$ of points, compute a point
set ${\cal C}$ with $|{\cal C}| \le p$ such that the $p$-radius of
${\cal P}$,
\ccTexHtml{Given a finite set $\mathcal{P}$ of points, compute a
point set $\mathcal{C}$ with $|\mathcal{C}| \le p$ such that the
$p$-radius of $\mathcal{P}$,
$$
rad_p({\cal P}) := \max_{P \in {\cal P}} \min_{Q \in {\cal C}} || P
- Q ||_\infty
rad_p(\mathcal{P}) := \max_{P \in \mathcal{P}} \min_{Q \in
\mathcal{C}} || P - Q ||_\infty
$$
is minimized. We can interpret ${\cal C}$ as the best
approximation (with respect to the given metric) for ${\cal P}$
is minimized. We can interpret $\mathcal{C}$ as the best
approximation (with respect to the given metric) for $\mathcal{P}$
with at most $p$ points.}{Given a finite set <IMG WIDTH=12
HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > of points, compute a point set
<IMG WIDTH=9 HEIGHT=13 ALIGN=BOTTOM ALT="tex2html_wrap_inline19"
SRC="./MatrixSearch_pcenter2.gif" > with <IMG WIDTH=46 HEIGHT=24
ALIGN=MIDDLE ALT="tex2html_wrap_inline21"
SRC="./MatrixSearch_pcenter3.gif" > such that the <I>p</I>-radius of
SRC="./MatrixSearch_pcenter3.gif" > such that the <I>p</I>-radius
of <IMG WIDTH=12 HEIGHT=12 ALIGN=BOTTOM
ALT="tex2html_wrap_inline17" SRC="./MatrixSearch_pcenter1.gif" > ,
<P> <IMG WIDTH=358 HEIGHT=24 ALIGN=BOTTOM ALT="displaymath27"
SRC="./MatrixSearch_pcenter4.gif" > <P> is minimized. We can
interpret <IMG WIDTH=9 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline19" SRC="./MatrixSearch_pcenter2.gif" >
as the best approximation (with respect to the given metric) for
<IMG WIDTH=12 HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > , <P> <IMG WIDTH=358 HEIGHT=24
ALIGN=BOTTOM ALT="displaymath27" SRC="./MatrixSearch_pcenter4.gif" >
<P> is minimized. We can interpret <IMG WIDTH=9 HEIGHT=13
ALIGN=BOTTOM ALT="tex2html_wrap_inline19"
SRC="./MatrixSearch_pcenter2.gif" > as the best approximation (with
respect to the given metric) for <IMG WIDTH=12 HEIGHT=12
ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > with at most <I>p</I> points.}
\ccInclude{CGAL/rectangular_p_center_2.h}
@ -94,8 +94,8 @@ minimal distance between both sets is minimized.
\ccImplementation The implementation uses sorted matrix search (see
section \ref{secSortedMatrixSearch}) and fast algorithms for
piercing rectangles\cite{sw-rpppp-96} which leads to a runtime
complexity of ${\cal O}(n \cdot \log n)$ where $n$ is the number of
input points.
complexity of $\mathcal{O}(n \cdot \log n)$ where $n$ is the number
of input points.
\ccExample The following code generates a random set of ten points
and computes its two-centers.

View File

@ -15,7 +15,7 @@
entry in a set of sorted matrices that fulfills a certain criterion.
\ccHtmlNoClassToc\begin{ccHtmlClassFile}{sorted_matrix_search.html}
{Function Declaration of CGAL_sorted_matrix_search}
{Function Declaration of \ccc{CGAL_sorted_matrix_search}}
\ccTexHtml{}{
<H3>Sorted Matrix Search</H3>
@ -31,9 +31,9 @@
\forall \, 1 \le i < r,\; 1 \le j \le l\; :\; m_{i j} \le m_{(i+1) j}
\;\;.
\end{eqnarray*}
Now let ${\cal M}$ be a set of $n$ sorted matrices over $S$ and $f$ be
a monotone predicate on $S$, i.e.
Now let $\mathcal{M}$ be a set of $n$ sorted matrices over $S$
and $f$ be a monotone predicate on $S$, i.e.
$$
f\: :\: S \longrightarrow\, \textit{bool} \quad{\rm with}\quad f(r)
\;\Longrightarrow\; \forall\, t \in S\,,\: t > r \; :\; f(t)\;.
@ -47,12 +47,12 @@
matrices over <I>S</I> and <I>f</I> be a monotone predicate on
<I>S</I>, i.e. <P> <IMG WIDTH=445 HEIGHT=16 ALIGN=BOTTOM
ALT="displaymath32" SRC="./MatrixSearch_sorted4.gif" > <P><BR>}
If we assume there is any feasible element in one of the matrices in
\ccTexHtml{${\cal M}$}{<IMG WIDTH=18 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline21" SRC="./MatrixSearch_sorted3.gif" >}, there
certainly is a smallest such element. This is the one we are
searching for.
If we assume there is any feasible element in one of the matrices
in \ccTexHtml{$\mathcal{M}$}{<IMG WIDTH=18 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline21" SRC="./MatrixSearch_sorted3.gif"
>}, there certainly is a smallest such element. This is the one
we are searching for.
The feasibility test as well as some other parameters can (and have
to) be customized through a traits class. The requirements for this
@ -85,10 +85,10 @@
\ccImplementation The implementation uses an algorithm by
Frederickson and Johnson\cite{fj-fkppc-83},\cite{fj-gsrsm-84} and
runs in ${\cal O}(n \cdot k + f \cdot \log (n \cdot k))$, where $n$
is the number of input matrices, $k$ denotes the maximal dimension
of any input matrix and $f$ the time needed for one feasibility
test.
runs in $\mathcal{O}(n \cdot k + f \cdot \log (n \cdot k))$, where
$n$ is the number of input matrices, $k$ denotes the maximal
dimension of any input matrix and $f$ the time needed for one
feasibility test.
\ccExample In the following program we build a random vector $a =
(a_i)_{i = 1,\,\ldots,\,5}$ (elements drawn uniformly from $\{

View File

@ -16,7 +16,7 @@ for the vertices of a convex polygon.
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{all_furthest_neighbors.html}
{Definition of function CGAL_all_furthest_neighbors}
{Definition of function \ccc{CGAL_all_furthest_neighbors}}
\ccTexHtml{}{
<H3>All Furthest Neighbors</H3>

View File

@ -22,7 +22,7 @@ two predefined traits classes to compute a maximum area (see section
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_maximum_area_inscribed_k_gon.html}
{Function Declaration of CGAL_maximum_area_inscribed_k_gon}
{Function Declaration of \ccc{CGAL_maximum_area_inscribed_k_gon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}
@ -86,7 +86,7 @@ two predefined traits classes to compute a maximum area (see section
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_maximum_perimeter_inscribed_k_gon.html}
{Function Declaration of CGAL_maximum_perimeter_inscribed_k_gon}
{Function Declaration of \ccc{CGAL_maximum_perimeter_inscribed_k_gon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}
@ -155,7 +155,7 @@ two predefined traits classes to compute a maximum area (see section
\begin{ccAdvanced}
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{computing_general_extremal_polygons.html}
{Function Declaration of CGAL_extremal_polygon}
{Function Declaration of \ccc{CGAL_extremal_polygon}}
\ccHtmlNoClassIndex\ccHtmlNoClassLinks
%% class wrapper to keep the font at a uniform size:
\begin{ccClass}{dummy}

View File

@ -16,7 +16,7 @@
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{monotone_matrix_search.html}
{Function Declaration of CGAL_monotone_matrix_search}
{Function Declaration of \ccc{CGAL_monotone_matrix_search}}
\ccTexHtml{}{
<H3>Monotone Matrix Search</H3>

View File

@ -17,7 +17,7 @@ minimal distance between both sets is minimized.
\ccHtmlNoClassToc
\begin{ccHtmlClassFile}{rectangular_p_centers.html}
{Definition of function CGAL_rectangular_p_center_2}
{Definition of function \ccc{CGAL_rectangular_p_center_2}}
\ccTexHtml{}{
<H3>Rectangular <I>p</I>-Centers</H3>
@ -28,30 +28,30 @@ minimal distance between both sets is minimized.
More formally the problem can be defined as follows.
\ccTexHtml{Given a finite set ${\cal P}$ of points, compute a point
set ${\cal C}$ with $|{\cal C}| \le p$ such that the $p$-radius of
${\cal P}$,
\ccTexHtml{Given a finite set $\mathcal{P}$ of points, compute a
point set $\mathcal{C}$ with $|\mathcal{C}| \le p$ such that the
$p$-radius of $\mathcal{P}$,
$$
rad_p({\cal P}) := \max_{P \in {\cal P}} \min_{Q \in {\cal C}} || P
- Q ||_\infty
rad_p(\mathcal{P}) := \max_{P \in \mathcal{P}} \min_{Q \in
\mathcal{C}} || P - Q ||_\infty
$$
is minimized. We can interpret ${\cal C}$ as the best
approximation (with respect to the given metric) for ${\cal P}$
is minimized. We can interpret $\mathcal{C}$ as the best
approximation (with respect to the given metric) for $\mathcal{P}$
with at most $p$ points.}{Given a finite set <IMG WIDTH=12
HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > of points, compute a point set
<IMG WIDTH=9 HEIGHT=13 ALIGN=BOTTOM ALT="tex2html_wrap_inline19"
SRC="./MatrixSearch_pcenter2.gif" > with <IMG WIDTH=46 HEIGHT=24
ALIGN=MIDDLE ALT="tex2html_wrap_inline21"
SRC="./MatrixSearch_pcenter3.gif" > such that the <I>p</I>-radius of
SRC="./MatrixSearch_pcenter3.gif" > such that the <I>p</I>-radius
of <IMG WIDTH=12 HEIGHT=12 ALIGN=BOTTOM
ALT="tex2html_wrap_inline17" SRC="./MatrixSearch_pcenter1.gif" > ,
<P> <IMG WIDTH=358 HEIGHT=24 ALIGN=BOTTOM ALT="displaymath27"
SRC="./MatrixSearch_pcenter4.gif" > <P> is minimized. We can
interpret <IMG WIDTH=9 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline19" SRC="./MatrixSearch_pcenter2.gif" >
as the best approximation (with respect to the given metric) for
<IMG WIDTH=12 HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > , <P> <IMG WIDTH=358 HEIGHT=24
ALIGN=BOTTOM ALT="displaymath27" SRC="./MatrixSearch_pcenter4.gif" >
<P> is minimized. We can interpret <IMG WIDTH=9 HEIGHT=13
ALIGN=BOTTOM ALT="tex2html_wrap_inline19"
SRC="./MatrixSearch_pcenter2.gif" > as the best approximation (with
respect to the given metric) for <IMG WIDTH=12 HEIGHT=12
ALIGN=BOTTOM ALT="tex2html_wrap_inline17"
SRC="./MatrixSearch_pcenter1.gif" > with at most <I>p</I> points.}
\ccInclude{CGAL/rectangular_p_center_2.h}
@ -94,8 +94,8 @@ minimal distance between both sets is minimized.
\ccImplementation The implementation uses sorted matrix search (see
section \ref{secSortedMatrixSearch}) and fast algorithms for
piercing rectangles\cite{sw-rpppp-96} which leads to a runtime
complexity of ${\cal O}(n \cdot \log n)$ where $n$ is the number of
input points.
complexity of $\mathcal{O}(n \cdot \log n)$ where $n$ is the number
of input points.
\ccExample The following code generates a random set of ten points
and computes its two-centers.

View File

@ -15,7 +15,7 @@
entry in a set of sorted matrices that fulfills a certain criterion.
\ccHtmlNoClassToc\begin{ccHtmlClassFile}{sorted_matrix_search.html}
{Function Declaration of CGAL_sorted_matrix_search}
{Function Declaration of \ccc{CGAL_sorted_matrix_search}}
\ccTexHtml{}{
<H3>Sorted Matrix Search</H3>
@ -31,9 +31,9 @@
\forall \, 1 \le i < r,\; 1 \le j \le l\; :\; m_{i j} \le m_{(i+1) j}
\;\;.
\end{eqnarray*}
Now let ${\cal M}$ be a set of $n$ sorted matrices over $S$ and $f$ be
a monotone predicate on $S$, i.e.
Now let $\mathcal{M}$ be a set of $n$ sorted matrices over $S$
and $f$ be a monotone predicate on $S$, i.e.
$$
f\: :\: S \longrightarrow\, \textit{bool} \quad{\rm with}\quad f(r)
\;\Longrightarrow\; \forall\, t \in S\,,\: t > r \; :\; f(t)\;.
@ -47,12 +47,12 @@
matrices over <I>S</I> and <I>f</I> be a monotone predicate on
<I>S</I>, i.e. <P> <IMG WIDTH=445 HEIGHT=16 ALIGN=BOTTOM
ALT="displaymath32" SRC="./MatrixSearch_sorted4.gif" > <P><BR>}
If we assume there is any feasible element in one of the matrices in
\ccTexHtml{${\cal M}$}{<IMG WIDTH=18 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline21" SRC="./MatrixSearch_sorted3.gif" >}, there
certainly is a smallest such element. This is the one we are
searching for.
If we assume there is any feasible element in one of the matrices
in \ccTexHtml{$\mathcal{M}$}{<IMG WIDTH=18 HEIGHT=13 ALIGN=BOTTOM
ALT="tex2html_wrap_inline21" SRC="./MatrixSearch_sorted3.gif"
>}, there certainly is a smallest such element. This is the one
we are searching for.
The feasibility test as well as some other parameters can (and have
to) be customized through a traits class. The requirements for this
@ -85,10 +85,10 @@
\ccImplementation The implementation uses an algorithm by
Frederickson and Johnson\cite{fj-fkppc-83},\cite{fj-gsrsm-84} and
runs in ${\cal O}(n \cdot k + f \cdot \log (n \cdot k))$, where $n$
is the number of input matrices, $k$ denotes the maximal dimension
of any input matrix and $f$ the time needed for one feasibility
test.
runs in $\mathcal{O}(n \cdot k + f \cdot \log (n \cdot k))$, where
$n$ is the number of input matrices, $k$ denotes the maximal
dimension of any input matrix and $f$ the time needed for one
feasibility test.
\ccExample In the following program we build a random vector $a =
(a_i)_{i = 1,\,\ldots,\,5}$ (elements drawn uniformly from $\{

View File

@ -24,15 +24,35 @@
// Example program: All Furthest Neighbors for a Convex Polygon
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POLYGON_2_H
#include <CGAL/Polygon_2.h>
#endif // CGAL_POLYGON_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#include <CGAL/all_furthest_neighbors_2.h>
#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#ifndef CGAL_IO_OSTREAM_ITERATOR_H
#include <CGAL/IO/Ostream_iterator.h>
#endif // CGAL_IO_OSTREAM_ITERATOR_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
typedef double FT;
typedef CGAL_Cartesian< FT > R;

View File

@ -24,14 +24,32 @@
// Example program: Compute extremal polygons of a convex polygon
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POLYGON_2_H
#include <CGAL/Polygon_2.h>
#endif // CGAL_POLYGON_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_EXTREMAL_POLYGON_2_H
#include <CGAL/extremal_polygon_2.h>
#endif // CGAL_EXTREMAL_POLYGON_2_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
int main() {

View File

@ -24,14 +24,32 @@
// 2-4-Centering Axis-Parallel 2D-Rectangles - example program
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RECTANGULAR_P_CENTER_2_H
#include <CGAL/rectangular_p_center_2.h>
#endif // CGAL_RECTANGULAR_P_CENTER_2_H
#ifndef CGAL_COPY_N_H
#include <CGAL/copy_n.h>
#endif // CGAL_COPY_N_H
#ifndef CGAL_IO_OSTREAM_ITERATOR_H
#include <CGAL/IO/Ostream_iterator.h>
#endif // CGAL_IO_OSTREAM_ITERATOR_H
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
typedef double FT;
typedef CGAL_Cartesian< FT > R;

View File

@ -24,11 +24,22 @@
// Sorted matrix search: Example Program
// ============================================================================
#ifndef CGAL_RANDOM_H
#include <CGAL/Random.h>
#endif // CGAL_RANDOM_H
#ifndef CGAL_FUNCTION_OBJECTS_H
#include <CGAL/function_objects.h>
#endif // CGAL_FUNCTION_OBJECTS_H
#ifndef CGAL_CARTESIAN_MATRIX_H
#include <CGAL/Cartesian_matrix.h>
#endif // CGAL_CARTESIAN_MATRIX_H
#ifndef CGAL_SORTED_MATRIX_SEARCH_H
#include <CGAL/sorted_matrix_search.h>
#endif // CGAL_SORTED_MATRIX_SEARCH_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
int main() {

View File

@ -38,10 +38,9 @@ class CGAL_Dynamic_matrix
// and extraction of all even rows in linear time
{
public:
typedef vector< int > CoordContainer;
typedef CGAL_Dynamic_matrix< Matrix >
ThisMatrixClass;
typedef typename Matrix::Value Value;
typedef vector< int > CoordContainer;
typedef CGAL_Dynamic_matrix< Matrix > ThisMatrixClass;
typedef typename Matrix::Value Value;
CGAL_Dynamic_matrix( const Matrix& m,
int r_p = 0)
@ -50,7 +49,7 @@ public:
row_power( r_p),
row_offset( (1 << r_p) - 1)
{
for ( int i( 0); i < column_indices.size(); ++i)
for ( unsigned int i( 0); i < column_indices.size(); ++i)
column_indices[i] = i;
}

View File

@ -968,14 +968,18 @@ CGAL_three_pierce_rectangles(
OutputIterator o,
bool& ok)
{
int number_of_points( CGAL_iterator_distance( f, l));
#ifdef CGAL_CFG_NO_ITERATOR_TRAITS
typedef ptrdiff_t difference_type;
#else // CGAL_CFG_NO_ITERATOR_TRAITS //
typedef typename iterator_traits< RandomAccessIC >::difference_type
difference_type;
#endif // CGAL_CFG_NO_ITERATOR_TRAITS //
difference_type number_of_points( CGAL_iterator_distance( f, l));
CGAL_optimisation_precondition( number_of_points > 0);
// typedefs:
typedef typename Traits::Point_2
Point_2;
typedef typename Traits::Iso_rectangle_2
Iso_rectangle_2;
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Iso_rectangle_2 Iso_rectangle_2;
typedef CGAL_Has_on_unbounded_side< Iso_rectangle_2, Point_2 >
Has_on_unbounded_side;
@ -1451,9 +1455,6 @@ CGAL_four_pierce_rectangles(
// one-piercing intervall of s[LR]:
Intervall I_LR;
// one-piercing intervall of s[BT]:
Intervall I_BT;

View File

@ -24,13 +24,28 @@
// Test program: All Furthest Neighbors for a Convex Polygon
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POLYGON_2_H
#include <CGAL/Polygon_2.h>
#endif // CGAL_POLYGON_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#include <CGAL/all_furthest_neighbors_2.h>
#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
typedef double FT;
typedef CGAL_Cartesian< FT > R;
@ -44,9 +59,16 @@ typedef CGAL_Random_points_in_square_2<
CGAL_Creator_uniform_2< FT, Point_2 > >
Point_generator;
#ifndef CGAL_SQUARED_DISTANCE_2_H
#include <CGAL/squared_distance_2.h>
#endif // CGAL_SQUARED_DISTANCE_2_H
#ifndef CGAL_CIRCULATOR_H
#include <CGAL/circulator.h>
#endif // CGAL_CIRCULATOR_H
#ifndef CGAL_PROTECT_ALGO_H
#include <algo.h>
#define CGAL_PROTECT_ALGO_H
#endif // CGAL_PROTECT_ALGO_H
template < class RandomAccessIC,
class OutputIterator >

View File

@ -24,19 +24,43 @@
// Test program: Compute extremal polygons of a convex polygon
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RANDOM_CONVEX_SET_2_H
#include <CGAL/random_convex_set_2.h>
#endif // CGAL_RANDOM_CONVEX_SET_2_H
#ifndef CGAL_EXTREMAL_POLYGON_2_H
#include <CGAL/extremal_polygon_2.h>
#endif // CGAL_EXTREMAL_POLYGON_2_H
#ifndef CGAL_PROTECT_FUNCTION_H
#include <function.h>
#define CGAL_PROTECT_FUNCTION_H
#endif // CGAL_PROTECT_FUNCTION_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
#ifndef CGAL_PROTECT_DEQUE_H
#include <deque.h>
#define CGAL_PROTECT_DEQUE_H
#endif // CGAL_PROTECT_DEQUE_H
/*
#ifndef CGAL_LEDA_REAL_H
#include <CGAL/leda_real.h>
#endif // CGAL_LEDA_REAL_H
#ifndef CGAL_PROTECT_ALGO_H
#include <algo.h>
#define CGAL_PROTECT_ALGO_H
#endif // CGAL_PROTECT_ALGO_H
*/
// typedefs:

View File

@ -24,21 +24,52 @@
// 2-4-Centering Axis-Parallel 2D-Rectangles - test program
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_VECTOR_2_H
#include <CGAL/Vector_2.h>
#endif // CGAL_VECTOR_2_H
#ifndef CGAL_ISO_RECTANGLE_2_H
#include <CGAL/Iso_rectangle_2.h>
#endif // CGAL_ISO_RECTANGLE_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RECTANGULAR_P_CENTER_2_H
#include <CGAL/rectangular_p_center_2.h>
#endif // CGAL_RECTANGULAR_P_CENTER_2_H
#ifndef CGAL_COPY_N_H
#include <CGAL/copy_n.h>
#endif // CGAL_COPY_N_H
#ifndef CGAL_RANDOM_H
#include <CGAL/Random.h>
#endif // CGAL_RANDOM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
#ifndef CGAL_PROTECT_FUNCTION_H
#include <function.h>
#define CGAL_PROTECT_FUNCTION_H
#endif // CGAL_PROTECT_FUNCTION_H
#ifndef CGAL_PROTECT_ALGO_H
#include <algo.h>
#define CGAL_PROTECT_ALGO_H
#endif // CGAL_PROTECT_ALGO_H
#ifdef OUTPUT
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#endif
#ifndef CGAL_PROTECT_STDLIB_H
#include <stdlib.h>
#define CGAL_PROTECT_STDLIB_H
#endif // CGAL_PROTECT_STDLIB_H
// function class to construct a box
// around a point p with radius r

View File

@ -24,21 +24,52 @@
// 2-4-Centering Axis-Parallel 2D-Rectangles - test program
// ============================================================================
#ifndef CGAL_CARTESIAN_H
#include <CGAL/Cartesian.h>
#endif // CGAL_CARTESIAN_H
#ifndef CGAL_POINT_2_H
#include <CGAL/Point_2.h>
#endif // CGAL_POINT_2_H
#ifndef CGAL_VECTOR_2_H
#include <CGAL/Vector_2.h>
#endif // CGAL_VECTOR_2_H
#ifndef CGAL_ISO_RECTANGLE_2_H
#include <CGAL/Iso_rectangle_2.h>
#endif // CGAL_ISO_RECTANGLE_2_H
#ifndef CGAL_POINT_GENERATORS_2_H
#include <CGAL/point_generators_2.h>
#endif // CGAL_POINT_GENERATORS_2_H
#ifndef CGAL_RECTANGULAR_P_CENTER_2_H
#include <CGAL/rectangular_p_center_2.h>
#endif // CGAL_RECTANGULAR_P_CENTER_2_H
#ifndef CGAL_COPY_N_H
#include <CGAL/copy_n.h>
#endif // CGAL_COPY_N_H
#ifndef CGAL_RANDOM_H
#include <CGAL/Random.h>
#endif // CGAL_RANDOM_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
#ifndef CGAL_PROTECT_FUNCTION_H
#include <function.h>
#define CGAL_PROTECT_FUNCTION_H
#endif // CGAL_PROTECT_FUNCTION_H
#ifndef CGAL_PROTECT_ALGO_H
#include <algo.h>
#define CGAL_PROTECT_ALGO_H
#endif // CGAL_PROTECT_ALGO_H
#ifdef OUTPUT
#ifndef CGAL_PROTECT_IOSTREAM_H
#include <iostream.h>
#define CGAL_PROTECT_IOSTREAM_H
#endif // CGAL_PROTECT_IOSTREAM_H
#endif
#ifndef CGAL_PROTECT_STDLIB_H
#include <stdlib.h>
#define CGAL_PROTECT_STDLIB_H
#endif // CGAL_PROTECT_STDLIB_H
// function class to construct a box
// around a point p with radius r

View File

@ -24,11 +24,22 @@
// Sorted matrix search: Test Program
// ============================================================================
#ifndef CGAL_RANDOM_H
#include <CGAL/Random.h>
#endif // CGAL_RANDOM_H
#ifndef CGAL_FUNCTION_OBJECTS_H
#include <CGAL/function_objects.h>
#endif // CGAL_FUNCTION_OBJECTS_H
#ifndef CGAL_CARTESIAN_MATRIX_H
#include <CGAL/Cartesian_matrix.h>
#endif // CGAL_CARTESIAN_MATRIX_H
#ifndef CGAL_SORTED_MATRIX_SEARCH_H
#include <CGAL/sorted_matrix_search.h>
#endif // CGAL_SORTED_MATRIX_SEARCH_H
#ifndef CGAL_PROTECT_VECTOR_H
#include <vector.h>
#define CGAL_PROTECT_VECTOR_H
#endif // CGAL_PROTECT_VECTOR_H
template < class Matrix_iterator, class Value >
Value
compute_upper_bound( Matrix_iterator f,