Skip to content

Commit

Permalink
Assertion if two points are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed Dec 9, 2024
1 parent 344e4d0 commit 757f9cd
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_3.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/WKT.h>

#include <ostream>
#include <fstream>

using Kernel = CGAL::Simple_cartesian<double>;
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
//using Kernel = CGAL::Simple_cartesian<double>;
using Traits = CGAL::Frechet_distance_traits_3<Kernel>;
using Point = Traits::Point_d;

int main(int argc, char* argv[])
{
#if 0
std::vector<Point> A, B;
{
std::ifstream in(CGAL::data_file_path("wkt/moebius.wkt"));
Expand All @@ -21,6 +24,14 @@ int main(int argc, char* argv[])
std::ifstream in(CGAL::data_file_path("wkt/moebius2.wkt"));
CGAL::IO::read_linestring_WKT(in, B);
}
#else

// two identical points fails
std::array<Point,4> A = { Point(0,0,0), Point(0,0,0), Point(1,0,1), Point(1,1,0)};
std::array<Point,4> B = { Point(0,0,0), Point(0,0,0), Point(1,0,0), Point(1,1,0)};

#endif

std::pair<double, double> res = CGAL::approximate_Frechet_distance<Traits>(A, B, 0.000001);
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
return 0;
Expand Down

0 comments on commit 757f9cd

Please sign in to comment.