mirror of https://github.com/CGAL/cgal
Adress some remarks of Pierre's review
This commit is contained in:
parent
3ec656b316
commit
0a84aef8a1
|
|
@ -53,8 +53,8 @@ as well as `Epick_d` and `Epeck_d`, the computation is filtered and hence both f
|
||||||
|
|
||||||
\section secFrechetDistanceImplementation Implementation
|
\section secFrechetDistanceImplementation Implementation
|
||||||
|
|
||||||
The algorithms in this package are an adaption of the implementation of \cgalCite{cgal:bkn-wdfp-19}
|
The algorithms in this package are an adaption of the implementation devised by Bringmann et al. (\cgalCite{cgal:bkn-wdfp-19}
|
||||||
and \cgalCite{cgal:bkn-wdfp-21}. In particular, the implementation can decide non-difficult cases very
|
and \cgalCite{cgal:bkn-wdfp-21}). In particular, the implementation can decide non-difficult cases very
|
||||||
fast while for difficult cases it still has the quadratic running time guarantee of the classical Fréchet
|
fast while for difficult cases it still has the quadratic running time guarantee of the classical Fréchet
|
||||||
distance algorithm by Alt and Godau cgalCite{ag-cfdbt-95}. This is achieved by using fast bounding
|
distance algorithm by Alt and Godau cgalCite{ag-cfdbt-95}. This is achieved by using fast bounding
|
||||||
box filtering methods and a divide and conquer algorithm with pruning rules on the free-space diagram.
|
box filtering methods and a divide and conquer algorithm with pruning rules on the free-space diagram.
|
||||||
|
|
@ -67,8 +67,8 @@ can be used with either inexact or exact kernels.
|
||||||
|
|
||||||
\subsection subsecFrechetDistanceFirstExample Decision for 2D Polylines
|
\subsection subsecFrechetDistanceFirstExample Decision for 2D Polylines
|
||||||
|
|
||||||
The following example shows how we can use `is_Frechet_distance_larger()` to decide whether the Fréchet
|
The following example shows how we can use `is_Frechet_distance_larger()`
|
||||||
distance between two polylines in the Euclidean plane is at most a given value.
|
to determines if the Frechet distance between two polylines is larger than a given distance bound.
|
||||||
|
|
||||||
\cgalExample{Frechet_distance/Frechet_distance_2.cpp}
|
\cgalExample{Frechet_distance/Frechet_distance_2.cpp}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,16 @@ using Point = Kernel::Point_2;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
std::vector<Point> A, B;
|
std::vector<Point> polylineA, polylineB;
|
||||||
{
|
{
|
||||||
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/LetterA.wkt"));
|
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/LetterA.wkt"));
|
||||||
CGAL::IO::read_linestring_WKT(in, A);
|
CGAL::IO::read_linestring_WKT(in, polylineA);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream in((argc > 1) ? argv[2] : CGAL::data_file_path("wkt/LetterAbis.wkt"));
|
std::ifstream in((argc > 1) ? argv[2] : CGAL::data_file_path("wkt/LetterAbis.wkt"));
|
||||||
CGAL::IO::read_linestring_WKT(in, B);
|
CGAL::IO::read_linestring_WKT(in, polylineB);
|
||||||
}
|
}
|
||||||
bool res = CGAL::is_Frechet_distance_larger(A, B, 0.001);
|
bool res = CGAL::is_Frechet_distance_larger(polylineA, polylineB, 0.001);
|
||||||
std::cout << std::boolalpha << res << std::endl;
|
std::cout << std::boolalpha << res << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ using Point = Kernel::Point_d;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::array<Point,4> A = { Point(0,0,0,0), Point(1,0,0,0), Point(1,1,0,1),Point(1,1,1,0)};
|
std::array<Point,4> polylineA = { Point(0,0,0,0), Point(1,0,0,0), Point(1,1,0,1),Point(1,1,1,0)};
|
||||||
std::array<Point,4> B = { Point(0,0,0,0), Point(1,0,0,0), Point(1,1,0,0),Point(1,1,1,0)};
|
std::array<Point,4> polylineB = { Point(0,0,0,0), Point(1,0,0,0), Point(1,1,0,0),Point(1,1,1,0)};
|
||||||
|
|
||||||
std::pair<double, double> res = CGAL::bounded_error_Frechet_distance(A, B, 0.000001);
|
std::pair<double, double> res = CGAL::bounded_error_Frechet_distance(polylineA, polylineB, 0.000001);
|
||||||
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
|
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue