diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_sphere.h b/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_sphere.h index 181ea1d312e..db3aec07db3 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_sphere.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_sphere.h @@ -10,12 +10,12 @@ as outer approximation a sphere with radius \f$ r+\epsilon\f$. \attention The fuzziness of a `Fuzzy_sphere` is specified by a parameter \f$ \epsilon\f$ denoting a maximal allowed distance to the boundary of a sphere. -If the distance to the boundary is at least \f$ \epsilon\f$, points inside the +If the distance to the boundary is greater than \f$ \epsilon\f$, points inside the object are always reported and points outside the sphere are never reported. -Points within distance \f$ \epsilon\f$ to the boundary may be or may be not reported. -Subsequently, points on the inner and outer spheres may or may not be reported -by a search query. Specifically when \f$ \epsilon = 0\f$, points on the sphere -of radius \f$ r\f$ may or may not be reported. +Points whose distance to the boundary is less than or equal to \f$ \epsilon\f$ +may or may not be reported. Subsequently, points on the inner and outer spheres +may or may not be reported. Specifically when \f$ \epsilon = 0\f$, points +on the sphere of radius \f$ r\f$ may or may not be reported. \tparam Traits must be a model of the concept `SearchTraits`, for example `CGAL::Cartesian_d`. @@ -90,7 +90,7 @@ bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const; /*! Test whether the outer sphere encloses the rectangle associated with a node of a tree. -That is, whether the minimal distance between the center of the fuzzy sphere and +That is, whether the maximal distance between the center of the fuzzy sphere and `rectangle` is less than \f$ r+\epsilon\f$. */ bool outer_range_contains(const Kd_tree_rectangle& rectangle) const; diff --git a/Spatial_searching/include/CGAL/Fuzzy_sphere.h b/Spatial_searching/include/CGAL/Fuzzy_sphere.h index 7d2c01badbf..32439e65321 100644 --- a/Spatial_searching/include/CGAL/Fuzzy_sphere.h +++ b/Spatial_searching/include/CGAL/Fuzzy_sphere.h @@ -59,9 +59,7 @@ namespace CGAL { } bool contains(const typename SearchTraits::Point_d& p) const { - // test whether the squared distance - // between P and c - // is at most the squared_radius + // test whether the distance between c and p is less than the radius FT squared_radius = r*r; FT distance=FT(0); typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= @@ -70,7 +68,7 @@ namespace CGAL { pit = construct_it(p), end = construct_it(c, 0); for (; cit != end - && (distance <= squared_radius); ++cit, ++pit) { + && (distance < squared_radius); ++cit, ++pit) { distance += ((*cit)-(*pit))*((*cit)-(*pit)); } @@ -78,14 +76,13 @@ namespace CGAL { return (distance < squared_radius); } - - bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const { - // test whether the interior of a sphere - // with radius (r-eps) intersects r, i.e. - // if the minimal distance of r to c is less than r-eps - FT distance = FT(0); - FT squared_radius = (r-eps)*(r-eps); - typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= + bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const { + // test whether the interior of a sphere + // with radius (r-eps) intersects 'rectangle', i.e. + // if the minimal distance of c to 'rectangle' is less than r-eps + FT distance = FT(0); + FT squared_radius = (r-eps)*(r-eps); + typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= traits.construct_cartesian_const_iterator_d_object(); typename SearchTraits::Cartesian_const_iterator_d cit = construct_it(c), end = construct_it(c, 0); @@ -102,17 +99,17 @@ namespace CGAL { } - bool outer_range_contains(const Kd_tree_rectangle& rectangle) const { - // test whether the interior of a sphere - // with radius (r+eps) is contained by r, i.e. - // if the minimal distance of the boundary of r - // to c is less than r+eps - FT distance=FT(0); - FT squared_radius = (r+eps)*(r+eps); - typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= + bool outer_range_contains(const Kd_tree_rectangle& rectangle) const { + // test whether the interior of a sphere + // with radius (r+eps) is contained by 'rectangle', i.e. + // if the maximal distance of c to the boundary of 'rectangle' + // is less than r+eps + FT distance=FT(0); + FT squared_radius = (r+eps)*(r+eps); + typename SearchTraits::Construct_cartesian_const_iterator_d construct_it= traits.construct_cartesian_const_iterator_d_object(); - typename SearchTraits::Cartesian_const_iterator_d cit = construct_it(c), - end = construct_it(c, 0); + typename SearchTraits::Cartesian_const_iterator_d cit = construct_it(c), + end = construct_it(c, 0); for (int i = 0; cit != end && (distance < squared_radius) ; ++cit,++i) { if ((*cit) <= (rectangle.min_coord(i)+rectangle.max_coord(i))/FT(2)) distance +=