Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New package: Frechet Distance #8284

Open
wants to merge 234 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
c62fce7
Add skeleton for the new package
sloriot Sep 17, 2019
7536622
Substitute logo
anusser Sep 17, 2019
d56e0a2
Fix Marvin's surname in several files
anusser Sep 17, 2019
8fee65a
Make test include Frechet_distance.h and make it compile.
anusser Sep 17, 2019
dc9a659
Add NOTES file which should only be for local repo.
anusser Sep 18, 2019
1d34d83
Add code snippet to NOTES.
anusser Sep 18, 2019
7d1285a
Wrap CGAL package around our implementation. Test succeeds.
anusser Sep 18, 2019
3d82bbe
Changed Frechet::getInterval to only take integral indices on curves
Sep 19, 2019
b86ce45
Hacky and untested, but intersection code encapsulated
Sep 23, 2019
69aedb9
Add semi-ready test.
anusser Sep 24, 2019
0c659ae
Simplify test code and add NOTE.
anusser Sep 24, 2019
f868aa5
Fix tests and add actual sigspatial queries.
anusser Sep 24, 2019
d499724
Fix tests (tested with Marvin's commits reverted).
anusser Sep 24, 2019
3ea0c96
Add content of OV query file.
anusser Sep 24, 2019
c62a9fb
Fix bug and make tests work.
anusser Sep 24, 2019
088a078
Small clean up of dummy_test.cpp
anusser Sep 25, 2019
c52ca15
Minor clean-up in Frechet_distance.h
anusser Sep 25, 2019
e53c869
Add very wip-ish near neighbors query class.
anusser Sep 26, 2019
8bd28ca
Move kd tree to own file and make it compile with desired structure.
anusser Sep 26, 2019
ff10eb3
Another wip commit for the near neighbors search.
anusser Sep 26, 2019
6e87378
Query DS is now working including tests. Clean-up etc. still necessary.
anusser Sep 30, 2019
5fdc4cc
Clean-up of Fréchet NNs data structure.
anusser Oct 1, 2019
60fcb5e
Use "= default" syntax for back_insert_it.
anusser Oct 1, 2019
4ab63f0
Further clean-up of Fréchet DS and add batch reporting for kd-tree.
anusser Oct 1, 2019
be3e40a
Add PolylineTraits_2 class.
anusser Oct 2, 2019
55ddcef
Make intersection into predicate. This commit introduces a segfault!
anusser Nov 2, 2019
0277586
Fix segfault introduced in last commit.
anusser Nov 2, 2019
11e00cd
add TODO
anusser Nov 2, 2019
211e9e3
Add CGAL-like squared distance comparison to predicates.
anusser Nov 4, 2019
78481f3
Continue CGALization
anusser Nov 4, 2019
1d9c677
Copy predicates to _old files.
anusser Apr 5, 2023
274841b
Add some comments and notes.
anusser Apr 14, 2023
821f384
Add first draft of Polyline_d class.
anusser May 23, 2023
4adf5ba
Some comments after call with Marvin.
anusser Jun 2, 2023
f8524ad
Re-insert outer interval as we need it for robustness of our old code.
Jan 17, 2024
81930a9
Fix tests and compilation errors.
Jan 17, 2024
9a9dde4
Small changes after meeting with Andreas.
Jan 17, 2024
ac4f8d6
Pass after another rough review.
Jan 19, 2024
c56a57d
Take out near neighbor code in tests to reduce errors.
Jan 19, 2024
7bd03fe
Switched partly to CGAL::Point_2.
Jan 19, 2024
d1eb0fe
Switch out distance computation with CGAL::squared_distance.
Jan 19, 2024
fc6e599
Clean up.
Jan 19, 2024
28d44e2
A version that passes the tests with CPoint having CORE::Expr type.
Jan 23, 2024
51fabfb
Change directory in test such that it can be run from build.
Feb 21, 2024
b353bd5
Version that works with Sqrt_ext and Rational but very slow
Feb 21, 2024
f149567
Add brief license information to the SIGSPATIAL data.
Feb 22, 2024
2484d3a
Fix authors and add license headers.
Feb 22, 2024
ad109d2
Various fixes so that it compiles with VC++
afabri Feb 22, 2024
e95f95a
WIP failing on some curves, that avoids Rational
afabri Feb 27, 2024
de15373
Passes the test. But is it faster ?
afabri Feb 27, 2024
5cdc0bb
Use CGAL::is_one()
afabri Feb 27, 2024
6b8d4c3
bug fix
afabri Feb 27, 2024
757a5be
No need for filtering inside Sqrt_extension
afabri Feb 28, 2024
740e1bc
Remove outer intervals.
Feb 28, 2024
ca940ee
Use optional<Exact>
afabri Feb 28, 2024
52e37e7
replace std::pow(..2)
afabri Feb 28, 2024
028ea93
Big clean-up removing a lot of unused code.
Feb 28, 2024
86c0246
Unify formatting and switch from tabs to spaces using clang-format.
Feb 28, 2024
b972252
Add back the near neighbors code. Tests succeed.
Feb 28, 2024
db42932
Add namespaces
afabri Feb 28, 2024
f3bf44f
Deal with std::min for VC++
afabri Feb 29, 2024
225bb2d
Remove unused types and unused using statements
afabri Mar 1, 2024
72aa1c5
Perform ess arithmetic operations
afabri Mar 1, 2024
80310f1
Subtract instead of adding and finally a negate
afabri Mar 1, 2024
bff699d
>=0 -> ! is_negative
afabri Mar 1, 2024
66c6e7d
Make private and add question about static
afabri Mar 5, 2024
387b496
const&
afabri Mar 5, 2024
efedd28
Add code to avoid link error (why?). Another const&
afabri Mar 5, 2024
1507571
Change nesting of namespaces/directories
afabri Mar 5, 2024
b50d84a
Try to add doc
afabri Mar 5, 2024
b217cc5
protected another accentuated letter
sloriot Mar 5, 2024
7a74638
Add empty docxygen headers to classes
afabri Mar 6, 2024
16295b3
Formatting and single TODO comment.
Mar 6, 2024
111a9e6
Make functions non-static
afabri Mar 6, 2024
95eabff
Make types different from what is in geometry_basics
afabri Mar 7, 2024
d17eb1a
Add comment.
Mar 7, 2024
29e4061
Fixes
afabri Mar 7, 2024
656e1dc
Add commment Uncertain where we have to do the right thing
afabri Mar 7, 2024
827f842
Move the formula comment
afabri Mar 7, 2024
82ed699
Throw in some (hopefully correct) certainly(..)
afabri Mar 7, 2024
1ee0d44
Better message
afabri Mar 7, 2024
834e878
More certainly(), but they must be checked
afabri Mar 7, 2024
2a8edd8
Add data member distance_sqr
afabri Mar 7, 2024
0476c20
const& distance_t
afabri Mar 7, 2024
b99b57b
Add license check
afabri Mar 13, 2024
37eeade
Resolve all Uncertain comments in filter.h (and one in frechet_light.h)
Mar 21, 2024
b82f472
Add some certainly
afabri Mar 21, 2024
c28c26d
Handle some Uncertain cases. Two remaining that are more complicated.
Mar 28, 2024
e00b0df
less arithmetic
afabri Mar 29, 2024
d543109
less arithmetic
afabri Mar 29, 2024
ea0473f
less arithmetic
afabri Mar 29, 2024
9b4c13c
less arithmetic
afabri Mar 29, 2024
ff52323
Use ! is_negative()
afabri Mar 29, 2024
153493c
delay computation as it is potentially not needed
afabri Mar 29, 2024
bb665e1
Use advanced mode of Interval_nt
afabri Mar 29, 2024
cb51392
use ! is_negative()
afabri Apr 3, 2024
25e3b4f
cleanup around Curve. put typedefs in smaller scopes; remove typedefs…
afabri Apr 26, 2024
518240d
cleanup
afabri Apr 26, 2024
960d7f0
Remove debug output
afabri Apr 26, 2024
bcfe532
Reorganize so that in the next step {approximate,exact)_reals can get…
afabri Apr 26, 2024
758692c
Reorganize for Lambda as well
afabri Apr 26, 2024
ec2d780
fix compilation errors and some warnings
sloriot Apr 29, 2024
afaf743
Handle wrong implicit assumptions w.r.t. Uncertain in frechet_light.h.
Apr 29, 2024
04ca89f
Remove unused using
afabri Apr 28, 2024
d869a1d
Templates everywhere (should it better be templated by Curve?)
afabri Apr 30, 2024
171f946
Use is_zero
afabri Apr 30, 2024
258dcb8
Comment unused constructor of Curve
afabri Apr 30, 2024
e4027b0
It now works with Simple_cartesian<double>, Epicl, Epeck
afabri Apr 30, 2024
8d76bb6
Extreme_points -> Bbox
afabri Apr 30, 2024
ab2b254
Centralize types in the Polyline_traits_2
afabri May 1, 2024
7b928fb
Centralize types in the Polyline_traits_2
afabri May 1, 2024
9701cc2
Use Traits::Bbox
afabri May 1, 2024
7f57547
Add Polyline_traits_3 and add comments where we have to fix things
afabri May 1, 2024
45d4dee
Fix compile errors.
May 2, 2024
348a9cb
Back to 2D
afabri May 1, 2024
dc78a17
Change from where data are read to get ready for the testsuite; type…
afabri May 1, 2024
8a550b8
Deal with examples (ha ha)
afabri May 1, 2024
dcf639f
Remove stub of Polyline_d package.
May 2, 2024
d7f4f4d
Make bichromaticFarthestDistance faster and high-dimensional.
May 2, 2024
a7a23ef
Also use K::dimension everywhere in high_level_predicates.h
May 2, 2024
9b18db8
Remove it later. only needed to learn how to determine features
afabri May 15, 2024
210b447
RealType -> Lambda
afabri May 29, 2024
08beeea
cleanup
afabri May 30, 2024
673efd5
Minimize traits class; parameterize with Curve
afabri Jun 4, 2024
a3662eb
Add doxygen
afabri Jun 4, 2024
9196109
rename traits classes
afabri Jun 4, 2024
a4687d4
less #include
afabri Jun 4, 2024
fcb4a1c
Add dD (not working yet)
afabri Jun 5, 2024
ec56c66
Kernel: Add a BBox class with dimension as parameter
afabri Jun 5, 2024
f519646
fixes for clang
afabri Jun 5, 2024
8dc8330
Remove files that were accidentally added
afabri Jun 12, 2024
fec3910
Add nested typedefs as mentioned in Issue #8256
afabri Jun 12, 2024
87f9366
Improve documentation
afabri Jun 14, 2024
d742cfb
merge master
afabri Jun 14, 2024
ca9b25c
rename thumbnail
sloriot Jun 14, 2024
e8d87e5
license identifier
afabri Jun 14, 2024
27cccc8
Copyright also for GF
afabri Jun 14, 2024
2a17b4d
Add concept
afabri Jun 14, 2024
ae74ef6
Fix SPDX-License-Identifier
afabri Jun 14, 2024
5852607
Rename package, remove default for epsilon
afabri Jun 18, 2024
05b8e19
rename concept
afabri Jun 18, 2024
5b7629f
User Manual, rename tags, add example
afabri Jun 18, 2024
c030c3a
Remove .clang-format file
afabri Jun 18, 2024
bfc7695
typo in example
afabri Jun 18, 2024
0ddf866
shorten license
sloriot Jun 18, 2024
1d1f5e9
compile all examples
sloriot Jun 18, 2024
79f5d10
fix project name
sloriot Jun 18, 2024
172b124
add missing example
sloriot Jun 18, 2024
4cde28c
TWS
sloriot Jun 18, 2024
513f9fe
cleanup
afabri Jun 18, 2024
b32db65
Change package title
afabri Jun 18, 2024
c0d7d47
curve -> polyline
afabri Jun 18, 2024
e183ddd
mention Epick
afabri Jun 18, 2024
a68019f
Fix license file
afabri Jun 18, 2024
effc03c
Add to user manual.
Jun 18, 2024
a3f2b33
drop 'continuous_'
afabri Jun 19, 2024
9f2ef30
Fix path to data for the DS test (which compiles and runs without ass…
afabri Jun 19, 2024
64d5a6e
Add test for a minimal traits (WIP)
afabri Jun 19, 2024
c480984
Add teaser image and credits.
Jun 19, 2024
1838916
Another pass over the user manual.
Jun 19, 2024
60e7fae
check if Kernel provides the nested type
sloriot Jun 19, 2024
2c0ba99
add minimal converter
sloriot Jun 19, 2024
f2c51a8
fix compilation issues detected by g++
sloriot Jun 19, 2024
eee97d7
get rid of filtered tag everywhere
sloriot Jun 19, 2024
82c8584
Rename functions
afabri Jun 19, 2024
793b9d7
Rename functions
afabri Jun 19, 2024
5a930c6
try to please msvc
sloriot Jun 19, 2024
d2d84df
fix
afabri Jun 19, 2024
c5c4fcb
missing renaming
sloriot Jun 19, 2024
e33ef39
fix compilation issues
sloriot Jun 19, 2024
7a03762
Fix two typos in the user manual.
Jun 19, 2024
6638dec
Fix +=; Add first tests
afabri Jun 20, 2024
cf6996b
typo in Epick_d doc
afabri Jun 20, 2024
48d734c
typo in Epick_d doc
afabri Jun 20, 2024
4bc2770
Constructor from a range of pairs of numbers
afabri Jun 20, 2024
8ef1f72
Add missing parameter; (std::min)
afabri Jul 16, 2024
f4371f2
Replace function names and address comments of co-authors
afabri Jul 16, 2024
a278b1a
cleanup
afabri Jul 16, 2024
12e7466
tws
afabri Jul 17, 2024
ebf1b37
replace ...
afabri Jul 17, 2024
28d05e6
Add some words regarding the algorithm to the user manual.
Jul 26, 2024
570433d
Protect min/max for VC++
afabri Aug 13, 2024
0c9cb3d
CGAL_assertion ( uses also 'e')
afabri Aug 13, 2024
d162bcd
Merge branch 'master' into Frechet-dev
afabri Aug 14, 2024
b83bcc4
Merge branch 'master' into Kernel_23-Bbox_d-ign
afabri Aug 14, 2024
2b4dfa0
Merge branch 'Kernel_23-Bbox_d-ign' into Frechet-dev
afabri Aug 14, 2024
160cb3e
Fix header file names
afabri Aug 14, 2024
a432d96
Fix header
afabri Aug 14, 2024
0cc387e
Typo in doc
afabri Aug 14, 2024
68ecd6d
WIP for ConstructBbox (also on purpose CamelCase)
afabri Aug 14, 2024
9ade3d2
WIP: after my conversation with myself on github
afabri Aug 14, 2024
61ae325
Fix template parameter
afabri Aug 15, 2024
08389c7
Add include
afabri Aug 15, 2024
fe7c37b
Stumbling forward, but does still not compile
afabri Aug 19, 2024
63dd907
Add top down
afabri Aug 19, 2024
d2b1ea7
use consistent naming
sloriot Aug 19, 2024
6650de8
WIP: apply the functor
afabri Aug 19, 2024
6d11389
got it working for Epick and #if 0 the block with Epeck as WIP
afabri Aug 19, 2024
7133b28
functor is a construction and not a computation
sloriot Aug 22, 2024
7ab31a8
make it compile
sloriot Aug 22, 2024
316ab90
Clean up
mglisse Aug 22, 2024
ab06574
Merge remote-tracking branch 'cgal/master' into Kernel_23-Bbox_d-ign
afabri Sep 9, 2024
33ebf55
Merge remote-tracking branch 'cgal/master' into Frechet-dev
afabri Sep 9, 2024
5bfb293
fix merge conflict
afabri Sep 9, 2024
5138ed7
Fix the Bbox type for dD
afabri Sep 10, 2024
58e269a
Add FT to Cartesian_base_d
afabri Sep 17, 2024
d97a059
WIP for dD
afabri Sep 17, 2024
a928261
Use Kernel_d_interface; Add temporarily typedf void Point_2/3
afabri Sep 17, 2024
e4abda3
Add typedef C2A C2F; Should be unified
afabri Sep 17, 2024
a35518d
Use functor
afabri Sep 17, 2024
de478da
more functors
afabri Sep 17, 2024
5792bcb
Introduce Curve_base<T,dim>
afabri Sep 17, 2024
b03e9a8
remove temporarily added typedefs
afabri Sep 17, 2024
aa13a0d
remove temporarily added typedefs
afabri Sep 17, 2024
972b99b
add construct vector from 2 points
sloriot Sep 18, 2024
bb02ee2
add converter as template parameter
sloriot Sep 18, 2024
f830b5c
Move converters to Curve_base
afabri Sep 18, 2024
44a0be7
CI fixes
afabri Sep 18, 2024
c0fa690
cleanup
afabri Sep 18, 2024
b506547
Simplify if/else
afabri Sep 18, 2024
73240e0
Add a constexpr
afabri Sep 18, 2024
40491bb
Remove a typename. Does that fix the CI ?
afabri Sep 18, 2024
4c669e6
dependencies
afabri Sep 18, 2024
ec543b0
eigen is needed when using NewKernel_d
sloriot Sep 19, 2024
eea3f20
Fix the order of the parameters
afabri Sep 20, 2024
f13279d
As we changed smaller to larger we have to negate when testing agains…
afabri Sep 20, 2024
c440b83
Access points[] only through fct points(int)
afabri Sep 20, 2024
d6b7e36
Towards proper traits classes
afabri Sep 20, 2024
3969958
Add documentation of the concept of the traits class
afabri Sep 20, 2024
b7cc075
Add Get_exact_kernel.h
afabri Sep 20, 2024
7ef1a76
Document kernel converters
afabri Sep 20, 2024
f5ce958
dim -> dimension (CI)
afabri Sep 20, 2024
fca7d67
Only link with Eigen in the dD case
afabri Sep 20, 2024
88d50eb
Fix Doxyfile.in
afabri Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Documentation/doc/Documentation/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
\package_listing{Straight_skeleton_2}
\package_listing{Minkowski_sum_2}
\package_listing{Polyline_simplification_2}
\package_listing{Frechet_distance}
\package_listing{Visibility_2}
\package_listing{Set_movable_separability_2}

Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/scripts/generate_how_to_cite.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def protect_accentuated_letters(authors):
.replace("É", r"{\'E}")
.replace("ä", r"{\"a}")
.replace("ö", r"{\"o}")
.replace("ü", r"{\"u}")
.replace("ñ", r"{\~n}")
.replace("ã", r"{\~a}")
.replace("ë", r"{\"e}")
Expand Down
5 changes: 5 additions & 0 deletions Filtered_kernel/include/CGAL/Lazy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <CGAL/Origin.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/Bbox.h>
#include <CGAL/Default.h>
#include <CGAL/tss.h>
#include <CGAL/type_traits/is_iterator.h>
Expand Down Expand Up @@ -97,6 +98,10 @@ CGAL_LAZY_FORWARD(Bbox_2)
CGAL_LAZY_FORWARD(Bbox_3)
#undef CGAL_LAZY_FORWARD

template<class A, class B> Bbox<A,B> const& approx(Bbox<A,B> const& d) { return d; }
template<class A, class B> Bbox<A,B> const& exact (Bbox<A,B> const& d) { return d; }
template<class A, class B> int depth (Bbox<A,B> const& ) { return 0; }

template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, T> approx(T d){return d;}
template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, T> exact (T d){return d;}
template<class T>inline std::enable_if_t<std::is_arithmetic<T>::value||std::is_enum<T>::value, int> depth(T){return -1;}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*!
\ingroup PkgFrechetDistanceConcepts
\cgalConcept

The concept `FrechetDistanceTraits` defines the requirements of the
first template parameter of the functions `CGAL::is_Frechet_distance_larger()`
and `CGAL::approximate_Frechet_distance()`.


\cgalHasModelsBegin
\cgalHasModels{CGAL::Frechet_distance_traits_2}
\cgalHasModels{CGAL::Frechet_distance_traits_3}
\cgalHasModels{CGAL::Frechet_distance_traits_d}
\cgalHasModelsEnd
*/

class FrechetDistanceTraits {

public:
/*! a fixed dimension >= 2 */
const int dimension;

/*! must be `true` if `Kernel` has a nested type `Has_filtered_predicates_tag` with `value == true`
*/
static constexpr bool is_filtered = unspecified;

/*! Must be `true` if the number type of `Kernel` is a floating point number type*/
static constexpr bool is_floating_point = unspecified;
/// \name Types
/// @{

/*! The kernel type. If this type has a nested type `Has_filtered_predicates_tag` with `value == true`,
*/
using Kernel = unspecified;

/*! The point type of `Kernel` corresponding to `dimension`
*/
using Point = unspecified_type;

/*! The number type of the filtered kernel.
*/
using distance_t = Filtered_kernel::FT;

/*! The filtered kernel
*/
using Filtered_kernel = unspecified_type;


/*! The point type of the filtered kernel corresponding to `dimension`.
*/
using Filtered_point = unspecified_type;

/*! A functor of the filtered kernel for filtered points
*/
using Construct_bbox = unspecified_type;

/*! A functor of the filtered kernel for two filtered points
*/
using Squared_distance = unspecified_type;


/*! A functor of the filtered kernel for two filtered points
*/
using Difference_of_points = unspecified_type;


/*! A functor of the filtered kernel the return type of `Difference_of_points`
*/
using Scaled_vector = unspecified_type;


/*! A functor of the filtered kernel the return type of `Scaled_vector`
*/
using Translated_point = unspecified_type;

/*! The exact kernel
*/
using Exact_kernel = unspecified_type;

/*! The point type of the exact kernel corresponding to `dimension`.
The point type must have `operator[]` returning a number type which can be used as first template parameter of `Sqrt_extension`.
*/
using Exact_point = unspecified_type;

/*! A converter for points from `Kernel` to `Filtered_kernel`
*/
using K2F = unspecified_type;


/*! A converter for points from `Filtered_kernel` to `Exact_kernel`
*/
using F2E = unspecified_type;
/// @}
};
3 changes: 3 additions & 0 deletions Frechet_distance/doc/Frechet_distance/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS}

PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - dD Frechet Distance"
84 changes: 84 additions & 0 deletions Frechet_distance/doc/Frechet_distance/Frechet_distance.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
namespace CGAL {
/*!

\mainpage User Manual
\anchor Chapter_dD_Frechet_distance

\cgalAutoToc
\authors André Nusser, Marvin Künnemann, and Karl Bringmann


<center>
<img src="FrechetTeaser.png" style="max-width:30%;"/>
</center>

This package provides functions for computing the Fréchet distance of polylines in any dimension under the Euclidean metric.

\section secFrechetDistanceIntroduction Introdution

The Fréchet distance is a classical dissimilarity measure between polylines.
Its advantages over other measures is that it both considers the polylines as continuous objects and takes into account the ordering of the points.
Intuitively, the Fréchet distance is commonly explained as follows: Imagine a human walking on one polyline while a dog walks on the other polyline, they are connected by a leash, and they are only allowed to walk forward. The Fréchet distance is the shortest leash length that allows the human and the dog to jointly walk from start to end on their respective trajectories.


<!--
\cgalFigureBegin{figRefId,pdist-pkg-small.png}
Here you can put the caption
\cgalFigureEnd
-->

The Fréchet distance is a metric. This implies that two polylines have distance zero if and only if they are equal (after removing redundant vertices).

\section secFrechetDistanceAPI API

The package provides one function to approximate the Fréchet distance and one function to decide whether the Fréchet distance is at most a given value.

The function `approximate_Frechet_distance()` computes an approximation of the Fréchet distance between two polylines, up to a given approximation error. It returns an interval that contains the true distance.
The function `is_Frechet_distance_larger()` decides if the Fréchet distance
between two polylines is larger than a given bound.

Both functions have as template parameter a traits class defining the dimension and the point type.
The traits classes have as template parameter a kernel. This may be a kernel such as `Simple_cartesian`
with a floating point number type, or a filtered kernel such as `Exact_predicates_inexact_constructions_kernel`.
In both cases the result is guaranteed to be correct.


\section secFrechetDistanceImplementation Implementation

Internally all computations are done using interval arithmetic. In case of filter failures
the algorithm switches to the usage of square root extensions.

The algorithms in this package are an adaption of the implementation of a <a href="https://doi.org/10.4230/LIPIcs.SoCG.2019.17">SoCG</a>/<a href="https://doi.org/10.20382/jocg.v12i1a4">JoCG</a> paper. 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 distance algorithm by Alt and Godau. This is achieved by using fast filtering methods and a divide and conquer algorithm with pruning rules on the free-space diagram.


\section secFrechetDistanceExamples Examples

In the examples we use different kernels to illustrate that the functions
work as well for inexact or exact kernels.

\subsection subsecFrechetDistanceFirstExample Decision for 2D Polylines

The following example shows how we can use `is_Frechet_distance_larger()` to decide whether the Fréchet distance between two polylines in the Euclidean plane is at most a given value.

\cgalExample{Frechet_distance/Frechet_distance_2.cpp}

\subsection subsecFrechetDistanceSecondExample Distance Computation for 3D Polylines

The following example shows how we can compute the Fréchet distance up to a given precision on two polylines in 3-dimensional Euclidean space using `approximate_Frechet_distance()`.

\cgalExample{Frechet_distance/Frechet_distance_3.cpp}


\subsection subsecFrechetDistanceImageCredits Image Credits

The teaser image is a visualization of two data points from the <a href="https://archive.ics.uci.edu/dataset/175/character+trajectories">Character Trajectories</a> data set.

\subsection subsecFrechetDistanceImplementation Implementation History

An initial version using floating point arithmetic was developed by the authors
while working at the Max Planck Institute for Informatics in Saarbrücken, Germany.
André Nusser, together with Sebastien Loriot and Andreas Fabri, introduced
the usage of interval arithmetic and square root extensions to alleviate issues stemming from rounding errors and hence ensuring correctness of the computation.

*/
} /* namespace CGAL */
44 changes: 44 additions & 0 deletions Frechet_distance/doc/Frechet_distance/PackageDescription.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/// \defgroup PkgFrechetDistanceRef dD Frechet Distance Reference
/// \defgroup PkgFrechetDistanceConcepts Concepts
/// \ingroup PkgFrechetDistanceRef
/// \defgroup PkgFrechetDistanceFunctions Functions
/// You can add some text here if you want a description at the group level
/// \ingroup PkgFrechetDistanceRef


/*!
\addtogroup PkgFrechetDistanceRef

\cgalPkgDescriptionBegin{dD Frechet Distance,PkgFrechetDistance}
\cgalPkgPicture{pdist-pkg-small.png}

\cgalPkgSummaryBegin
\cgalPkgAuthors{André Nusser, Marvin Künnemann, and Karl Bringmann}
\cgalPkgDesc{This package provides functions for computing the Fréchet distance of polylines in any dimension under the Euclidean metric.}
\cgalPkgManuals{Chapter_dD_Frechet_distance,PkgFrechetDistanceRef}
\cgalPkgSummaryEnd

\cgalPkgShortInfoBegin
\cgalPkgSince{6.1}
\cgalPkgBib{cgal:nkb-fd}
\cgalPkgLicense{\ref licensesGPL "GPL"}
\cgalPkgShortInfoEnd

\cgalPkgDescriptionEnd

This package provides functions for computing the Fréchet distance of polylines in any dimension under the Euclidean metric.

\cgalClassifedRefPages

\cgalCRPSection{Concepts}
- `FrechetDistanceTraits`

\cgalCRPSection{Classes}
- `CGAL::Frechet_distance_traits_2`
- `CGAL::Frechet_distance_traits_3`
- `CGAL::Frechet_distance_traits_d`

\cgalCRPSection{Functions}
- `CGAL::approximate_Frechet_distance()`
- `CGAL::is_Frechet_distance_larger()`
*/
6 changes: 6 additions & 0 deletions Frechet_distance/doc/Frechet_distance/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Manual
Kernel_23
STL_Extension
Algebraic_foundations
Circulator
Stream_support
4 changes: 4 additions & 0 deletions Frechet_distance/doc/Frechet_distance/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*!
\example Frechet_distance/Frechet_distance_2.cpp
\example Frechet_distance/Frechet_distance_3.cpp
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions Frechet_distance/examples/Frechet_distance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.

cmake_minimum_required(VERSION 3.1...3.14)
project( Frechet_distance_Examples )

find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )


find_package(Eigen3 3.1.0 QUIET) #(requires 3.1.0 or greater)
include(CGAL_Eigen3_support)

create_single_source_cgal_program( "Frechet_distance_2.cpp" )
create_single_source_cgal_program( "Frechet_distance_3.cpp" )
create_single_source_cgal_program( "Has_filtered_predicates.cpp" )

if(TARGET CGAL::Eigen3_support)
create_single_source_cgal_program( "Frechet_distance_d.cpp" )
target_link_libraries(Frechet_distance_d PUBLIC CGAL::Eigen3_support)
endif()
17 changes: 17 additions & 0 deletions Frechet_distance/examples/Frechet_distance/Frechet_distance_2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <ostream>

using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Traits = CGAL::Frechet_distance_traits_2<Kernel>;
using Point = Traits::Point;

int main(int argc, char* argv[])
{
std::vector<Point> A, B;
bool res = CGAL::is_Frechet_distance_larger<Traits>(A, B, 0.001);
std::cout << std::boolalpha << res << std::endl;
return 0;
}
17 changes: 17 additions & 0 deletions Frechet_distance/examples/Frechet_distance/Frechet_distance_3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_3.h>
#include <CGAL/Simple_cartesian.h>

#include <ostream>

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

int main(int argc, char* argv[])
{
std::vector<Point> A, B;
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;
}
17 changes: 17 additions & 0 deletions Frechet_distance/examples/Frechet_distance/Frechet_distance_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_d.h>
#include <CGAL/Epick_d.h>

#include <iostream>
#include <vector>

using Kernel = CGAL::Epick_d<CGAL::Dimension_tag<4>>;
using Traits = CGAL::Frechet_distance_traits_d<Kernel>;
using Point = Traits::Point;

int main(int argc, char* argv[])
{
std::vector<Point> A, B;
bool res = CGAL::is_Frechet_distance_larger<Traits>(A, B, 0.001);
return 0;
}
Loading