mirror of https://github.com/CGAL/cgal
moved reference pages into SearchStructures_ref subdirectory
This commit is contained in:
parent
7498547ccb
commit
6bbdfcedfb
|
|
@ -1,3 +1,5 @@
|
|||
2.2.18 put reference pages in SearchStructures_ref directory
|
||||
|
||||
2.2.18 Added example and name of classes and concepts in section Kd-Trees.
|
||||
|
||||
2.2.17 Example code cleanups.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
\begin{ccRefConcept}{KdtreeDTraits}
|
||||
|
||||
The \ccStyle{Kdtree_d} class is parameterized with the
|
||||
interface class \ccStyle{Traits} which defines the abstract interface
|
||||
between the \ccStyle{Kdtree_d} class and the data (i.e., points). The following
|
||||
requirement catalog lists the primitives, i.e.,~types, member functions
|
||||
etc., that must be defined for a class that can be used to
|
||||
parameterize \kdts. Ready-made implementation are available
|
||||
by the \ccStyle{Kdtree_d} default traits classes.
|
||||
|
||||
\ccThree{static void}{}{\hspace*{7.1cm}}
|
||||
\ccTwo{}{\hspace*{7.1cm}}
|
||||
|
||||
|
||||
|
||||
\ccCreationVariable{t}
|
||||
|
||||
\ccDefinition
|
||||
A class \ccClassName\ that satisfies the requirements of an
|
||||
interface class for a \ccStyle{Kdtree_d} class must provide the
|
||||
following types and operations.
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Point}{A type to hold a input item.}
|
||||
|
||||
\ccOperations
|
||||
% \ccSetTwoOfThreeColumns{4cm}{4cm}
|
||||
|
||||
\ccMethod{static Comparison_result compare(
|
||||
int k,
|
||||
const Point & p0,
|
||||
const Point & p1);} {compare the \ccStyle{k}-th coordinate
|
||||
of $p0$ and $p1$. Return \ccStyle{LARGER} if $p0_k >
|
||||
p1_k$, \ccStyle{SMALLER} if $p0_k < p1_k$, or else
|
||||
\ccStyle{EQUAL}. }
|
||||
|
||||
\ccMethod{static void copy_coord( int k, Point & dest,
|
||||
const Point & src );}{Copy the $k$-th coordinate of $src$ to
|
||||
the $k$-th coordinate of $dest$.}
|
||||
|
||||
\ccMethod{static int dimension( const Point & pnt );}
|
||||
{return the dimension of \ccStyle{pnt}}
|
||||
\end{ccRefConcept}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface<Point>}
|
||||
|
||||
{\cgal} contains a default implementation for the Kdtree\_d traits
|
||||
class, that
|
||||
may be applied to any
|
||||
standard class of point provided by \cgal.
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface<Point>} is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
There are two other default traits classes \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
and \ccStyle{Kdtree_Interface_3d<Point>} which should be used when using
|
||||
2D and 3D points from the {\cgal} kernel. This is done since the points in the
|
||||
kernel do not support changing their coordinates through direct access.
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface_2d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
should be used when using 2D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface_3d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_3d<Point>}
|
||||
should be used when using 3D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
\begin{ccRefClass}{Kdtree_d<Traits>}
|
||||
|
||||
\ccThree{KdtreexdxTraitsx}{}{\hspace*{7.6cm}}
|
||||
\ccTwo{}{\hspace*{7.6cm}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<Traits>}
|
||||
\ccDefinition An object $T$ of the class
|
||||
\ccStyle{Kdtree_d<Traits>} is the {\kdt} induced by a set of points
|
||||
in $d$-dimensions.
|
||||
|
||||
\ccInclude{ CGAL/kdtree_d.h}
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Box}{represents an axis-parallel box in
|
||||
$d$-dimensions. The box might be unbounded.}
|
||||
|
||||
\ccTypedef{typedef Traits::Point Point;}{}
|
||||
\ccTypedef{typedef list<Point> List_points;}{}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{kd_tree}
|
||||
|
||||
\ccConstructor{Kdtree_d<Traits>( int dim = 2 );}{construct an
|
||||
empty {\kdt} of dimension \ccStyle{dim}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccThree{bool}{}{\hspace*{7.6cm}}
|
||||
|
||||
\ccMethod{bool is_valid(bool verbose = false, int level = 0)
|
||||
const;} {perform internal consistency checks to verify the
|
||||
correctness of the \kdt}
|
||||
|
||||
\ccMethod{void build( list<Point> &l );}{construct the
|
||||
{\kdt} from the points stored in \ccStyle{l}.
|
||||
\ccPrecond{all the points in \ccStyle{l} are of dimension no
|
||||
smaller than the dimension of {{\ccVar} } itself.} }
|
||||
|
||||
\ccMethod{void search( back_insert_iterator<List_points>
|
||||
result, Box & query_box );}{return into \ccStyle{result} all
|
||||
the points of the {{\kdt} } that lie inside \ccStyle{query_box}}
|
||||
%\end{ccClassTemplate}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
\begin{ccRefClass}[Kdtree_d<Traits>::]{Box}
|
||||
\ccDefinition An object $B$ of the class
|
||||
\ccStyle{Box} is a $d$-dimensional box (it may
|
||||
be unbounded). A $d$-dimensional box is the set defined by the
|
||||
Cartesian set $[l_1, r_1) \times [l_2, r_2) \times \cdots \times
|
||||
[l_d,r_d)$.
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{box}
|
||||
|
||||
\ccConstructor{Box( int d );}{Construct a box corresponding to
|
||||
the whole $d$-dimensional space}
|
||||
|
||||
\ccConstructor{Box( Point left, Right right, int d );}{ Construct
|
||||
the axis parallel box in the $d$-dimensional space defined by
|
||||
the points \ccStyle{left}, \ccStyle{right}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccMethod{void set_coord_left( int k, Point & left );}{ set
|
||||
the left endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{left}}
|
||||
|
||||
\ccMethod{void set_coord_right( int k, Point & right );}{ set
|
||||
the right endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{right}}
|
||||
|
||||
\ccMethod{bool is_in( Point pnt );}{return \ccStyle{true}
|
||||
if \ccStyle{pnt} lies inside \ccVar.}
|
||||
|
||||
\ccMethod{bool is_coord_in_range( int k, Point pnt );}{ return
|
||||
\ccStyle{true} if the $k$-th coordinate of \ccStyle{pnt} lies
|
||||
inside the $k$-th dimensional interval of \ccVar.}
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | CBP Reference Manual: main.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | Automatically generated driver file for the reference manual chapter
|
||||
% | of this package. Do not edit manually, you may loose your changes.
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
\input{SearchStructures_ref/KdtreeDTraits.tex}
|
||||
\input{SearchStructures_ref/Kdtree_d.tex}
|
||||
\input{SearchStructures_ref/Kdtree_d_Box.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface_2d.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface_3d.tex}
|
||||
|
||||
%% EOF
|
||||
|
|
@ -211,216 +211,6 @@ int main()
|
|||
The partition of a set of points induced by a kd-tree of the points</center>
|
||||
\end{ccHtmlOnly}
|
||||
|
||||
\section{Reference Pages for Kd-Trees}
|
||||
\label{KDT_sec:RefPages}
|
||||
|
||||
\begin{ccRefClass}{Kdtree_d<Traits>}
|
||||
|
||||
\ccThree{KdtreexdxTraitsx}{}{\hspace*{7.6cm}}
|
||||
\ccTwo{}{\hspace*{7.6cm}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<Traits>}
|
||||
\ccDefinition An object $T$ of the class
|
||||
\ccStyle{Kdtree_d<Traits>} is the {\kdt} induced by a set of points
|
||||
in $d$-dimensions.
|
||||
|
||||
\ccInclude{ CGAL/kdtree_d.h}
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Box}{represents an axis-parallel box in
|
||||
$d$-dimensions. The box might be unbounded.}
|
||||
|
||||
\ccTypedef{typedef Traits::Point Point;}{}
|
||||
\ccTypedef{typedef list<Point> List_points;}{}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{kd_tree}
|
||||
|
||||
\ccConstructor{Kdtree_d<Traits>( int dim = 2 );}{construct an
|
||||
empty {\kdt} of dimension \ccStyle{dim}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccThree{bool}{}{\hspace*{7.6cm}}
|
||||
|
||||
\ccMethod{bool is_valid(bool verbose = false, int level = 0)
|
||||
const;} {perform internal consistency checks to verify the
|
||||
correctness of the \kdt}
|
||||
|
||||
\ccMethod{void build( list<Point> &l );}{construct the
|
||||
{\kdt} from the points stored in \ccStyle{l}.
|
||||
\ccPrecond{all the points in \ccStyle{l} are of dimension no
|
||||
smaller than the dimension of {{\ccVar} } itself.} }
|
||||
|
||||
\ccMethod{void search( back_insert_iterator<List_points>
|
||||
result, Box & query_box );}{return into \ccStyle{result} all
|
||||
the points of the {{\kdt} } that lie inside \ccStyle{query_box}}
|
||||
%\end{ccClassTemplate}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%\ccHeading{\ccStyle{Kdtree_d<Traits>::Box}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<I>::Box}
|
||||
\begin{ccRefClass}[Kdtree_d<Traits>::]{Box}
|
||||
\ccDefinition An object $B$ of the class
|
||||
\ccStyle{Box} is a $d$-dimensional box (it may
|
||||
be unbounded). A $d$-dimensional box is the set defined by the
|
||||
Cartesian set $[l_1, r_1) \times [l_2, r_2) \times \cdots \times
|
||||
[l_d,r_d)$.
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{box}
|
||||
|
||||
\ccConstructor{Box( int d );}{Construct a box corresponding to
|
||||
the whole $d$-dimensional space}
|
||||
|
||||
\ccConstructor{Box( Point left, Right right, int d );}{ Construct
|
||||
the axis parallel box in the $d$-dimensional space defined by
|
||||
the points \ccStyle{left}, \ccStyle{right}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccMethod{void set_coord_left( int k, Point & left );}{ set
|
||||
the left endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{left}}
|
||||
|
||||
\ccMethod{void set_coord_right( int k, Point & right );}{ set
|
||||
the right endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{right}}
|
||||
|
||||
\ccMethod{bool is_in( Point pnt );}{return \ccStyle{true}
|
||||
if \ccStyle{pnt} lies inside \ccVar.}
|
||||
|
||||
\ccMethod{bool is_coord_in_range( int k, Point pnt );}{ return
|
||||
\ccStyle{true} if the $k$-th coordinate of \ccStyle{pnt} lies
|
||||
inside the $k$-th dimensional interval of \ccVar.}
|
||||
%\end{ccClassTemplate}
|
||||
%\end{ccClass}
|
||||
\end{ccRefClass}
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefConcept}{Kdtree_d_traits}
|
||||
|
||||
The \ccStyle{Kdtree_d} class is parameterized with the
|
||||
interface class \ccStyle{Traits} which defines the abstract interface
|
||||
between the \ccStyle{Kdtree_d} class and the data (i.e., points). The following
|
||||
requirement catalog lists the primitives, i.e.,~types, member functions
|
||||
etc., that must be defined for a class that can be used to
|
||||
parameterize \kdts. Ready-made implementation are available
|
||||
by the \ccStyle{Kdtree_d} default traits classes.
|
||||
|
||||
\ccThree{static void}{}{\hspace*{7.1cm}}
|
||||
\ccTwo{}{\hspace*{7.1cm}}
|
||||
|
||||
|
||||
\begin{ccClass} {Traits}
|
||||
|
||||
\ccCreationVariable{t}
|
||||
|
||||
\ccDefinition
|
||||
A class \ccClassName\ that satisfies the requirements of an
|
||||
interface class for a \ccStyle{Kdtree_d} class must provide the
|
||||
following types and operations.
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Point}{A type to hold a input item.}
|
||||
|
||||
\ccOperations
|
||||
% \ccSetTwoOfThreeColumns{4cm}{4cm}
|
||||
|
||||
\ccMethod{static Comparison_result compare(
|
||||
int k,
|
||||
const Point & p0,
|
||||
const Point & p1);} {compare the \ccStyle{k}-th coordinate
|
||||
of $p0$ and $p1$. Return \ccStyle{LARGER} if $p0_k >
|
||||
p1_k$, \ccStyle{SMALLER} if $p0_k < p1_k$, or else
|
||||
\ccStyle{EQUAL}. }
|
||||
|
||||
\ccMethod{static void copy_coord( int k, Point & dest,
|
||||
const Point & src );}{Copy the $k$-th coordinate of $src$ to
|
||||
the $k$-th coordinate of $dest$.}
|
||||
|
||||
\ccMethod{static int dimension( const Point & pnt );}
|
||||
{return the dimension of \ccStyle{pnt}}
|
||||
\end{ccClass}
|
||||
\end{ccRefConcept}
|
||||
|
||||
\begin{ccRefClass}{Kdtree_Interface<Point>}
|
||||
|
||||
{\cgal} contains a default implementation for the Kdtree\_d traits
|
||||
class, that
|
||||
may be applied to any
|
||||
standard class of point provided by \cgal.
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface<Point>} is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
There are two other default traits classes \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
and \ccStyle{Kdtree_Interface_3d<Point>} which should be used when using
|
||||
2D and 3D points from the {\cgal} kernel. This is done since the points in the
|
||||
kernel do not support changing their coordinates through direct access.
|
||||
|
||||
\end{ccRefClass}
|
||||
%********************************************************
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefClass}{Kdtree_Interface_2d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
should be used when using 2D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefClass}{Kdtree_Interface_3d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_3d<Point>}
|
||||
should be used when using 3D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%*********************************************************
|
||||
|
||||
%-------------------------------------------------------------------------
|
||||
% Bibiliography
|
||||
%-------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@
|
|||
\renewcommand{\ccRefPageBegin}{\ccParDims\cgalColumnLayout}
|
||||
\ccDefGlobalScope{CGAL::}
|
||||
|
||||
\include{kd-tree}
|
||||
\input{kd-tree}
|
||||
\input{SearchStructures_ref/kd_main}
|
||||
|
||||
\bibliographystyle{alpha}
|
||||
\bibliography{geom,cgal}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
\begin{ccRefConcept}{KdtreeDTraits}
|
||||
|
||||
The \ccStyle{Kdtree_d} class is parameterized with the
|
||||
interface class \ccStyle{Traits} which defines the abstract interface
|
||||
between the \ccStyle{Kdtree_d} class and the data (i.e., points). The following
|
||||
requirement catalog lists the primitives, i.e.,~types, member functions
|
||||
etc., that must be defined for a class that can be used to
|
||||
parameterize \kdts. Ready-made implementation are available
|
||||
by the \ccStyle{Kdtree_d} default traits classes.
|
||||
|
||||
\ccThree{static void}{}{\hspace*{7.1cm}}
|
||||
\ccTwo{}{\hspace*{7.1cm}}
|
||||
|
||||
|
||||
|
||||
\ccCreationVariable{t}
|
||||
|
||||
\ccDefinition
|
||||
A class \ccClassName\ that satisfies the requirements of an
|
||||
interface class for a \ccStyle{Kdtree_d} class must provide the
|
||||
following types and operations.
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Point}{A type to hold a input item.}
|
||||
|
||||
\ccOperations
|
||||
% \ccSetTwoOfThreeColumns{4cm}{4cm}
|
||||
|
||||
\ccMethod{static Comparison_result compare(
|
||||
int k,
|
||||
const Point & p0,
|
||||
const Point & p1);} {compare the \ccStyle{k}-th coordinate
|
||||
of $p0$ and $p1$. Return \ccStyle{LARGER} if $p0_k >
|
||||
p1_k$, \ccStyle{SMALLER} if $p0_k < p1_k$, or else
|
||||
\ccStyle{EQUAL}. }
|
||||
|
||||
\ccMethod{static void copy_coord( int k, Point & dest,
|
||||
const Point & src );}{Copy the $k$-th coordinate of $src$ to
|
||||
the $k$-th coordinate of $dest$.}
|
||||
|
||||
\ccMethod{static int dimension( const Point & pnt );}
|
||||
{return the dimension of \ccStyle{pnt}}
|
||||
\end{ccRefConcept}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface<Point>}
|
||||
|
||||
{\cgal} contains a default implementation for the Kdtree\_d traits
|
||||
class, that
|
||||
may be applied to any
|
||||
standard class of point provided by \cgal.
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface<Point>} is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
There are two other default traits classes \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
and \ccStyle{Kdtree_Interface_3d<Point>} which should be used when using
|
||||
2D and 3D points from the {\cgal} kernel. This is done since the points in the
|
||||
kernel do not support changing their coordinates through direct access.
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface_2d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
should be used when using 2D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
\begin{ccRefClass}{Kdtree_Interface_3d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_3d<Point>}
|
||||
should be used when using 3D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
\begin{ccRefClass}{Kdtree_d<Traits>}
|
||||
|
||||
\ccThree{KdtreexdxTraitsx}{}{\hspace*{7.6cm}}
|
||||
\ccTwo{}{\hspace*{7.6cm}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<Traits>}
|
||||
\ccDefinition An object $T$ of the class
|
||||
\ccStyle{Kdtree_d<Traits>} is the {\kdt} induced by a set of points
|
||||
in $d$-dimensions.
|
||||
|
||||
\ccInclude{ CGAL/kdtree_d.h}
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Box}{represents an axis-parallel box in
|
||||
$d$-dimensions. The box might be unbounded.}
|
||||
|
||||
\ccTypedef{typedef Traits::Point Point;}{}
|
||||
\ccTypedef{typedef list<Point> List_points;}{}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{kd_tree}
|
||||
|
||||
\ccConstructor{Kdtree_d<Traits>( int dim = 2 );}{construct an
|
||||
empty {\kdt} of dimension \ccStyle{dim}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccThree{bool}{}{\hspace*{7.6cm}}
|
||||
|
||||
\ccMethod{bool is_valid(bool verbose = false, int level = 0)
|
||||
const;} {perform internal consistency checks to verify the
|
||||
correctness of the \kdt}
|
||||
|
||||
\ccMethod{void build( list<Point> &l );}{construct the
|
||||
{\kdt} from the points stored in \ccStyle{l}.
|
||||
\ccPrecond{all the points in \ccStyle{l} are of dimension no
|
||||
smaller than the dimension of {{\ccVar} } itself.} }
|
||||
|
||||
\ccMethod{void search( back_insert_iterator<List_points>
|
||||
result, Box & query_box );}{return into \ccStyle{result} all
|
||||
the points of the {{\kdt} } that lie inside \ccStyle{query_box}}
|
||||
%\end{ccClassTemplate}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
\begin{ccRefClass}[Kdtree_d<Traits>::]{Box}
|
||||
\ccDefinition An object $B$ of the class
|
||||
\ccStyle{Box} is a $d$-dimensional box (it may
|
||||
be unbounded). A $d$-dimensional box is the set defined by the
|
||||
Cartesian set $[l_1, r_1) \times [l_2, r_2) \times \cdots \times
|
||||
[l_d,r_d)$.
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{box}
|
||||
|
||||
\ccConstructor{Box( int d );}{Construct a box corresponding to
|
||||
the whole $d$-dimensional space}
|
||||
|
||||
\ccConstructor{Box( Point left, Right right, int d );}{ Construct
|
||||
the axis parallel box in the $d$-dimensional space defined by
|
||||
the points \ccStyle{left}, \ccStyle{right}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccMethod{void set_coord_left( int k, Point & left );}{ set
|
||||
the left endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{left}}
|
||||
|
||||
\ccMethod{void set_coord_right( int k, Point & right );}{ set
|
||||
the right endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{right}}
|
||||
|
||||
\ccMethod{bool is_in( Point pnt );}{return \ccStyle{true}
|
||||
if \ccStyle{pnt} lies inside \ccVar.}
|
||||
|
||||
\ccMethod{bool is_coord_in_range( int k, Point pnt );}{ return
|
||||
\ccStyle{true} if the $k$-th coordinate of \ccStyle{pnt} lies
|
||||
inside the $k$-th dimensional interval of \ccVar.}
|
||||
\end{ccRefClass}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | CBP Reference Manual: main.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | Automatically generated driver file for the reference manual chapter
|
||||
% | of this package. Do not edit manually, you may loose your changes.
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
\input{SearchStructures_ref/KdtreeDTraits.tex}
|
||||
\input{SearchStructures_ref/Kdtree_d.tex}
|
||||
\input{SearchStructures_ref/Kdtree_d_Box.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface_2d.tex}
|
||||
\input{SearchStructures_ref/Kdtree_Interface_3d.tex}
|
||||
|
||||
%% EOF
|
||||
|
|
@ -211,216 +211,6 @@ int main()
|
|||
The partition of a set of points induced by a kd-tree of the points</center>
|
||||
\end{ccHtmlOnly}
|
||||
|
||||
\section{Reference Pages for Kd-Trees}
|
||||
\label{KDT_sec:RefPages}
|
||||
|
||||
\begin{ccRefClass}{Kdtree_d<Traits>}
|
||||
|
||||
\ccThree{KdtreexdxTraitsx}{}{\hspace*{7.6cm}}
|
||||
\ccTwo{}{\hspace*{7.6cm}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<Traits>}
|
||||
\ccDefinition An object $T$ of the class
|
||||
\ccStyle{Kdtree_d<Traits>} is the {\kdt} induced by a set of points
|
||||
in $d$-dimensions.
|
||||
|
||||
\ccInclude{ CGAL/kdtree_d.h}
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Box}{represents an axis-parallel box in
|
||||
$d$-dimensions. The box might be unbounded.}
|
||||
|
||||
\ccTypedef{typedef Traits::Point Point;}{}
|
||||
\ccTypedef{typedef list<Point> List_points;}{}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{kd_tree}
|
||||
|
||||
\ccConstructor{Kdtree_d<Traits>( int dim = 2 );}{construct an
|
||||
empty {\kdt} of dimension \ccStyle{dim}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccThree{bool}{}{\hspace*{7.6cm}}
|
||||
|
||||
\ccMethod{bool is_valid(bool verbose = false, int level = 0)
|
||||
const;} {perform internal consistency checks to verify the
|
||||
correctness of the \kdt}
|
||||
|
||||
\ccMethod{void build( list<Point> &l );}{construct the
|
||||
{\kdt} from the points stored in \ccStyle{l}.
|
||||
\ccPrecond{all the points in \ccStyle{l} are of dimension no
|
||||
smaller than the dimension of {{\ccVar} } itself.} }
|
||||
|
||||
\ccMethod{void search( back_insert_iterator<List_points>
|
||||
result, Box & query_box );}{return into \ccStyle{result} all
|
||||
the points of the {{\kdt} } that lie inside \ccStyle{query_box}}
|
||||
%\end{ccClassTemplate}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%\ccHeading{\ccStyle{Kdtree_d<Traits>::Box}}
|
||||
|
||||
%\begin{ccClassTemplate}{Kdtree_d<I>::Box}
|
||||
\begin{ccRefClass}[Kdtree_d<Traits>::]{Box}
|
||||
\ccDefinition An object $B$ of the class
|
||||
\ccStyle{Box} is a $d$-dimensional box (it may
|
||||
be unbounded). A $d$-dimensional box is the set defined by the
|
||||
Cartesian set $[l_1, r_1) \times [l_2, r_2) \times \cdots \times
|
||||
[l_d,r_d)$.
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{box}
|
||||
|
||||
\ccConstructor{Box( int d );}{Construct a box corresponding to
|
||||
the whole $d$-dimensional space}
|
||||
|
||||
\ccConstructor{Box( Point left, Right right, int d );}{ Construct
|
||||
the axis parallel box in the $d$-dimensional space defined by
|
||||
the points \ccStyle{left}, \ccStyle{right}.}
|
||||
|
||||
\ccOperations
|
||||
|
||||
\ccMethod{void set_coord_left( int k, Point & left );}{ set
|
||||
the left endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{left}}
|
||||
|
||||
\ccMethod{void set_coord_right( int k, Point & right );}{ set
|
||||
the right endpoint of the $k$-th dimensional interval of \ccVar\ {}
|
||||
to be the $k$-th coordinate of \ccStyle{right}}
|
||||
|
||||
\ccMethod{bool is_in( Point pnt );}{return \ccStyle{true}
|
||||
if \ccStyle{pnt} lies inside \ccVar.}
|
||||
|
||||
\ccMethod{bool is_coord_in_range( int k, Point pnt );}{ return
|
||||
\ccStyle{true} if the $k$-th coordinate of \ccStyle{pnt} lies
|
||||
inside the $k$-th dimensional interval of \ccVar.}
|
||||
%\end{ccClassTemplate}
|
||||
%\end{ccClass}
|
||||
\end{ccRefClass}
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefConcept}{Kdtree_d_traits}
|
||||
|
||||
The \ccStyle{Kdtree_d} class is parameterized with the
|
||||
interface class \ccStyle{Traits} which defines the abstract interface
|
||||
between the \ccStyle{Kdtree_d} class and the data (i.e., points). The following
|
||||
requirement catalog lists the primitives, i.e.,~types, member functions
|
||||
etc., that must be defined for a class that can be used to
|
||||
parameterize \kdts. Ready-made implementation are available
|
||||
by the \ccStyle{Kdtree_d} default traits classes.
|
||||
|
||||
\ccThree{static void}{}{\hspace*{7.1cm}}
|
||||
\ccTwo{}{\hspace*{7.1cm}}
|
||||
|
||||
|
||||
\begin{ccClass} {Traits}
|
||||
|
||||
\ccCreationVariable{t}
|
||||
|
||||
\ccDefinition
|
||||
A class \ccClassName\ that satisfies the requirements of an
|
||||
interface class for a \ccStyle{Kdtree_d} class must provide the
|
||||
following types and operations.
|
||||
|
||||
\ccTypes
|
||||
|
||||
\ccNestedType{Point}{A type to hold a input item.}
|
||||
|
||||
\ccOperations
|
||||
% \ccSetTwoOfThreeColumns{4cm}{4cm}
|
||||
|
||||
\ccMethod{static Comparison_result compare(
|
||||
int k,
|
||||
const Point & p0,
|
||||
const Point & p1);} {compare the \ccStyle{k}-th coordinate
|
||||
of $p0$ and $p1$. Return \ccStyle{LARGER} if $p0_k >
|
||||
p1_k$, \ccStyle{SMALLER} if $p0_k < p1_k$, or else
|
||||
\ccStyle{EQUAL}. }
|
||||
|
||||
\ccMethod{static void copy_coord( int k, Point & dest,
|
||||
const Point & src );}{Copy the $k$-th coordinate of $src$ to
|
||||
the $k$-th coordinate of $dest$.}
|
||||
|
||||
\ccMethod{static int dimension( const Point & pnt );}
|
||||
{return the dimension of \ccStyle{pnt}}
|
||||
\end{ccClass}
|
||||
\end{ccRefConcept}
|
||||
|
||||
\begin{ccRefClass}{Kdtree_Interface<Point>}
|
||||
|
||||
{\cgal} contains a default implementation for the Kdtree\_d traits
|
||||
class, that
|
||||
may be applied to any
|
||||
standard class of point provided by \cgal.
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface<Point>} is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
There are two other default traits classes \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
and \ccStyle{Kdtree_Interface_3d<Point>} which should be used when using
|
||||
2D and 3D points from the {\cgal} kernel. This is done since the points in the
|
||||
kernel do not support changing their coordinates through direct access.
|
||||
|
||||
\end{ccRefClass}
|
||||
%********************************************************
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefClass}{Kdtree_Interface_2d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_2d<Point>}
|
||||
should be used when using 2D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%********************************************************
|
||||
\begin{ccRefClass}{Kdtree_Interface_3d<Point>}
|
||||
|
||||
The default traits class \ccStyle{Kdtree_Interface_3d<Point>}
|
||||
should be used when using 3D points from the {\cgal} kernel.
|
||||
It is
|
||||
templated with a parameter \ccStyle{Point}, which is required to
|
||||
supply the following methods:
|
||||
|
||||
\begin{itemize}
|
||||
\item Constructor, and copy constructor.
|
||||
|
||||
\item \ccStyle{int dimension();} - return the dimension of the point.
|
||||
|
||||
\item \ccStyle{operator[](int dim);} - an operator for accessing
|
||||
the various coordinates of the given point. Used also to copy
|
||||
coordinates between points.
|
||||
\end{itemize}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
%*********************************************************
|
||||
|
||||
%-------------------------------------------------------------------------
|
||||
% Bibiliography
|
||||
%-------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@
|
|||
\renewcommand{\ccRefPageBegin}{\ccParDims\cgalColumnLayout}
|
||||
\ccDefGlobalScope{CGAL::}
|
||||
|
||||
\include{kd-tree}
|
||||
\input{kd-tree}
|
||||
\input{SearchStructures_ref/kd_main}
|
||||
|
||||
\bibliographystyle{alpha}
|
||||
\bibliography{geom,cgal}
|
||||
|
|
|
|||
Loading…
Reference in New Issue