diff --git a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_2.tex b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_2.tex index 86a6eaefceb..c1c6ebc5e49 100755 --- a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_2.tex +++ b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_2.tex @@ -38,6 +38,7 @@ for example \ccc{CGAL::Cartesian} or \ccc{CGAL::Simple_cartesian}\\ diff --git a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_3.tex b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_3.tex index 1d9ca6c8bc2..fca86d23c4a 100755 --- a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_3.tex +++ b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/Kd_tree_traits_point_3.tex @@ -37,7 +37,8 @@ for example \ccc{CGAL::Cartesian} or \ccc{CGAL::Simple_cartesian}\\ diff --git a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/SpatialPoint.tex b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/SpatialPoint.tex index d44bfab70a7..3e3c5c32d3b 100755 --- a/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/SpatialPoint.tex +++ b/Packages/Spatial_searching/doc_tex/Spatial_searching_ref/SpatialPoint.tex @@ -27,6 +27,7 @@ specialized for the point type. \ccTypes \ccNestedType{Point_d}{Point type.} \ccNestedType{Iso_box_d}{Iso box type.} +\ccNestedType{Sphere_d}{Sphere type.} \ccNestedType{FT}{The number type of the \ccHtmlNoLinksFrom{Cartesian} coordinates of type \ccc{Point_d}.} @@ -39,7 +40,14 @@ first and the past-the-end iterator for the \ccHtmlNoLinksFrom{Cartesian} coordi \ccNestedType{Construct_iso_box_d}{Functor with operator to construct the iso box from two points.} -\ccCreationVariable{p} %% choose variable name +\ccNestedType {Construct_center_d;}{Functor with operator to construct +the center of an object of type \ccc{Sphere_d}.} + +\ccNestedType {Construct_squared_radius_d;}{Functor with operator to compute +the squared radius of a an object of type \ccc{Sphere_d}.} + +\ccNestedType {Construct_vertex_d;}{Functor with operator to construct +the vertices with index $0$ and $2^d-1$ of an object of type \ccc{Iso_box_d}.} diff --git a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_2.tex b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_2.tex index 86a6eaefceb..c1c6ebc5e49 100755 --- a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_2.tex +++ b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_2.tex @@ -38,6 +38,7 @@ for example \ccc{CGAL::Cartesian} or \ccc{CGAL::Simple_cartesian}\\ diff --git a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_3.tex b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_3.tex index 1d9ca6c8bc2..fca86d23c4a 100755 --- a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_3.tex +++ b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/Kd_tree_traits_point_3.tex @@ -37,7 +37,8 @@ for example \ccc{CGAL::Cartesian} or \ccc{CGAL::Simple_cartesian}\\ diff --git a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/SpatialPoint.tex b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/SpatialPoint.tex index d44bfab70a7..3e3c5c32d3b 100755 --- a/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/SpatialPoint.tex +++ b/Packages/Spatial_searching/doc_tex/basic/Spatial_searching_ref/SpatialPoint.tex @@ -27,6 +27,7 @@ specialized for the point type. \ccTypes \ccNestedType{Point_d}{Point type.} \ccNestedType{Iso_box_d}{Iso box type.} +\ccNestedType{Sphere_d}{Sphere type.} \ccNestedType{FT}{The number type of the \ccHtmlNoLinksFrom{Cartesian} coordinates of type \ccc{Point_d}.} @@ -39,7 +40,14 @@ first and the past-the-end iterator for the \ccHtmlNoLinksFrom{Cartesian} coordi \ccNestedType{Construct_iso_box_d}{Functor with operator to construct the iso box from two points.} -\ccCreationVariable{p} %% choose variable name +\ccNestedType {Construct_center_d;}{Functor with operator to construct +the center of an object of type \ccc{Sphere_d}.} + +\ccNestedType {Construct_squared_radius_d;}{Functor with operator to compute +the squared radius of a an object of type \ccc{Sphere_d}.} + +\ccNestedType {Construct_vertex_d;}{Functor with operator to construct +the vertices with index $0$ and $2^d-1$ of an object of type \ccc{Iso_box_d}.} diff --git a/Packages/Spatial_searching/include/CGAL/Fuzzy_iso_box.h b/Packages/Spatial_searching/include/CGAL/Fuzzy_iso_box.h index ad0c171a5c2..3fc5483083a 100644 --- a/Packages/Spatial_searching/include/CGAL/Fuzzy_iso_box.h +++ b/Packages/Spatial_searching/include/CGAL/Fuzzy_iso_box.h @@ -37,10 +37,14 @@ namespace CGAL { typedef typename SearchTraits::Point_d Point_d; typedef typename SearchTraits::Iso_box_d Iso_box_d; typedef typename SearchTraits::FT FT; - + typedef typename SearchTraits::Construct_vertex_d Construct_vertex_d; + typedef typename SearchTraits::Cartesian_const_iterator_d Cartesian_const_iterator_d; + typedef typename SearchTraits::Construct_cartesian_const_iterator_d Construct_cartesian_const_iterator_d; + private: - Iso_box_d box; + Point_d min, max; + Cartesian_const_iterator_d min_begin, max_begin; FT eps; unsigned int dim; @@ -53,36 +57,46 @@ namespace CGAL { Fuzzy_iso_box(const Point_d& p, const Point_d& q, FT epsilon=FT(0)) : eps(epsilon) { - typename SearchTraits::Construct_cartesian_const_iterator_d construct_it; - typename SearchTraits::Cartesian_const_iterator_d begin = construct_it(p), + Construct_cartesian_const_iterator_d construct_it; + Cartesian_const_iterator_d begin = construct_it(p), end = construct_it(p,1); dim = end - begin; - box = SearchTraits::Construct_iso_box_d()(p,q); + + Iso_box_d box = SearchTraits::Construct_iso_box_d()(p,q); + Construct_vertex_d construct_vertex_d; + min = construct_vertex_d(box, 0); + max = construct_vertex_d(box, (1<= box.max()[i]) ) return false; + Construct_cartesian_const_iterator_d construct_it; + Cartesian_const_iterator_d pit = construct_it(p); + Cartesian_const_iterator_d minit= min_begin, maxit = max_begin; + for (unsigned int i = 0; i < dim; ++i, ++pit, ++minit, ++maxit) { + if ( ((*pit) < (*minit)) || ((*pit) >= (*maxit)) ) return false; } return true; } - bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const { - for (unsigned int i = 0; i < dim; ++i) { - if ( (box.max()[i]-eps < rectangle.min_coord(i)) - || (box.min()[i]+eps >= rectangle.max_coord(i)) ) return false; + bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const { + Cartesian_const_iterator_d minit= min_begin, maxit = max_begin; + for (unsigned int i = 0; i < dim; ++i, ++minit, ++maxit) { + if ( ((*maxit)-eps < rectangle.min_coord(i)) + || ((*minit)+eps >= rectangle.max_coord(i)) ) return false; } return true; } - bool outer_range_is_contained_by(const Kd_tree_rectangle& rectangle) const { - for (unsigned int i = 0; i < dim; ++i) { - if ( (box.max()[i]+eps < rectangle.max_coord(i) ) - || (box.min()[i]-eps >= rectangle.min_coord(i)) ) return false; + bool outer_range_is_contained_by(const Kd_tree_rectangle& rectangle) const { + Cartesian_const_iterator_d minit= min_begin, maxit = max_begin; + for (unsigned int i = 0; i < dim; ++i, ++minit, ++maxit) { + if ( ((*maxit)+eps < rectangle.max_coord(i) ) + || ((*minit)-eps >= rectangle.min_coord(i)) ) return false; } return true; } diff --git a/Packages/Spatial_searching/include/CGAL/Search_traits_2.h b/Packages/Spatial_searching/include/CGAL/Search_traits_2.h index f806da73e89..d58ecc8d221 100644 --- a/Packages/Spatial_searching/include/CGAL/Search_traits_2.h +++ b/Packages/Spatial_searching/include/CGAL/Search_traits_2.h @@ -39,6 +39,7 @@ namespace CGAL { typedef typename K::Cartesian_const_iterator_2 Cartesian_const_iterator_d; typedef typename K::Construct_cartesian_const_iterator_2 Construct_cartesian_const_iterator_d; + typedef typename K::Construct_vertex_2 Construct_vertex_d; typedef typename K::Construct_center_2 Construct_center_d; typedef typename K::Compute_squared_radius_2 Compute_squared_radius_d; diff --git a/Packages/Spatial_searching/include/CGAL/Search_traits_3.h b/Packages/Spatial_searching/include/CGAL/Search_traits_3.h index eede75580e1..67b7b81b0cf 100644 --- a/Packages/Spatial_searching/include/CGAL/Search_traits_3.h +++ b/Packages/Spatial_searching/include/CGAL/Search_traits_3.h @@ -41,6 +41,7 @@ namespace CGAL { typedef typename K::Sphere_3 Sphere_d; typedef typename K::Construct_iso_cuboid_3 Construct_iso_box_d; + typedef typename K::Construct_vertex_3 Construct_vertex_d; typedef typename K::Construct_center_3 Construct_center_d; typedef typename K::Compute_squared_radius_3 Compute_squared_radius_d; typedef typename K::FT FT;