diff --git a/Triangulation_on_hyperbolic_surface_2/doc/Triangulation_on_hyperbolic_surface_2/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h b/Triangulation_on_hyperbolic_surface_2/doc/Triangulation_on_hyperbolic_surface_2/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h index d4ffd166012..43c0238d14b 100644 --- a/Triangulation_on_hyperbolic_surface_2/doc/Triangulation_on_hyperbolic_surface_2/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h +++ b/Triangulation_on_hyperbolic_surface_2/doc/Triangulation_on_hyperbolic_surface_2/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h @@ -202,7 +202,7 @@ public: */ double shortest_loop() const; /*! - \return a `double` approximation of the length of the shortest non-loop edge in the Delaunay triangulation. + \return a `double` approximation of the length of the shortest non-loop edge in the Delaunay triangulation. Returns 0 (NULL) if all edges are loops. */ double shortest_non_loop_edge() const; /// @} diff --git a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h index 57c080e168d..fd88a250337 100644 --- a/Triangulation_on_hyperbolic_surface_2/include/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h +++ b/Triangulation_on_hyperbolic_surface_2/include/CGAL/Delaunay_triangulation_on_hyperbolic_surface_2.h @@ -1094,6 +1094,7 @@ Delaunay_triangulation_on_hyperbolic_surface_2:: shortest_non_loop_edge() const { Number min_delta_length = 999; + double res = NULL; for (typename Edge_const_range::const_iterator it = this->combinatorial_map_.template one_dart_per_cell<1>().begin(); it != this->combinatorial_map_.template one_dart_per_cell<1>().end(); ++it) { Anchor const & current_anchor = anchor(it); @@ -1112,10 +1113,11 @@ shortest_non_loop_edge() const } if(!is_loop) { Number delta_length = delta(a, b); - min_delta_length = min(min_delta_length,delta_length); + min_delta_length = min(min_delta_length, delta_length); + res = std::acosh(1 + to_double(min_delta_length)); } } - return std::acosh(1 + to_double(min_delta_length)); + return res; } } // namespace CGAL diff --git a/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_Delaunay_triangulation.cpp b/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_Delaunay_triangulation.cpp index 2cf6e2f60ca..e5cbef9f612 100644 --- a/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_Delaunay_triangulation.cpp +++ b/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_Delaunay_triangulation.cpp @@ -80,7 +80,7 @@ int main() assert(same_vertices); assert(dt.shortest_loop() != 0); - assert(dt.shortest_non_loop_edge() != 0); + assert(dt.shortest_non_loop_edge() == 0); return 0; } diff --git a/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_espilon_net.cpp b/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_espilon_net.cpp index 52b134f72ee..b1a7feb31ed 100644 --- a/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_espilon_net.cpp +++ b/Triangulation_on_hyperbolic_surface_2/test/Triangulation_on_hyperbolic_surface_2/hs_test_espilon_net.cpp @@ -60,6 +60,7 @@ int main(int argc, char *argv[]) assert(is_eps_net); assert(dt.is_valid()); + assert(dt.shortest_non_loop_edge() != 0); return 0; } \ No newline at end of file