fix const-correctness issue in the spatial searching package. In particular this

remove all mutable member variable and leave only one const_cast in the kd-kdtree private function
const_build. This function is called in const predicates when the tree is not already internally built.
The documentation has been update and a few typos fixed at the same time.
This commit is contained in:
Sébastien Loriot 2011-09-07 09:04:52 +00:00
parent 5896eefe09
commit 37b02012b6
37 changed files with 280 additions and 228 deletions

View File

@ -98,6 +98,20 @@ Number of lines of code of CGAL<br>
<HR> <HR>
<h2 id="release3.10">Release 3.10 </h2>
<DIV>
<p> Release date: XXX 2011</p>
<p>
CGAL 3.10 offers the following improvements and new functionality : </p>
<h3>Spatial Searching</h3>
<ul>
<li>The const-correctness of this package have been worked out. The transition for users should be smooth in
general, however adding few const in user code might be needed in some cases.
</li>
</ul>
<h2 id="release3.9">Release 3.9 </h2> <h2 id="release3.9">Release 3.9 </h2>
<DIV> <DIV>
<p> Release date: XXX 2011</p> <p> Release date: XXX 2011</p>

View File

@ -1,9 +1,8 @@
# based on a script created by cgal_create_cmake_script # Created by the script cgal_create_cmake_script
# TODO: currently, everything depends on CORE, it would be nice to break # This is the CMake script for compiling a CGAL application.
# that dependency so as to test all the number types not depending on CORE
# when it is not installed
project( Number_types_test )
project( Number_types_example )
cmake_minimum_required(VERSION 2.6.2) cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
@ -14,16 +13,20 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
endif() endif()
endif() endif()
find_package( CGAL QUIET COMPONENTS Core ) find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND ) if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} ) include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram ) include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_VersionUtils )
find_package( MPFI ) include_directories (BEFORE ../../include)
include_directories( BEFORE ../../include include )
include_directories (BEFORE include)
create_single_source_cgal_program( "bench_interval.cpp" ) create_single_source_cgal_program( "bench_interval.cpp" )
create_single_source_cgal_program( "Coercion_traits.cpp" )
create_single_source_cgal_program( "constant.cpp" ) create_single_source_cgal_program( "constant.cpp" )
create_single_source_cgal_program( "CORE_BigFloat.cpp" ) create_single_source_cgal_program( "CORE_BigFloat.cpp" )
create_single_source_cgal_program( "CORE_BigInt.cpp" ) create_single_source_cgal_program( "CORE_BigInt.cpp" )
@ -34,6 +37,8 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "doubletst.cpp" ) create_single_source_cgal_program( "doubletst.cpp" )
create_single_source_cgal_program( "float.cpp" ) create_single_source_cgal_program( "float.cpp" )
create_single_source_cgal_program( "floattst.cpp" ) create_single_source_cgal_program( "floattst.cpp" )
create_single_source_cgal_program( "Gmpfi.cpp" )
create_single_source_cgal_program( "Gmpfr_bug.cpp" )
create_single_source_cgal_program( "Gmpfr.cpp" ) create_single_source_cgal_program( "Gmpfr.cpp" )
create_single_source_cgal_program( "Gmpq.cpp" ) create_single_source_cgal_program( "Gmpq.cpp" )
create_single_source_cgal_program( "Gmpq_new.cpp" ) create_single_source_cgal_program( "Gmpq_new.cpp" )
@ -62,6 +67,7 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "NT_checker.cpp" ) create_single_source_cgal_program( "NT_checker.cpp" )
create_single_source_cgal_program( "Quotient.cpp" ) create_single_source_cgal_program( "Quotient.cpp" )
create_single_source_cgal_program( "quotient_io.cpp" ) create_single_source_cgal_program( "quotient_io.cpp" )
create_single_source_cgal_program( "Quotient_new.cpp" )
create_single_source_cgal_program( "root_of_2.cpp" ) create_single_source_cgal_program( "root_of_2.cpp" )
create_single_source_cgal_program( "Root_of_traits.cpp" ) create_single_source_cgal_program( "Root_of_traits.cpp" )
create_single_source_cgal_program( "rounding_modes.cpp" ) create_single_source_cgal_program( "rounding_modes.cpp" )
@ -71,18 +77,10 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "_test_valid_finite_float.cpp" ) create_single_source_cgal_program( "_test_valid_finite_float.cpp" )
create_single_source_cgal_program( "to_interval_test.cpp" ) create_single_source_cgal_program( "to_interval_test.cpp" )
create_single_source_cgal_program( "utilities.cpp" ) create_single_source_cgal_program( "utilities.cpp" )
if( MPFI_FOUND )
include( ${MPFI_USE_FILE} )
endif( MPFI_FOUND )
# all the programs below will be linked against MPFI in case it is present
create_single_source_cgal_program( "Gmpfi.cpp" )
create_single_source_cgal_program( "Gmpfr_bug.cpp" )
create_single_source_cgal_program( "Quotient_new.cpp" )
create_single_source_cgal_program( "Coercion_traits.cpp" )
else( CGAL_FOUND ) else()
message(STATUS message(STATUS "This program requires the CGAL library, and will not be compiled.")
"These tests require the CGAL library and will not be compiled.")
endif()
endif( CGAL_FOUND )

View File

@ -49,22 +49,22 @@ Expects for the first template argument a model of the concept
\ccOperations \ccOperations
\ccMethod{FT transformed_distance(Query_item q, Point_d p);}{Returns the squared Euclidean distance between~\ccc{q} and~\ccc{p}.} \ccMethod{FT transformed_distance(Query_item q, Point_d p) const;}{Returns the squared Euclidean distance between~\ccc{q} and~\ccc{p}.}
\ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r);} \ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r) const;}
{Returns the squared Euclidean distance between \ccc{q} and {Returns the squared Euclidean distance between \ccc{q} and
the point on the boundary of \ccc{r} closest to \ccc{q}.} the point on the boundary of \ccc{r} closest to \ccc{q}.}
\ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r;);} \ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r;) const;}
{Returns the squared Euclidean distance, where $d$ denotes the distance between \ccc{q} and {Returns the squared Euclidean distance, where $d$ denotes the distance between \ccc{q} and
the point on the boundary of \ccc{r} farthest to \ccc{q}.} the point on the boundary of \ccc{r} farthest to \ccc{q}.}
\ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension);} {Updates the squared \ccc{dist} incrementally \ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension) const;} {Updates the squared \ccc{dist} incrementally
and returns the updated squared distance.} and returns the updated squared distance.}
\ccMethod{FT transformed_distance(FT d);} {Returns $d^2$.} \ccMethod{FT transformed_distance(FT d) const;} {Returns $d^2$.}
\ccMethod{FT inverse_of_transformed_distance(FT d);} {Returns $d^{1/2}$.} \ccMethod{FT inverse_of_transformed_distance(FT d) const;} {Returns $d^{1/2}$.}
\ccSeeAlso \ccSeeAlso

View File

@ -52,19 +52,19 @@ for example \ccc{CGAL::Cartesian_d<double>}.
\ccOperations \ccOperations
\ccMethod{NT transformed_distance(Query_item s, Point_d p);}{Returns the distance between \ccc{s} and \ccc{p}.} \ccMethod{NT transformed_distance(Query_item s, Point_d p) const;}{Returns the distance between \ccc{s} and \ccc{p}.}
\ccMethod{NT min_distance_to_rectangle(Query_item s, Kd_tree_rectangle<FT> r);} \ccMethod{NT min_distance_to_rectangle(Query_item s, Kd_tree_rectangle<FT> r) const;}
{Returns the minimal distance between a point from the sphere \ccc{s} and a point from {Returns the minimal distance between a point from the sphere \ccc{s} and a point from
\ccc{r}.} \ccc{r}.}
\ccMethod{NT max_distance_to_rectangle(Query_item s, Kd_tree_rectangle<FT> r);} \ccMethod{NT max_distance_to_rectangle(Query_item s, Kd_tree_rectangle<FT> r) const;}
{Returns the maximal distance between the sphere \ccc{s} and {Returns the maximal distance between the sphere \ccc{s} and
a point from \ccc{r} furthest to \ccc{s}. } a point from \ccc{r} furthest to \ccc{s}. }
\ccMethod{NT transformed_distance(NT d);} {Returns $d^2$.} \ccMethod{NT transformed_distance(NT d) const;} {Returns $d^2$.}
\ccMethod{NT inverse_of_transformed_distance(NT d);} {Returns $d^{1/2}$.} \ccMethod{NT inverse_of_transformed_distance(NT d) const;} {Returns $d^{1/2}$.}
\ccSeeAlso \ccSeeAlso

View File

@ -56,15 +56,6 @@ Splitter
\ccConstructor{ Fair(unsigned int bucket_size, \ccConstructor{ Fair(unsigned int bucket_size,
FT aspect_ratio=FT(3))}{Constructor.} FT aspect_ratio=FT(3))}{Constructor.}
\ccOperations
\ccMethod{FT aspect_ratio();}{Returns the maximal ratio between the largest and smallest side
of a cell allowed for fair splitting.}
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.}
\ccSeeAlso \ccSeeAlso
\ccc{Splitter},\\ \ccc{Splitter},\\

View File

@ -36,13 +36,13 @@ The concept \ccRefName\ describes the requirements for fuzzy $d$-dimensional spa
\ccOperations \ccOperations
\ccMethod{bool contains(Point_d p); const}{test whether $q$ contains $p$.} \ccMethod{bool contains(Point_d p) const;}{test whether $q$ contains $p$.}
\ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle); const} \ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the inner approximation of the spatial object intersects a rectangle {test whether the inner approximation of the spatial object intersects a rectangle
associated with a node of a tree. } associated with a node of a tree. }
\ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle); const} \ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the outer approximation of the spatial object encloses the rectangle {test whether the outer approximation of the spatial object encloses the rectangle
associated with a node of a tree.} associated with a node of a tree.}

View File

@ -50,13 +50,13 @@ specified by the minimal iso box containing \ccc{p} and \ccc{q} and fuzziness va
\ccOperations \ccOperations
\ccMethod{bool contains(Point_d p);}{test whether \ccVar\ contains \ccc{p}.} \ccMethod{bool contains(Point_d p) const;}{test whether \ccVar\ contains \ccc{p}.}
\ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle);} \ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the inner box intersects the rectangle {test whether the inner box intersects the rectangle
associated with a node of a tree.} associated with a node of a tree.}
\ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle);} \ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the outer box encloses the rectangle associated with a node of a tree.} {test whether the outer box encloses the rectangle associated with a node of a tree.}
\ccSeeAlso \ccSeeAlso

View File

@ -49,13 +49,13 @@ centered at \ccc{center} with radius \ccc{radius} and fuzziness value \ccc{epsil
\ccOperations \ccOperations
\ccMethod{bool contains(const Point_d& p); const}{test whether $s$ contains $p$.} \ccMethod{bool contains(const Point_d& p) const;}{test whether $s$ contains $p$.}
\ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle); const} \ccMethod{bool inner_range_intersects(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the inner sphere intersects the rectangle {test whether the inner sphere intersects the rectangle
associated with a node of a tree.} associated with a node of a tree.}
\ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle); const} \ccMethod{bool outer_range_contains(const Kd_tree_rectangle<FT>& rectangle) const;}
{test whether the outer sphere encloses the rectangle associated with a node of a tree.} {test whether the outer sphere encloses the rectangle associated with a node of a tree.}
\ccSeeAlso \ccSeeAlso

View File

@ -42,17 +42,17 @@ Euclidean distance.
\ccMethod{FT transformed_distance(Query_item q, Point_d r);}{Returns the transformed distance between \ccc{q} and~\ccc{r}.} \ccMethod{FT transformed_distance(Query_item q, Point_d r);}{Returns the transformed distance between \ccc{q} and~\ccc{r}.}
\ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r);} \ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r) const;}
{Returns the transformed distance between \ccc{q} and {Returns the transformed distance between \ccc{q} and
the point on the boundary of \ccc{r} closest to \ccc{q}.} the point on the boundary of \ccc{r} closest to \ccc{q}.}
\ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r);} \ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r) const;}
{Returns the transformed distance between \ccc{q} and {Returns the transformed distance between \ccc{q} and
the point on the boundary of \ccc{r} furthest to \ccc{q}.} the point on the boundary of \ccc{r} furthest to \ccc{q}.}
\ccMethod{FT transformed_distance(FT d);} {Returns the transformed distance.} \ccMethod{FT transformed_distance(FT d) const;} {Returns the transformed distance.}
\ccMethod{FT inverse_of_transformed_distance(FT d);} {Returns the inverse of the transformed distance.} \ccMethod{FT inverse_of_transformed_distance(FT d) const;} {Returns the inverse of the transformed distance.}

View File

@ -47,7 +47,7 @@ template argument \ccc{CGAL::Tag_false} makes that the tree is built with unexte
\ccTypedef{Traits::NT NT;}{Number type.} \ccTypedef{Traits::NT NT;}{Number type.}
\ccTypedef{GeneralDistance Distance;}{Distance type.} \ccTypedef{GeneralDistance Distance;}{Distance type.}
\ccTypedef{std::pair<Point_d,NT> Point_with_transformed_distance;}{Pair of point and transformed distance. } \ccTypedef{std::pair<Point_d,NT> Point_with_transformed_distance;}{Pair of point and transformed distance. }
\ccNestedType{iterator}{Input iterator with value type \ccc{Point_with_transformed_distance} \ccNestedType{iterator}{Const input iterator with value type \ccc{Point_with_transformed_distance}
for enumerating approximate neighbors.} for enumerating approximate neighbors.}
\ccTypedef{GeneralDistance::Query_item Query_item;}{Query item type.} \ccTypedef{GeneralDistance::Query_item Query_item;}{Query item type.}
@ -67,9 +67,9 @@ in the points stored \ccc{tree} using a distance \ccc{d} and approximation facto
\ccOperations \ccOperations
\ccMethod{iterator begin();}{Returns an iterator to the approximate nearest or furthest neighbor.} \ccMethod{iterator begin() const;}{Returns a const iterator to the approximate nearest or furthest neighbor.}
\ccMethod{iterator end();}{Past-the-end iterator.} \ccMethod{iterator end() const;}{Past-the-end const iterator.}
\begin{ccAdvanced} \begin{ccAdvanced}

View File

@ -47,7 +47,7 @@ template argument \ccc{CGAL::Tag_false} makes that the tree is built with unexte
\ccTypedef{GeneralDistance Distance;}{Distance type.} \ccTypedef{GeneralDistance Distance;}{Distance type.}
\ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.} \ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.}
\ccNestedType{iterator}{Bidirectional iterator with value type \ccc{Point_with_distance} \ccNestedType{iterator}{Bidirectional const iterator with value type \ccc{Point_with_distance}
for enumerating approximate neighbors.} for enumerating approximate neighbors.}
\ccTypedef{GeneralDistance::Query_item Query_item;}{Query item type.} \ccTypedef{GeneralDistance::Query_item Query_item;}{Query item type.}
@ -60,7 +60,7 @@ template argument \ccc{CGAL::Tag_false} makes that the tree is built with unexte
\def\ccLongParamLayout{\ccTrue} \def\ccLongParamLayout{\ccTrue}
\ccConstructor{K_neighbor_search(Tree& tree, Query_item q, unsigned int k=1, FT eps=FT(0.0), \ccConstructor{K_neighbor_search(const Tree& tree, Query_item q, unsigned int k=1, FT eps=FT(0.0),
bool search_nearest=true, GeneralDistance d=GeneralDistance(),bool sorted=true);} bool search_nearest=true, GeneralDistance d=GeneralDistance(),bool sorted=true);}
{Constructor for searching approximately $k$ neighbors of the query item \ccc{q} {Constructor for searching approximately $k$ neighbors of the query item \ccc{q}
in the points stored in \ccc{tree} using in the points stored in \ccc{tree} using
@ -73,9 +73,9 @@ if the computed sequence of $k$-nearest neighbors needs to be sorted.}
%OutputIterator the_k_neighbors(OutputIterator res);} %OutputIterator the_k_neighbors(OutputIterator res);}
%{Writes \ccc{k} elements of type \ccc{Point_with_distance} to \ccc{res}.} %{Writes \ccc{k} elements of type \ccc{Point_with_distance} to \ccc{res}.}
\ccMethod{iterator begin();}{Returns an iterator to the approximate neighbors.} \ccMethod{iterator begin() const;}{Returns a const iterator to the approximate neighbors.}
\ccMethod{iterator end();}{Past-the-end iterator.} \ccMethod{iterator end() const;}{Past-the-end const iterator.}
\begin{ccAdvanced} \begin{ccAdvanced}

View File

@ -1,4 +1,4 @@
% +------------------------------------------------------------------------+ s% +------------------------------------------------------------------------+
% | Reference manual page: Kd_tree.tex % | Reference manual page: Kd_tree.tex
% +------------------------------------------------------------------------+ % +------------------------------------------------------------------------+
% | 1.07.2001 Johan W.H. Tangelder % | 1.07.2001 Johan W.H. Tangelder
@ -38,12 +38,13 @@ tree shall be built with extended nodes, and \ccc{CGAL::Tag_false} otherwise.
\ccTypedef{Traits::FT FT;}{Number type.} \ccTypedef{Traits::FT FT;}{Number type.}
\ccNestedType{Splitter}{Splitter type.} \ccNestedType{Splitter}{Splitter type.}
\ccNestedType{iterator}{Bidirectional iterator with value type \ccc{Point_d} that allows \ccNestedType{iterator}{Bidirectional const iterator with value type \ccc{Point_d} that allows
to enumerate all points in the tree.} to enumerate all points in the tree.}
\begin{ccAdvanced} \begin{ccAdvanced}
\ccNestedType{Node_handle}{A handle with value type \ccc{Kd_tree_node<Traits,Splitter>}.} \ccNestedType{Node_handle}{A handle with value type \ccc{Kd_tree_node<Traits,Splitter>}.}
\ccNestedType{Point_d_iterator} {Random access iterator \ccNestedType{Node_const_handle}{A const handle with value type \ccc{Kd_tree_node<Traits,Splitter>}.}
\ccNestedType{Point_d_iterator} {Random access const iterator
with value type \ccc{Point_d*}.} with value type \ccc{Point_d*}.}
\end{ccAdvanced} \end{ccAdvanced}
@ -72,19 +73,19 @@ The value type of the \ccc{InputIterator} must be \ccc{Point_d}.}
\ccMethod{ \ccMethod{
template <class OutputIterator, class FuzzyQueryItem> template <class OutputIterator, class FuzzyQueryItem>
OutputIterator search(OutputIterator it, FuzzyQueryItem q);} OutputIterator search(OutputIterator it, FuzzyQueryItem q) const;}
{Reports the points that are approximately contained by~\ccc{q}. {Reports the points that are approximately contained by~\ccc{q}.
The types \ccc{FuzzyQueryItem::Point_d} and \ccc{Point_d} must be equivalent. The types \ccc{FuzzyQueryItem::Point_d} and \ccc{Point_d} must be equivalent.
To use this function \ccc{Traits} must be a model of the concept \ccc{RangeSearchTraits}. To use this function \ccc{Traits} must be a model of the concept \ccc{RangeSearchTraits}.
} }
\ccMethod{iterator begin();}{Returns an iterator to the first point in the tree.} \ccMethod{iterator begin() const;}{Returns a const iterator to the first point in the tree.}
\ccMethod{iterator end();}{Returns the corresponding past-the-end iterator.} \ccMethod{iterator end() const;}{Returns the corresponding past-the-end const iterator.}
\ccMethod{void clear() const;}{Removes all points from the $k$-$d$ tree.} \ccMethod{void clear();}{Removes all points from the $k$-$d$ tree.}
\ccMethod{unsigned int size();} \ccMethod{unsigned int size() const;}
{Returns the number of points that are stored in the tree.} {Returns the number of points that are stored in the tree.}
\ccMethod{Traits traits() const;}{return the instance of the traits used to construct the tree.} \ccMethod{Traits traits() const;}{return the instance of the traits used to construct the tree.}
@ -94,10 +95,13 @@ To use this function \ccc{Traits} must be a model of the concept \ccc{RangeSearc
\ccMethod{Node_handle root();} \ccMethod{Node_handle root();}
{Returns a handle to the root node of the tree.} {Returns a handle to the root node of the tree.}
\ccMethod{const Kd_tree_rectangle<FT>& bounding_box();}{returns a const reference \ccMethod{Node_const_handle root() const;}
{Returns a const handle to the root node of the tree.}
\ccMethod{const Kd_tree_rectangle<FT>& bounding_box() const;}{returns a const reference
to the bounding box of the root node of the tree.} to the bounding box of the root node of the tree.}
\ccMethod{std::ostream& statistics(std::ostream& s);} \ccMethod{std::ostream& statistics(std::ostream& s) const;}
{ {
Inserts statistics of the tree into the output stream \ccc{s}. Inserts statistics of the tree into the output stream \ccc{s}.
} }

View File

@ -42,8 +42,9 @@ for example \ccc{CGAL::Search_traits_2<CGAL::Cartesian<double> >}, or \ccc{CGAL:
\ccTypedef{Traits::FT FT;}{Number type.} \ccTypedef{Traits::FT FT;}{Number type.}
\ccTypedef{Traits::Point_d Point_d;}{Point type.} \ccTypedef{Traits::Point_d Point_d;}{Point type.}
\ccTypedef{Splitter::Separator Separator;}{Separator type.} \ccTypedef{Splitter::Separator Separator;}{Separator type.}
\ccTypedef{Kd_tree<Traits,Splitter,UseExtendedNode>::Point_d_iterator Point_d_iterator;}{Iterator over points.} \ccTypedef{Kd_tree<Traits,Splitter,UseExtendedNode>::Point_d_iterator Point_d_iterator;}{Const iterator over points.}
\ccTypedef{Kd_tree<Traits,Splitter,UseExtendedNode>::Node_handle Node_handle;}{Node handle.} \ccTypedef{Kd_tree<Traits,Splitter,UseExtendedNode>::Node_handle Node_handle;}{Node handle.}
\ccTypedef{Kd_tree<Traits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;}{Const node handle.}
\ccCreation \ccCreation
@ -55,24 +56,26 @@ for example \ccc{CGAL::Search_traits_2<CGAL::Cartesian<double> >}, or \ccc{CGAL:
\ccMethod{ \ccMethod{
template <class OutputIterator, class FuzzyQueryItem> template <class OutputIterator, class FuzzyQueryItem>
OutputIterator search(OutputIterator it, FuzzyQueryItem q);} OutputIterator search(OutputIterator it, FuzzyQueryItem q) const;}
{Reports the points from the subtree of the node, that are approximately contained by q.} {Reports the points from the subtree of the node, that are approximately contained by q.}
\ccMethod{ \ccMethod{
template <class OutputIterator> template <class OutputIterator>
OutputIterator tree_points(OutputIterator it);} OutputIterator tree_items(OutputIterator it) const;}
{Reports all the points contained by the subtree of the node.} {Reports all the points contained by the subtree of the node.}
\ccMethod{bool is_leaf();}{Indicates whether a node is a leaf node.} \ccMethod{bool is_leaf() const;}{Indicates whether a node is a leaf node.}
\ccMethod{int size();}{Returns the number of items stored in a leaf node.} \ccMethod{unsigned int size() const;}{Returns the number of items stored in a leaf node.}
\ccMethod{Point_d_iterator begin();}{Returns the iterator to the first item in a leaf node.} \ccMethod{Point_d_iterator begin() const;}{Returns a const iterator to the first item in a leaf node.}
\ccMethod{Point_d_iterator end();}{Returns the past-the-end iterator in a leaf node.} \ccMethod{Point_d_iterator end() const;}{Returns a past-the-end const iterator in a leaf node.}
\ccMethod{Node_handle lower();}{Returns a handle to the lower child of an internal node.} \ccMethod{Node_handle lower();}{Returns a handle to the lower child of an internal node.}
\ccMethod{Node_handle upper();}{Returns a handle to the upper child of an internal node.} \ccMethod{Node_handle upper();}{Returns a handle to the upper child of an internal node.}
\ccMethod{Node_const_handle lower() const;}{Returns a const handle to the lower child of an internal node.}
\ccMethod{Node_const_handle upper() const;}{Returns a const handle to the upper child of an internal node.}
\ccMethod{Separator& separator();}{Returns a reference to the separator.} \ccMethod{Separator& separator();}{Returns a reference to the separator.}
\ccMethod{FT low_val();}{Returns the lower limit of an extended node's rectangle \ccMethod{FT low_value() const;}{Returns the lower limit of an extended node's rectangle
along the node's cutting dimension.} along the node's cutting dimension.}
\ccMethod{FT high_val();}{Returns the upper limit of an extended node's rectangle \ccMethod{FT high_value() const;}{Returns the upper limit of an extended node's rectangle
along the node's cutting dimension.} along the node's cutting dimension.}

View File

@ -47,10 +47,10 @@ to define iterators with value type \ccc{FT}.}
\ccOperations \ccOperations
\ccMethod{FT min_coord(int i);} \ccMethod{FT min_coord(int i) const;}
{Returns the lower bound of the rectangle in dimension~\ccc{i}.} {Returns the lower bound of the rectangle in dimension~\ccc{i}.}
\ccMethod{FT max_coord(int i);} \ccMethod{FT max_coord(int i) const;}
{Returns the upper bound of the rectangle in dimension~\ccc{i}.} {Returns the upper bound of the rectangle in dimension~\ccc{i}.}
@ -62,13 +62,13 @@ to define iterators with value type \ccc{FT}.}
{Sets lower bound in dimension \ccc{i} to \ccc{x}.} {Sets lower bound in dimension \ccc{i} to \ccc{x}.}
\ccMethod{FT max_span();} \ccMethod{FT max_span() const;}
{Returns the maximal span of the rectangle.} {Returns the maximal span of the rectangle.}
\ccMethod{FT max_span_coord();} \ccMethod{FT max_span_coord() const;}
{Returns the smallest coordinate for which the rectangle has its maximal span.} {Returns the smallest coordinate for which the rectangle has its maximal span.}
\ccMethod{int dimension();} \ccMethod{int dimension() const;}
{Returns the dimension of the rectangle.} {Returns the dimension of the rectangle.}
\ccMethod{void split(Kd_tree_rectangle<FT>& r, int d, FT value);} \ccMethod{void split(Kd_tree_rectangle<FT>& r, int d, FT value);}

View File

@ -49,19 +49,19 @@ Expects for the template argument a model for the concept
\ccOperations \ccOperations
\ccMethod{FT transformed_distance(Query_item b, Point_d p);}{Returns the transformed \ccMethod{FT transformed_distance(Query_item b, Point_d p) const;}{Returns the transformed
distance between \ccc{b} and \ccc{p}.} distance between \ccc{b} and \ccc{p}.}
\ccMethod{FT transformed_distance(FT d);} {Returns the transformed value of of $d$.} \ccMethod{FT transformed_distance(FT d) const;} {Returns the transformed value of of $d$.}
\ccMethod{FT inverse_of_transformed_distance(FT d);} {Returns the value of the inverse \ccMethod{FT inverse_of_transformed_distance(FT d) const;} {Returns the value of the inverse
of the transform function applied to $d$.} of the transform function applied to $d$.}
\ccMethod{FT min_distance_to_rectangle(Query_item b, Kd_tree_rectangle<FT> r);} \ccMethod{FT min_distance_to_rectangle(Query_item b, Kd_tree_rectangle<FT> r) const;}
{Returns the minimal distance between a point from \ccc{b} and a point from {Returns the minimal distance between a point from \ccc{b} and a point from
\ccc{r}.} \ccc{r}.}
\ccMethod{FT max_distance_to_rectangle(Query_item b, Kd_tree_rectangle<FT> r);} \ccMethod{FT max_distance_to_rectangle(Query_item b, Kd_tree_rectangle<FT> r) const;}
{Returns the maximal distance between the iso-box \ccc{b} and {Returns the maximal distance between the iso-box \ccc{b} and
a point from \ccc{r} furthest to \ccc{b}.} a point from \ccc{r} furthest to \ccc{b}.}

View File

@ -43,10 +43,6 @@ the type, \ccc{CGAL::Plane_separator<Traits::FT>}.
\ccConstructor{Median_of_max_spread();}{Default constructor.} \ccConstructor{Median_of_max_spread();}{Default constructor.}
\ccConstructor{Median_of_max_spread(unsigned int bucket_size);}{Constructor.} \ccConstructor{Median_of_max_spread(unsigned int bucket_size);}{Constructor.}
\ccOperations
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.}
\ccSeeAlso \ccSeeAlso
\ccc{Splitter},\\ \ccc{Splitter},\\

View File

@ -41,13 +41,6 @@ the type, \ccc{CGAL::Plane_separator<Traits::FT>}.
\ccConstructor{Median_of_rectangle();}{Default constructor.} \ccConstructor{Median_of_rectangle();}{Default constructor.}
\ccConstructor{Median_of_rectangle(unsigned int bucket_size);}{Constructor.} \ccConstructor{Median_of_rectangle(unsigned int bucket_size);}{Constructor.}
\ccOperations
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.}
\ccSeeAlso \ccSeeAlso
\ccc{Splitter},\\ \ccc{Splitter},\\

View File

@ -44,9 +44,6 @@ the type, \ccc{CGAL::Plane_separator<Traits::FT>}
\ccConstructor{Midpoint_of_max_spread();}{Default constructor.} \ccConstructor{Midpoint_of_max_spread();}{Default constructor.}
\ccConstructor{Midpoint_of_max_spread(unsigned int bucket_size);}{Constructor.} \ccConstructor{Midpoint_of_max_spread(unsigned int bucket_size);}{Constructor.}
\ccOperations
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.}
\ccSeeAlso \ccSeeAlso
\ccc{Splitter},\\ \ccc{Splitter},\\

View File

@ -43,10 +43,6 @@ the type, \ccc{CGAL::Plane_separator<Traits::FT>}
\ccConstructor{Midpoint_of_rectangle_spread();}{Default constructor.} \ccConstructor{Midpoint_of_rectangle_spread();}{Default constructor.}
\ccConstructor{Midpoint_of_rectangle(unsigned int bucket_size);}{Constructor.} \ccConstructor{Midpoint_of_rectangle(unsigned int bucket_size);}{Constructor.}
\ccOperations
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.}
\ccSeeAlso \ccSeeAlso
\ccc{Splitter},\\ \ccc{Splitter},\\

View File

@ -44,21 +44,21 @@ E.g., for an Euclidean distance the transformed distance is the squared Euclidea
\ccOperations \ccOperations
\ccMethod{FT transformed_distance(Query_item q, Point_d r);}{Returns the transformed distance between \ccc{q} and~\ccc{r}.} \ccMethod{FT transformed_distance(Query_item q, Point_d r) const;}{Returns the transformed distance between \ccc{q} and~\ccc{r}.}
\ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r);} \ccMethod{FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r) const;}
{Returns the transformed distance between \ccc{q} and {Returns the transformed distance between \ccc{q} and
the point on the boundary of \ccc{r} closest to \ccc{q}.} the point on the boundary of \ccc{r} closest to \ccc{q}.}
\ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r);} \ccMethod{FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle<FT> r) const;}
{Returns the transformed distance between \ccc{q} and {Returns the transformed distance between \ccc{q} and
the point on the boundary of \ccc{r} farthest to \ccc{q}.} the point on the boundary of \ccc{r} farthest to \ccc{q}.}
\ccMethod{FT transformed_distance(FT d);} {Returns the transformed distance.} \ccMethod{FT transformed_distance(FT d) const;} {Returns the transformed distance.}
\ccMethod{FT inverse_of_transformed_distance(FT d);} {Returns the inverse of the transformed distance.} \ccMethod{FT inverse_of_transformed_distance(FT d) const;} {Returns the inverse of the transformed distance.}
\ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension);} {Updates \ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension) const;} {Updates
\ccc{dist} incrementally and returns the updated distance.} \ccc{dist} incrementally and returns the updated distance.}

View File

@ -48,7 +48,7 @@ kd tree nodes.
\ccTypedef{OrthogonalDistance Distance;}{Distance type.} \ccTypedef{OrthogonalDistance Distance;}{Distance type.}
\ccTypedef{OrthogonalDistance::Query_item Query_item;}{Query item.} \ccTypedef{OrthogonalDistance::Query_item Query_item;}{Query item.}
\ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.} \ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.}
\ccNestedType{iterator}{Input iterator with value type \ccc{Point_with_transformed_distance} \ccNestedType{iterator}{Const input iterator with value type \ccc{Point_with_transformed_distance}
for enumerating approximate neighbors.} for enumerating approximate neighbors.}
\ccTypedef{SpatialTree Tree;}{The tree type.} \ccTypedef{SpatialTree Tree;}{The tree type.}
@ -64,13 +64,13 @@ in the points stored \ccc{tree} using a distance \ccc{d} and approximation facto
\ccOperations \ccOperations
\ccMethod{iterator begin();}{Returns an iterator to the approximate neighbors.} \ccMethod{iterator begin() const;}{Returns a const iterator to the approximate neighbors.}
\ccMethod{iterator end();}{Returns the corresponding past-the-end iterator.} \ccMethod{iterator end() const;}{Returns the corresponding past-the-end const iterator.}
\ \
\begin{ccAdvanced} \begin{ccAdvanced}
\ccMethod{std::ostream& statistics(std::ostream& s);} \ccMethod{std::ostream& statistics(std::ostream& s) const;}
{ {
Inserts statistics of the search process into the output stream~\ccc{s}. Inserts statistics of the search process into the output stream~\ccc{s}.
} }

View File

@ -55,7 +55,7 @@ kd tree nodes.
\ccTypedef{GeneralDistance::Query_item Query_item;}{Query item.} \ccTypedef{GeneralDistance::Query_item Query_item;}{Query item.}
\ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.} \ccTypedef{std::pair<Point_d,FT> Point_with_transformed_distance;}{Pair of point and transformed distance.}
\ccNestedType{iterator}{Bidirectional iterator with value type \ccc{Point_with_transformed_distance} \ccNestedType{iterator}{Bidirectional const iterator with value type \ccc{Point_with_transformed_distance}
for enumerating approximate neighbors.} for enumerating approximate neighbors.}
\ccTypedef{SpatialTree Tree;}{The tree type.} \ccTypedef{SpatialTree Tree;}{The tree type.}
@ -76,9 +76,9 @@ if the computed sequence of $k$-nearest neighbors needs to be sorted.}
%OutputIterator the_k_neighbors(OutputIterator res);} %OutputIterator the_k_neighbors(OutputIterator res);}
%{Writes \ccc{k} elements of type \ccc{Point_with_distance} to \ccc{res}.} %{Writes \ccc{k} elements of type \ccc{Point_with_distance} to \ccc{res}.}
\ccMethod{iterator begin();}{Returns an iterator to the approximate neighbors.} \ccMethod{iterator begin() const;}{Returns a const iterator to the approximate neighbors.}
\ccMethod{iterator end();}{Past-the-end iterator.} \ccMethod{iterator end() const;}{Past-the-end const iterator.}
\begin{ccAdvanced} \begin{ccAdvanced}

View File

@ -52,9 +52,9 @@ void set_cutting_dimension(int d);}
void set_cutting_value(FT v);} void set_cutting_value(FT v);}
{Sets the cutting value to \ccc{v}. } {Sets the cutting value to \ccc{v}. }
\ccMethod{int cutting_dimension();}{Returns the number of the cutting dimension.} \ccMethod{int cutting_dimension() const;}{Returns the number of the cutting dimension.}
\ccMethod{FT cutting_value();}{Returns the cutting value.} \ccMethod{FT cutting_value() const;}{Returns the cutting value.}
% \ccMethod{template <class SpatialPoint> % \ccMethod{template <class SpatialPoint>
% bool has_on_negative_side(SpatialPoint p);} % bool has_on_negative_side(SpatialPoint p);}

View File

@ -41,6 +41,7 @@ $d$-dimensional points of the concept \ccc{SearchTraits}, for example
\ccTypedef{Traits::FT FT;}{Number type.} \ccTypedef{Traits::FT FT;}{Number type.}
\ccTypedef{Traits::Point_d Point_d;}{Point type.} \ccTypedef{Traits::Point_d Point_d;}{Point type.}
\ccNestedType{iterator}{An iterator with value type \ccc{Point_d*}.} \ccNestedType{iterator}{An iterator with value type \ccc{Point_d*}.}
\ccNestedType{const_iterator}{A const iterator with value type \ccc{const Point_d*}.}
%---------------------------------------- %----------------------------------------
\ccCreation \ccCreation
@ -87,34 +88,44 @@ Return an iterator pointing to the pointer to the first point.
Return the iterator to the corresponding past-the-end iterator. Return the iterator to the corresponding past-the-end iterator.
} }
\ccMethod{const_iterator begin() const;}
{
Return a const iterator pointing to the pointer to the first point.
}
\ccMethod{const_iterator end() const;}
{
Return a const iterator to the corresponding past-the-end iterator.
}
\ccMethod{int dimension() const;} \ccMethod{int dimension() const;}
{ {
Return the dimension. Return the dimension.
} }
\ccMethod{int built_coordinate();} \ccMethod{int built_coordinate() const;}
{ {
Return coordinate for which the pointer list is built. Return coordinate for which the pointer list is built.
} }
\ccMethod{int max_span_coord();} \ccMethod{int max_span_coord() const;}
{ {
Return coordinate where the associated rectangle has maximal span. Return coordinate where the associated rectangle has maximal span.
} }
\ccMethod{int max_tight_span_coord();} \ccMethod{int max_tight_span_coord() const;}
{ {
Return coordinate where the point coordinates have maximal span. Return coordinate where the point coordinates have maximal span.
} }
\ccMethod{FT max_span_lower();} \ccMethod{FT max_span_lower() const;}
{ {
Return lower value of the interval corresponding to Return lower value of the interval corresponding to
\ccc{max_span_coord()}. \ccc{max_span_coord()}.
} }
\ccMethod{FT max_tight_span_lower();} \ccMethod{FT max_tight_span_lower() const;}
{ {
Return lower value of the interval corresponding to Return lower value of the interval corresponding to
\ccc{max_tight_span_coord()}. That is, the smallest \ccc{max_tight_span_coord()}. That is, the smallest
@ -123,47 +134,47 @@ Return lower value of the interval corresponding to
} }
\ccMethod{FT max_span_upper();} \ccMethod{FT max_span_upper() const;}
{ {
Return upper value of the interval corresponding to Return upper value of the interval corresponding to
\ccc{max_span_coord()}. \ccc{max_span_coord()}.
} }
\ccMethod{FT max_span_upper_without_dim(int d);} \ccMethod{FT max_span_upper_without_dim(int d) const;}
{ {
Return upper value of the interval over all dimensions Return upper value of the interval over all dimensions
without taking dimension \ccc{d} into account. without taking dimension \ccc{d} into account.
} }
\ccMethod{FT max_tight_span_upper();} \ccMethod{FT max_tight_span_upper() const;}
{ {
Return upper value of the interval corresponding to Return upper value of the interval corresponding to
\ccc{max_tight_span_coord()}. \ccc{max_tight_span_coord()}.
} }
\ccMethod{FT max_spread();} \ccMethod{FT max_spread() const;}
{ {
Return the size of the interval corresponding to \ccc{max_span_coord()}. Return the size of the interval corresponding to \ccc{max_span_coord()}.
} }
\ccMethod{FT max_tight_spread();} \ccMethod{FT max_tight_spread() const;}
{ {
Return the size of the interval corresponding to \ccc{max_tight_span_coord()}. Return the size of the interval corresponding to \ccc{max_tight_span_coord()}.
} }
\ccMethod{FT median(int split_coord);} \ccMethod{FT median(int split_coord) const;}
{ {
Return the median value of the points stored in the container for Return the median value of the points stored in the container for
dimension \ccc{split_coord}. dimension \ccc{split_coord}.
} }
\ccMethod{const Kd_tree_rectangle<Traits> & bounding_box();} \ccMethod{const Kd_tree_rectangle<Traits> & bounding_box() const;}
{Return the associated rectangle.} {Return the associated rectangle.}
\ccMethod{const Kd_tree_rectangle<Traits> & tight_bounding_box();} \ccMethod{const Kd_tree_rectangle<Traits> & tight_bounding_box();}
{Return the bounding box of the items in associated rectangle.} {Return the bounding box of the items in associated rectangle.}
\ccMethod{int max_tight_span_coord_balanced(FT aspect_ratio);} \ccMethod{int max_tight_span_coord_balanced(FT aspect_ratio) const;}
{Return the dimension with the maximal point spread, for which after fair splitting {Return the dimension with the maximal point spread, for which after fair splitting
the ratio of the length of the longest side and the smallest side of the bounding box of the ratio of the length of the longest side and the smallest side of the bounding box of
the items in associated rectangle, the items in associated rectangle,
@ -175,12 +186,12 @@ does not exceed \ccc{aspect_ratio}.}
\ccMethod{FT balanced_sliding_fair(int d, FT aspect_ratio);} \ccMethod{FT balanced_sliding_fair(int d, FT aspect_ratio);}
{Return the splitting value for sliding fair splitting.} {Return the splitting value for sliding fair splitting.}
\ccMethod{int size();} \ccMethod{std::size_t size() const;}
{ {
Return the number of points stored. Return the number of points stored.
} }
\ccMethod{bool empty();} \ccMethod{bool empty() const;}
{ {
Return true if no points are present, false otherwise. Return true if no points are present, false otherwise.
} }

View File

@ -40,7 +40,7 @@ provides the type \ccc{result_type} that must be the same a \ccc{Cartesian_const
\ccOperations \ccOperations
\ccMethod{Construct_cartesian_const_iterator_d construct_construct_cartesian_const_iterator_d_object(const Point_d& p);} \ccMethod{Construct_cartesian_const_iterator_d construct_construct_cartesian_const_iterator_d_object(const Point_d& p) const;}
{function used to construct an object of type \ccc{Construct_cartesian_const_iterator_d}.} {function used to construct an object of type \ccc{Construct_cartesian_const_iterator_d}.}
\ccHasModels \ccHasModels

View File

@ -45,10 +45,10 @@ define the way in which $k$-$d$ tree is constructed.
\ccOperations \ccOperations
\ccMethod{FT aspect_ratio();}{Returns the maximal ratio between the largest and smallest side \ccMethod{FT aspect_ratio() const;}{Returns the maximal ratio between the largest and smallest side
of a cell allowed for fair splitting.} of a cell allowed for fair splitting.}
\ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.} \ccMethod{unsigned int bucket_size() const;} {Returns the bucket size of the leaf nodes.}
\ccMethod{void operator()(Separator& sep, Container& c0, Container& c1) const;} \ccMethod{void operator()(Separator& sep, Container& c0, Container& c1) const;}
{ {

View File

@ -56,23 +56,23 @@ The values in the iterator range \ccc{[wb,we)} are the weight. }
\ccOperations \ccOperations
\ccMethod{FT transformed_distance(Point_d q, Point_d r);}{Returns $d^{power}$, \ccMethod{FT transformed_distance(Point_d q, Point_d r) const;}{Returns $d^{power}$,
where $d$ denotes the distance between \ccc{q} and~\ccc{r}.} where $d$ denotes the distance between \ccc{q} and~\ccc{r}.}
\ccMethod{FT min_distance_to_rectangle(Point_d q, Kd_tree_rectangle<FT> r;);} \ccMethod{FT min_distance_to_rectangle(Point_d q, Kd_tree_rectangle<FT> r;) const;}
{Returns $d^{power}$, where $d$ denotes the distance between the query item \ccc{q} and {Returns $d^{power}$, where $d$ denotes the distance between the query item \ccc{q} and
the point on the boundary of \ccc{r} closest to \ccc{q}.} the point on the boundary of \ccc{r} closest to \ccc{q}.}
\ccMethod{FT max_distance_to_rectangle(Point_d q, Kd_tree_rectangle<FT> r;);} \ccMethod{FT max_distance_to_rectangle(Point_d q, Kd_tree_rectangle<FT> r;) const;}
{Returns $d^{power}$, where $d$ denotes the distance between the query item \ccc{q} and {Returns $d^{power}$, where $d$ denotes the distance between the query item \ccc{q} and
the point on the boundary of \ccc{r} farthest to \ccc{q}.} the point on the boundary of \ccc{r} farthest to \ccc{q}.}
\ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension);} {Updates \ccc{dist} incrementally \ccMethod{FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension) const;} {Updates \ccc{dist} incrementally
and returns the updated distance.} and returns the updated distance.}
\ccMethod{FT transformed_distance(FT d);} {Returns $d^p$ for $0 < p <\infty$ . Returns $d$ for $p=\infty$ .} \ccMethod{FT transformed_distance(FT d) const;} {Returns $d^p$ for $0 < p <\infty$ . Returns $d$ for $p=\infty$ .}
\ccMethod{FT inverse_of_transformed_distance(FT d);} {Returns $d^{1/p}$ for $0 < p <\infty$. \ccMethod{FT inverse_of_transformed_distance(FT d) const;} {Returns $d^{1/p}$ for $0 < p <\infty$.
Returns $d$ for $p=\infty$.} Returns $d$ for $p=\infty$.}

View File

@ -43,7 +43,7 @@ namespace CGAL {
typedef typename SearchTraits::Point_d Point_d; typedef typename SearchTraits::Point_d Point_d;
typedef typename SearchTraits::FT FT; typedef typename SearchTraits::FT FT;
typedef typename Tree::Point_d_iterator Point_d_iterator; typedef typename Tree::Point_d_iterator Point_d_iterator;
typedef typename Tree::Node_handle Node_handle; typedef typename Tree::Node_const_handle Node_const_handle;
typedef typename Tree::Splitter Splitter; typedef typename Tree::Splitter Splitter;
typedef Kd_tree_rectangle<FT> Node_box; typedef Kd_tree_rectangle<FT> Node_box;
typedef typename Distance::Query_item Query_item; typedef typename Distance::Query_item Query_item;
@ -53,12 +53,12 @@ namespace CGAL {
private: private:
Node_box* the_box; Node_box* the_box;
Node_handle the_node; Node_const_handle the_node;
public: public:
// constructor // constructor
Cell (Node_box* Nb, Node_handle N) Cell (Node_box* Nb, Node_const_handle N)
:the_box(Nb), the_node(N) :the_box(Nb), the_node(N)
{} {}
@ -68,7 +68,7 @@ namespace CGAL {
return the_box; return the_box;
} }
Node_handle Node_const_handle
node() node()
{ {
return the_node; return the_node;
@ -92,7 +92,7 @@ namespace CGAL {
public: public:
// constructor // constructor
Incremental_neighbor_search(Tree& tree, const Query_item& q, Incremental_neighbor_search(const Tree& tree, const Query_item& q,
FT Eps=FT(0.0), bool search_nearest=true, FT Eps=FT(0.0), bool search_nearest=true,
const Distance& tr=Distance()) const Distance& tr=Distance())
{ {
@ -108,13 +108,13 @@ namespace CGAL {
} }
iterator iterator
begin() begin() const
{ {
return *start; return *start;
} }
iterator iterator
end() end() const
{ {
return *past_the_end; return *past_the_end;
} }
@ -190,7 +190,7 @@ namespace CGAL {
return *this; return *this;
} }
Point_with_transformed_distance& const Point_with_transformed_distance&
operator* () const operator* () const
{ {
return *(*ptr); return *(*ptr);
@ -360,8 +360,8 @@ namespace CGAL {
} }
// * operator // * operator
Point_with_transformed_distance& const Point_with_transformed_distance&
operator* () operator* () const
{ {
return *(Item_PriorityQueue.top()); return *(Item_PriorityQueue.top());
} }
@ -386,7 +386,7 @@ namespace CGAL {
// Print statistics of the general priority search process. // Print statistics of the general priority search process.
std::ostream& std::ostream&
statistics (std::ostream& s) statistics (std::ostream& s) const
{ {
s << "General priority search statistics:" << std::endl; s << "General priority search statistics:" << std::endl;
s << "Number of internal nodes visited:" << s << "Number of internal nodes visited:" <<
@ -443,7 +443,7 @@ namespace CGAL {
while ((!next_neighbour_found) && (!PriorityQueue.empty())) { while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
Cell_with_distance* The_node_top = PriorityQueue.top(); Cell_with_distance* The_node_top = PriorityQueue.top();
Node_handle N = The_node_top->first->node(); Node_const_handle N = The_node_top->first->node();
Node_box* B = The_node_top->first->box(); Node_box* B = The_node_top->first->box();
PriorityQueue.pop(); PriorityQueue.pop();
delete The_node_top->first; delete The_node_top->first;

View File

@ -34,7 +34,7 @@ class K_neighbor_search: public internal::K_neighbor_search<SearchTraits,Distanc
public: public:
typedef typename Base::FT FT; typedef typename Base::FT FT;
K_neighbor_search(Tree& tree, const typename Base::Query_item& q, K_neighbor_search(const Tree& tree, const typename Base::Query_item& q,
unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true) unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true)
: Base(q,k,Eps,Search_nearest,d) : Base(q,k,Eps,Search_nearest,d)
{ {
@ -44,11 +44,11 @@ public:
}; };
private: private:
typedef typename Base::Node_handle Node_handle; typedef typename Base::Node_const_handle Node_const_handle;
using Base::branch; using Base::branch;
void void
compute_neighbors_general(typename Base::Node_handle N, const Kd_tree_rectangle<FT>& r) compute_neighbors_general(typename Base::Node_const_handle N, const Kd_tree_rectangle<FT>& r)
{ {
if (!(N->is_leaf())) { if (!(N->is_leaf())) {
this->number_of_internal_nodes_visited++; this->number_of_internal_nodes_visited++;

View File

@ -44,30 +44,34 @@ public:
typedef typename SearchTraits::FT FT; typedef typename SearchTraits::FT FT;
typedef Kd_tree_node<SearchTraits, Splitter, UseExtendedNode > Node; typedef Kd_tree_node<SearchTraits, Splitter, UseExtendedNode > Node;
typedef Kd_tree<SearchTraits, Splitter> Tree; typedef Kd_tree<SearchTraits, Splitter> Tree;
typedef Kd_tree<SearchTraits, Splitter,UseExtendedNode> Self;
typedef typename Compact_container<Node>::iterator Node_handle; typedef typename Compact_container<Node>::iterator Node_handle;
typedef typename std::vector<Point_d*>::iterator Point_d_iterator; typedef typename Compact_container<Node>::const_iterator Node_const_handle;
typedef typename std::vector<const Point_d*>::const_iterator Point_d_iterator;
typedef typename std::vector<const Point_d*>::const_iterator Point_d_const_iterator;
typedef typename Splitter::Separator Separator; typedef typename Splitter::Separator Separator;
typedef typename std::vector<Point_d>::const_iterator iterator; typedef typename std::vector<Point_d>::const_iterator iterator;
typedef typename std::vector<Point_d>::const_iterator const_iterator;
private: private:
SearchTraits traits_; SearchTraits traits_;
mutable Splitter split; Splitter split;
mutable Compact_container<Node> nodes; Compact_container<Node> nodes;
mutable Node_handle tree_root; Node_handle tree_root;
mutable Kd_tree_rectangle<FT>* bbox; Kd_tree_rectangle<FT>* bbox;
mutable std::vector<Point_d> pts; std::vector<Point_d> pts;
// Instead of storing the points in arrays in the Kd_tree_node // Instead of storing the points in arrays in the Kd_tree_node
// we put all the data in a vector in the Kd_tree. // we put all the data in a vector in the Kd_tree.
// and we only store an iterator range in the Kd_tree_node. // and we only store an iterator range in the Kd_tree_node.
// //
mutable std::vector<Point_d*> data; std::vector<const Point_d*> data;
mutable bool built_; bool built_;
// protected copy constructor // protected copy constructor
Kd_tree(const Tree& tree) Kd_tree(const Tree& tree)
@ -81,7 +85,7 @@ private:
// The leaf node // The leaf node
Node_handle Node_handle
create_leaf_node(Point_container& c) const create_leaf_node(Point_container& c)
{ {
Node_handle nh = nodes.emplace(static_cast<unsigned int>(c.size()), Node::LEAF); Node_handle nh = nodes.emplace(static_cast<unsigned int>(c.size()), Node::LEAF);
@ -93,13 +97,13 @@ private:
// The internal node // The internal node
Node_handle Node_handle
create_internal_node(Point_container& c, const Tag_true&) const create_internal_node(Point_container& c, const Tag_true&)
{ {
return create_internal_node_use_extension(c); return create_internal_node_use_extension(c);
} }
Node_handle Node_handle
create_internal_node(Point_container& c, const Tag_false&) const create_internal_node(Point_container& c, const Tag_false&)
{ {
return create_internal_node(c); return create_internal_node(c);
} }
@ -111,7 +115,7 @@ private:
// It is not proper yet, but the goal was to see if there is // It is not proper yet, but the goal was to see if there is
// a potential performance gain through the Compact_container // a potential performance gain through the Compact_container
Node_handle Node_handle
create_internal_node_use_extension(Point_container& c) const create_internal_node_use_extension(Point_container& c)
{ {
Node_handle nh = nodes.emplace(Node::EXTENDED_INTERNAL); Node_handle nh = nodes.emplace(Node::EXTENDED_INTERNAL);
@ -144,7 +148,7 @@ private:
// Note also that I duplicated the code to get rid if the if's for // Note also that I duplicated the code to get rid if the if's for
// the boolean use_extension which was constant over the construction // the boolean use_extension which was constant over the construction
Node_handle Node_handle
create_internal_node(Point_container& c) const create_internal_node(Point_container& c)
{ {
Node_handle nh = nodes.emplace(Node::INTERNAL); Node_handle nh = nodes.emplace(Node::INTERNAL);
@ -185,7 +189,7 @@ public:
} }
void void
build() const build()
{ {
const Point_d& p = *pts.begin(); const Point_d& p = *pts.begin();
typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits_.construct_cartesian_const_iterator_d_object(); typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits_.construct_cartesian_const_iterator_d_object();
@ -205,6 +209,13 @@ public:
built_ = true; built_ = true;
} }
private:
//any call to this function is for the moment not threadsafe
void const_build() const {
const_cast<Self*>(this)->build(); //THIS IS NOT THREADSAFE
}
public:
bool is_built() const bool is_built() const
{ {
return built_; return built_;
@ -244,12 +255,12 @@ public:
template <class OutputIterator, class FuzzyQueryItem> template <class OutputIterator, class FuzzyQueryItem>
OutputIterator OutputIterator
search(OutputIterator it, const FuzzyQueryItem& q) search(OutputIterator it, const FuzzyQueryItem& q) const
{ {
if(! pts.empty()){ if(! pts.empty()){
if(! is_built()){ if(! is_built()){
build(); const_build();
} }
Kd_tree_rectangle<FT> b(*bbox); Kd_tree_rectangle<FT> b(*bbox);
tree_root->search(it,q,b); tree_root->search(it,q,b);
@ -264,17 +275,26 @@ public:
} }
SearchTraits const SearchTraits&
traits() const traits() const
{ {
return traits_; return traits_;
} }
Node_handle Node_const_handle
root() const root() const
{ {
if(! is_built()){ if(! is_built()){
build(); const_build();
}
return tree_root;
}
Node_handle
root()
{
if(! is_built()){
const_build();
} }
return tree_root; return tree_root;
} }
@ -283,7 +303,7 @@ public:
print() const print() const
{ {
if(! is_built()){ if(! is_built()){
build(); const_build();
} }
root()->print(); root()->print();
} }
@ -292,18 +312,18 @@ public:
bounding_box() const bounding_box() const
{ {
if(! is_built()){ if(! is_built()){
build(); const_build();
} }
return *bbox; return *bbox;
} }
iterator const_iterator
begin() const begin() const
{ {
return pts.begin(); return pts.begin();
} }
iterator const_iterator
end() const end() const
{ {
return pts.end(); return pts.end();
@ -317,17 +337,17 @@ public:
// Print statistics of the tree. // Print statistics of the tree.
std::ostream& std::ostream&
statistics(std::ostream& s) statistics(std::ostream& s) const
{ {
if(! is_built()){ if(! is_built()){
build(); const_build();
} }
s << "Tree statistics:" << std::endl; s << "Tree statistics:" << std::endl;
s << "Number of items stored: " s << "Number of items stored: "
<< tree_root->num_items() << std::endl; << root()->num_items() << std::endl;
s << "Number of nodes: " s << "Number of nodes: "
<< tree_root->num_nodes() << std::endl; << root()->num_nodes() << std::endl;
s << " Tree depth: " << tree_root->depth() << std::endl; s << " Tree depth: " << root()->depth() << std::endl;
return s; return s;
} }

View File

@ -34,6 +34,7 @@ namespace CGAL {
friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>; friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle; typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle;
typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;
enum Node_type {LEAF, INTERNAL, EXTENDED_INTERNAL}; enum Node_type {LEAF, INTERNAL, EXTENDED_INTERNAL};
typedef typename TreeTraits::Point_d Point_d; typedef typename TreeTraits::Point_d Point_d;
@ -110,19 +111,33 @@ namespace CGAL {
// members for internal node and extended internal node // members for internal node and extended internal node
inline inline
Node_handle Node_const_handle
lower() const lower() const
{ {
return lower_ch; return lower_ch;
} }
inline inline
Node_handle Node_const_handle
upper() const upper() const
{ {
return upper_ch; return upper_ch;
} }
inline
Node_handle
lower()
{
return lower_ch;
}
inline
Node_handle
upper()
{
return upper_ch;
}
// inline Separator& separator() {return sep; } // inline Separator& separator() {return sep; }
// use instead // use instead
@ -164,7 +179,7 @@ namespace CGAL {
std::size_t std::size_t
num_items() num_items() const
{ {
if (is_leaf()) return size(); if (is_leaf()) return size();
else else
@ -172,7 +187,7 @@ namespace CGAL {
} }
std::size_t std::size_t
num_nodes() num_nodes() const
{ {
if (is_leaf()) return 1; if (is_leaf()) return 1;
else else
@ -198,7 +213,7 @@ namespace CGAL {
template <class OutputIterator> template <class OutputIterator>
OutputIterator OutputIterator
tree_items(OutputIterator it) { tree_items(OutputIterator it) const {
if (is_leaf()) if (is_leaf())
{ {
if (n>0) if (n>0)
@ -248,7 +263,7 @@ namespace CGAL {
template <class OutputIterator, class FuzzyQueryItem> template <class OutputIterator, class FuzzyQueryItem>
OutputIterator OutputIterator
search(OutputIterator it, const FuzzyQueryItem& q, search(OutputIterator it, const FuzzyQueryItem& q,
Kd_tree_rectangle<FT>& b) Kd_tree_rectangle<FT>& b) const
{ {
if (is_leaf()) { if (is_leaf()) {
if (n>0) if (n>0)

View File

@ -43,10 +43,10 @@ namespace CGAL {
typedef typename Distance::Query_item Query_item; typedef typename Distance::Query_item Query_item;
typedef typename SearchTraits::FT FT; typedef typename SearchTraits::FT FT;
typedef typename Tree::Point_d_iterator Point_d_iterator; typedef typename Tree::Point_d_iterator Point_d_iterator;
typedef typename Tree::Node_handle Node_handle; typedef typename Tree::Node_const_handle Node_const_handle;
typedef std::pair<Point_d,FT> Point_with_transformed_distance; typedef std::pair<Point_d,FT> Point_with_transformed_distance;
typedef std::pair<Node_handle,FT> Node_with_distance; typedef std::pair<Node_const_handle,FT> Node_with_distance;
typedef std::vector<Node_with_distance*> Node_with_distance_vector; typedef std::vector<Node_with_distance*> Node_with_distance_vector;
typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector; typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector;
@ -132,7 +132,7 @@ namespace CGAL {
// constructor // constructor
Iterator_implementation(Tree& tree,const Query_item& q, const Distance& tr, Iterator_implementation(const Tree& tree,const Query_item& q, const Distance& tr,
FT Eps=FT(0.0), bool search_nearest=true) FT Eps=FT(0.0), bool search_nearest=true)
: traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), : traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0),
number_of_leaf_nodes_visited(0), number_of_items_visited(0), number_of_leaf_nodes_visited(0), number_of_items_visited(0),
@ -163,7 +163,7 @@ namespace CGAL {
} }
// * operator // * operator
Point_with_transformed_distance& const Point_with_transformed_distance&
operator* () const operator* () const
{ {
return *(Item_PriorityQueue.top()); return *(Item_PriorityQueue.top());
@ -247,7 +247,7 @@ namespace CGAL {
// otherwise browse the tree further // otherwise browse the tree further
while ((!next_neighbour_found) && (!PriorityQueue.empty())) { while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
Node_with_distance* The_node_top=PriorityQueue.top(); Node_with_distance* The_node_top=PriorityQueue.top();
Node_handle N= The_node_top->first; Node_const_handle N= The_node_top->first;
PriorityQueue.pop(); PriorityQueue.pop();
delete The_node_top; delete The_node_top;
FT copy_rd=rd; FT copy_rd=rd;
@ -350,7 +350,7 @@ namespace CGAL {
public: public:
// constructor // constructor
Orthogonal_incremental_neighbor_search(Tree& tree, Orthogonal_incremental_neighbor_search(const Tree& tree,
const Query_item& q, FT Eps = FT(0.0), const Query_item& q, FT Eps = FT(0.0),
bool search_nearest=true, const Distance& tr=Distance()) bool search_nearest=true, const Distance& tr=Distance())
: start(tree,q,tr,Eps,search_nearest), : start(tree,q,tr,Eps,search_nearest),
@ -409,7 +409,7 @@ namespace CGAL {
} }
// constructor // constructor
iterator(Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0), iterator(const Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0),
bool search_nearest=true) bool search_nearest=true)
: Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest)) : Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest))
{} {}

View File

@ -36,7 +36,7 @@ class Orthogonal_k_neighbor_search: public internal::K_neighbor_search<SearchTra
public: public:
typedef typename Base::FT FT; typedef typename Base::FT FT;
Orthogonal_k_neighbor_search(Tree& tree, const typename Base::Query_item& q, Orthogonal_k_neighbor_search(const Tree& tree, const typename Base::Query_item& q,
unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true) unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true)
: Base(q,k,Eps,Search_nearest,d) : Base(q,k,Eps,Search_nearest,d)
{ {
@ -58,7 +58,7 @@ public:
} }
private: private:
void compute_neighbors_orthogonally(typename Base::Node_handle N, FT rd) void compute_neighbors_orthogonally(typename Base::Node_const_handle N, FT rd)
{ {
if (!(N->is_leaf())) if (!(N->is_leaf()))
{ {

View File

@ -37,12 +37,13 @@ class Point_container {
private: private:
typedef typename Traits::Point_d Point_d; typedef typename Traits::Point_d Point_d;
typedef std::vector<Point_d*> Point_vector; typedef std::vector<const Point_d*> Point_vector;
public: public:
typedef typename Traits::FT FT; typedef typename Traits::FT FT;
typedef typename Point_vector::iterator iterator; typedef typename Point_vector::iterator iterator;
typedef typename Point_vector::const_iterator const_iterator;
private: private:
Traits traits; Traits traits;
@ -203,17 +204,29 @@ public:
return *m_e - *m_b; return *m_e - *m_b;
} }
inline iterator inline const_iterator
begin() const { begin() const {
return *m_b; return *m_b;
} }
inline iterator inline const_iterator
end() const end() const
{ {
return *m_e; return *m_e;
} }
inline iterator
begin()
{
return *m_b;
}
inline iterator
end()
{
return *m_e;
}
inline bool inline bool
empty() const empty() const
{ {
@ -244,7 +257,7 @@ public:
struct Cmp { struct Cmp {
typedef typename Traits2::FT FT; typedef typename Traits2::FT FT;
typedef typename Traits2::Point_d Point_d; typedef typename Traits2::Point_d Point_d;
typedef std::vector<Point_d*> Point_vector; typedef std::vector<const Point_d*> Point_vector;
int split_coord; int split_coord;
FT value; FT value;
@ -255,7 +268,7 @@ public:
{} {}
bool bool
operator()(Point_d* pt) const operator()(const Point_d* pt) const
{ {
typename Traits2::Cartesian_const_iterator_d ptit; typename Traits2::Cartesian_const_iterator_d ptit;
ptit = construct_it(*pt); ptit = construct_it(*pt);
@ -268,7 +281,7 @@ public:
struct Between { struct Between {
typedef typename Traits2::FT FT; typedef typename Traits2::FT FT;
typedef typename Traits2::Point_d Point_d; typedef typename Traits2::Point_d Point_d;
typedef std::vector<Point_d*> Point_vector; typedef std::vector<const Point_d*> Point_vector;
int split_coord; int split_coord;
FT low, high; FT low, high;
@ -279,7 +292,7 @@ public:
{} {}
bool bool
operator()(Point_d* pt) const operator()(const Point_d* pt) const
{ {
typename Traits2::Cartesian_const_iterator_d ptit; typename Traits2::Cartesian_const_iterator_d ptit;
ptit = construct_it(*pt); ptit = construct_it(*pt);
@ -313,7 +326,7 @@ public:
typename Traits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); typename Traits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
Between<Traits> between(i,tbox.min_coord(i), tbox.max_coord(i), construct_it); Between<Traits> between(i,tbox.min_coord(i), tbox.max_coord(i), construct_it);
for(iterator it = begin(); it != end(); it++){ for(const_iterator it = begin(); it != end(); it++){
b = (b && between(*it)); b = (b && between(*it));
} }
} }
@ -404,7 +417,7 @@ public:
median(const int split_coord) median(const int split_coord)
{ {
typename Traits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); typename Traits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
typename Point_vector::iterator mid = begin() + (end() - begin())/2; iterator mid = begin() + (end() - begin())/2;
std::nth_element(begin(), mid, end(),comp_coord_val<Traits,int>(split_coord,construct_it)); std::nth_element(begin(), mid, end(),comp_coord_val<Traits,int>(split_coord,construct_it));
typename Traits::Cartesian_const_iterator_d mpit = construct_it((*(*mid))); typename Traits::Cartesian_const_iterator_d mpit = construct_it((*(*mid)));

View File

@ -1,4 +1,4 @@
// Copyright (c) 2002 Utrecht University (The Netherlands). // Copyright (c) 2002-2011 Utrecht University (The Netherlands).
// All rights reserved. // All rights reserved.
// //
// This file is part of CGAL (www.cgal.org); you may redistribute it under // This file is part of CGAL (www.cgal.org); you may redistribute it under
@ -79,7 +79,7 @@ namespace CGAL {
void void
operator() (Separator& sep, operator() (Separator& sep,
Container& c0, Container& c0,
Container& c1) Container& c1) const
{ {
sep=Separator(c0.max_tight_span_coord(),FT(0)); sep=Separator(c0.max_tight_span_coord(),FT(0));
sep.set_cutting_value(c0.median(sep.cutting_dimension())); sep.set_cutting_value(c0.median(sep.cutting_dimension()));
@ -109,7 +109,7 @@ namespace CGAL {
{} {}
void void
operator()(Separator& sep, Container& c0, Container& c1) operator()(Separator& sep, Container& c0, Container& c1) const
{ {
// find legal cut with max spread // find legal cut with max spread
sep=Separator(c0.max_tight_span_coord_balanced(this->aspect_ratio()), sep=Separator(c0.max_tight_span_coord_balanced(this->aspect_ratio()),
@ -143,7 +143,7 @@ namespace CGAL {
{} {}
void void
operator() (Separator& sep, Container& c0, Container& c1) operator() (Separator& sep, Container& c0, Container& c1) const
{ {
// find legal cut with max spread // find legal cut with max spread
@ -179,7 +179,7 @@ namespace CGAL {
{} {}
void void
operator()(Separator& sep, Container& c0, Container& c1) operator()(Separator& sep, Container& c0, Container& c1) const
{ {
CGAL_assertion(c0.is_valid()); CGAL_assertion(c0.is_valid());
CGAL_assertion(c1.is_valid()); CGAL_assertion(c1.is_valid());
@ -227,7 +227,7 @@ namespace CGAL {
{} {}
void void
operator() (Separator& sep, Container& c0, Container& c1) operator() (Separator& sep, Container& c0, Container& c1) const
{ {
sep = Separator(c0.max_span_coord(),FT(0)); sep = Separator(c0.max_span_coord(),FT(0));
sep.set_cutting_value(c0.median(sep.cutting_dimension())); sep.set_cutting_value(c0.median(sep.cutting_dimension()));
@ -257,7 +257,7 @@ namespace CGAL {
{} {}
void void
operator()(Separator& sep, Container& c0, Container& c1) operator()(Separator& sep, Container& c0, Container& c1) const
{ {
sep = Separator(c0.max_tight_span_coord(), sep = Separator(c0.max_tight_span_coord(),
(c0.max_tight_span_upper() + c0.max_tight_span_lower())/FT(2)); (c0.max_tight_span_upper() + c0.max_tight_span_lower())/FT(2));
@ -287,7 +287,7 @@ namespace CGAL {
{} {}
void void
operator()(Separator& sep, Container& c0, Container& c1) operator()(Separator& sep, Container& c0, Container& c1) const
{ {
sep = Separator(c0.max_span_coord(), sep = Separator(c0.max_span_coord(),
(c0.max_span_upper() + c0.max_span_lower())/FT(2)); (c0.max_span_upper() + c0.max_span_lower())/FT(2));

View File

@ -95,7 +95,7 @@ namespace CGAL {
inline inline
FT FT
transformed_distance(const Query_item& q, const Point_d& p) transformed_distance(const Query_item& q, const Point_d& p) const
{ {
FT distance = FT(0); FT distance = FT(0);
typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=

View File

@ -1,4 +1,4 @@
// Copyright (c) 2002 Utrecht University (The Netherlands). // Copyright (c) 2002,2011 Utrecht University (The Netherlands).
// All rights reserved. // All rights reserved.
// //
// This file is part of CGAL (www.cgal.org); you may redistribute it under // This file is part of CGAL (www.cgal.org); you may redistribute it under
@ -48,11 +48,12 @@ public:
typedef std::pair<Point_d,FT> Point_with_transformed_distance; typedef std::pair<Point_d,FT> Point_with_transformed_distance;
typedef typename Tree::Node_handle Node_handle; typedef typename Tree::Node_handle Node_handle;
typedef typename Tree::Node_const_handle Node_const_handle;
typedef typename Tree::Point_d_iterator Point_d_iterator; typedef typename Tree::Point_d_iterator Point_d_iterator;
//undocumented type //undocumented type
typedef std::pair<Point_d*,FT> Point_ptr_with_transformed_distance; typedef std::pair<const Point_d*,FT> Point_ptr_with_transformed_distance;
protected: protected:
// Comparison functor to sort a set of points // Comparison functor to sort a set of points