diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_light.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_light.h index 46e91745821..57bd1305cc5 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_light.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_light.h @@ -514,6 +514,7 @@ inline void FrechetLight::continueQSimpleSearch(QSimpleInterval& qsimple, // TODO: uncritical for correctness or speed but unelegant coding style: stripping down information added by getInterval CInterval temp_interval = FrechetLight::getInterval( fixed_curve, fixed, curve, cur); + Interval interval = Interval(temp_interval.begin.getPoint() == cur ? temp_interval.begin.getFraction() : 1, diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/geometry_basics.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/geometry_basics.h index f7cf9f72548..8dec6273f8a 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/geometry_basics.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/geometry_basics.h @@ -113,7 +113,10 @@ struct Lambda> // fill_lambda returns a pair and we are only interested in a bound bool update_exact() const { - if (is_exact) { + if (is_exact){ + if (!exact.has_value()){ + exact = (is_one) ? std::make_optional(Exact(1)) : std::make_optional(Exact(0)); + } return true; } @@ -198,7 +201,9 @@ struct Lambda> { if ((is_zero && other.is_zero) || (is_one && other.is_one)) return false; - if ((is_zero && (!other.is_zero)) || (!is_one && other.is_one)) + // AF this may be wrong if approx is [0.9,1.1] and other.is_one: + // if ((is_zero && (!other.is_zero)) || (!is_one && other.is_one)) + if(is_zero && other.is_one) return true; CGAL::Uncertain res = approx < other.approx; if (CGAL::is_certain(res)) { @@ -206,7 +211,8 @@ struct Lambda> } update_exact(); other.update_exact(); - return exact < other.exact; + bool eres = exact.value() < other.exact.value(); + return eres; } }; diff --git a/Frechet_distance/test/Frechet_distance/CMakeLists.txt b/Frechet_distance/test/Frechet_distance/CMakeLists.txt index 9a489adcc6f..fdf7fc6d1a6 100644 --- a/Frechet_distance/test/Frechet_distance/CMakeLists.txt +++ b/Frechet_distance/test/Frechet_distance/CMakeLists.txt @@ -6,6 +6,9 @@ project( Frechet_distance_Tests ) find_package(CGAL REQUIRED) + +create_single_source_cgal_program( "Frechet-IssueOct25.cpp" ) + find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) diff --git a/Frechet_distance/test/Frechet_distance/Frechet-IssueOct25.cpp b/Frechet_distance/test/Frechet_distance/Frechet-IssueOct25.cpp new file mode 100644 index 00000000000..ff753671a9f --- /dev/null +++ b/Frechet_distance/test/Frechet_distance/Frechet-IssueOct25.cpp @@ -0,0 +1,40 @@ +#include +#include + +#include + +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Point = Kernel::Point_2; +using Segment = Kernel::Segment_2; + +bool load_polyline(const std::string &filename, std::vector &polyline) { + polyline.clear(); + std::ifstream ifs(filename); + + if (!ifs) + return false; + + while (ifs.good()) { + Point p; + ifs >> p; + if (ifs.good()) + polyline.push_back(p); + } + + return true; +} + +int main() { + + std::vector poly1, poly2; + + if (!load_polyline("poly1.txt", poly1) || !load_polyline("poly2.txt", poly2)) { + std::cout << "input files could not be loaded" << std::endl; + return -1; + } + + + std::pair res = CGAL::bounded_error_Frechet_distance(poly1, poly2, 0.000001); + std::cout << "Frechet distance: [" << res.first << ", " << res.second << "]" << std::endl; + return 0; +} diff --git a/Frechet_distance/test/Frechet_distance/poly1.txt b/Frechet_distance/test/Frechet_distance/poly1.txt new file mode 100644 index 00000000000..309937888c6 --- /dev/null +++ b/Frechet_distance/test/Frechet_distance/poly1.txt @@ -0,0 +1,185 @@ +-126 70 +-138 58 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-39 -18 +-42.6 -14 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 diff --git a/Frechet_distance/test/Frechet_distance/poly2.txt b/Frechet_distance/test/Frechet_distance/poly2.txt new file mode 100644 index 00000000000..5317263ddb9 --- /dev/null +++ b/Frechet_distance/test/Frechet_distance/poly2.txt @@ -0,0 +1,625 @@ +-126 70 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +70 -138 +61.4 -118.4 +61.4 -118 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 +-126 70 diff --git a/Stream_lines_2/include/CGAL/Regular_grid_2.h b/Stream_lines_2/include/CGAL/Regular_grid_2.h index 2ef9c992a01..2e9eb33bc58 100644 --- a/Stream_lines_2/include/CGAL/Regular_grid_2.h +++ b/Stream_lines_2/include/CGAL/Regular_grid_2.h @@ -93,7 +93,7 @@ public: template inline -typename Regular_grid_2::Geom_traits::Iso_rectangle_2 +typename StreamLinesTraits_2::Iso_rectangle_2 Regular_grid_2::bbox() const { return typename Geom_traits::Iso_rectangle_2(0.0, 0.0, diff --git a/Stream_lines_2/include/CGAL/Triangular_field_2.h b/Stream_lines_2/include/CGAL/Triangular_field_2.h index 1dd733409c7..df6eb6807f4 100644 --- a/Stream_lines_2/include/CGAL/Triangular_field_2.h +++ b/Stream_lines_2/include/CGAL/Triangular_field_2.h @@ -134,7 +134,7 @@ protected: template inline -typename Triangular_field_2::Geom_traits::Iso_rectangle_2 +typename StreamLinesTraits_2::Iso_rectangle_2 Triangular_field_2::bbox() const { return typename Geom_traits::Iso_rectangle_2(minx, miny, maxx,