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 362 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
362 commits
Select commit Hold shift + click to select a range
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
5b48a3c
Filtered_ -> Approximate_
afabri Oct 22, 2024
d65b689
more renaming
afabri Oct 22, 2024
46c0353
fix warnings
sloriot Oct 25, 2024
784ea58
add copy/init from the same type but with the opposite caching strategy
sloriot Oct 25, 2024
48dfdb4
factorize implementation
sloriot Oct 25, 2024
6c9d514
WIP
sloriot Oct 30, 2024
fb689fa
still WIP
sloriot Oct 30, 2024
28db6f3
factorize curve
sloriot Oct 31, 2024
95d810f
start following the concept
sloriot Oct 31, 2024
48b204b
compilation errors
sloriot Oct 31, 2024
e76b975
make it work with SC<ER>
sloriot Oct 31, 2024
6c3b548
always use Interval for prefix_length as it is used in filters
sloriot Nov 6, 2024
7f8d80a
remove sqrt
sloriot Nov 7, 2024
f216e31
doc fixes
sloriot Nov 5, 2024
7f0a121
using functor to iterator over coordinates
sloriot Nov 5, 2024
107ed0f
remove useless abs
sloriot Nov 7, 2024
aa009bc
do not use interval for SC<double>
sloriot Nov 7, 2024
9945425
use traits object functions
sloriot Nov 7, 2024
f0ef1af
avoid exception
sloriot Nov 7, 2024
a13d326
fix EPICK implementation
sloriot Nov 7, 2024
e3458be
missing return type
sloriot Nov 7, 2024
a173749
test all kernels
sloriot Nov 7, 2024
a1cd361
conditional testing
sloriot Nov 7, 2024
e1f5a1b
no need to construct points
sloriot Nov 7, 2024
c2d7402
add filtering for EPECK too
sloriot Nov 14, 2024
b3f420e
add filtering also for Kernel with no filtering
sloriot Nov 14, 2024
5bb5aa9
enable filtering with exact nt with custom traits
sloriot Nov 14, 2024
759fc87
enable filtering for Epick_d
sloriot Nov 14, 2024
0b6b64a
do not change the rounding mode since protector is already created be…
sloriot Nov 15, 2024
efc600e
Merge remote-tracking branch 'cgal/master'
sloriot Nov 15, 2024
d61a3e3
Merge pull request #8611 from sloriot/NT-sqrt_rounding
sloriot Nov 15, 2024
090154d
fix copy/paste issues
sloriot Nov 15, 2024
9a0dd64
clean up
sloriot Nov 15, 2024
6b66736
Fix include for header checks
afabri Nov 16, 2024
b4b3839
Fix dependencies
afabri Nov 16, 2024
a5c694a
fix detection of filtering
sloriot Nov 20, 2024
c00cfed
revert commit d61a3e302d30a6a2a59f20fbab6481a4d01f7d61
sloriot Nov 20, 2024
d2b5e49
Add data for 2D example
afabri Nov 29, 2024
e6eee99
Add data for 3D example
afabri Nov 29, 2024
169df3e
Add two curves to dD examples (we get an assertion)
afabri Dec 6, 2024
53b4c54
uint -> int
sloriot Dec 6, 2024
8931788
more similar curves
afabri Dec 9, 2024
344e4d0
more similar curves
afabri Dec 9, 2024
757f9cd
Assertion if two points are equal
afabri Dec 9, 2024
dd12609
Merge remote-tracking branch 'cgal/master' into Frechet-dev
afabri Dec 9, 2024
b185e16
Add to Changes.md
afabri Dec 9, 2024
7d2b382
Add to Changes.md
afabri Dec 9, 2024
bfe15ae
Add accents
afabri Dec 9, 2024
819e3cf
Add dD example to User Manual
afabri Dec 9, 2024
cbaf3ff
fix anchor
afabri Dec 9, 2024
20bf574
Make sure that we round up in length_of_diagonl()
afabri Dec 9, 2024
e635dec
Add bibtex entry and \cite
afabri Dec 9, 2024
55a3cb5
cleanup
afabri Dec 9, 2024
ddbfcd0
Fix for two identical points. Must be checked with André
afabri Dec 9, 2024
bc3b8db
cleanup
afabri Dec 9, 2024
c8303ae
Prefix bbox types with CGAL::
afabri Dec 9, 2024
7370c94
Revive Frechet_distance_traits.h
afabri Dec 9, 2024
32bef86
Use using in concept
afabri Dec 9, 2024
1a50163
Add classical Alt-Godau Fréchet distance algorithm.
Nov 18, 2024
354786b
WIP: High-dimensional test data creation.
Dec 11, 2024
01e0ab4
Compare fraction instead of id
afabri Dec 11, 2024
3679240
Deal with argc/argv and cleanup
afabri Dec 11, 2024
e279087
untabify
afabri Dec 11, 2024
8ba4e79
clean
afabri Dec 11, 2024
58964ea
fix cmake version
sloriot Dec 11, 2024
fd71a1d
remove example not existing
sloriot Dec 11, 2024
894e742
Fix compile errors.
Dec 11, 2024
dad0b48
Fix bug in the naive Frechet distance algorithm.
Dec 11, 2024
1b1cec4
Clean up Frechet_naive.h
Dec 11, 2024
a3071ba
Clean up and rename classical (prev. "naive") Fréchet algorithm code.
Dec 12, 2024
00c7054
Create goal directed test curves in 3d and 100d.
Dec 12, 2024
21e3a7c
WIP: Add script for query creation and Compute_classical_Frechet_dist…
Dec 12, 2024
23bf4ae
Use Epick_d
afabri Dec 12, 2024
67b2c76
Fix trailing whitespace on generated curves.
Dec 12, 2024
a0abc11
argv[2]
afabri Dec 12, 2024
10e45a7
Fix point format in curve creation and make it deterministic.
Dec 12, 2024
7e8cc90
WIP: Tests for 3 and 100 dimensional data.
Dec 12, 2024
bba4215
Remove TODO.
Dec 12, 2024
6c16278
Remove trailing whitespace.
Dec 12, 2024
3fa7c47
Add functions to class Bbox as they are in Bbox_3
afabri Dec 12, 2024
0ee04ba
Fix in Bbox.h
afabri Dec 13, 2024
f044e4e
read_WKT does not return correct value when opened in binary mode
afabri Dec 13, 2024
7a79cd6
WIP: Add example for closest curve search structure.
afabri Dec 13, 2024
c396a9a
Add converter to wkt format
afabri Dec 13, 2024
a8f8a3e
Fix dilate
afabri Dec 13, 2024
6360f72
Add forcing filtering
afabri Dec 13, 2024
27cf9e7
Fix dimension of FrechetKdTree
afabri Dec 16, 2024
a6eaec0
use cite macro
sloriot Dec 16, 2024
79ecd1b
Make Frechet_distance_test work also for 100-dimensional cases.
Dec 16, 2024
0311b1c
Add some comments after talking to AF.
Dec 16, 2024
23c79d8
Fix for example Spatial_searching_2user_defined_point_and_distance.cpp
afabri Dec 16, 2024
e7e80e5
Use variable
afabri Dec 17, 2024
9b8be5e
Add Cartesian_const_iterator to Bbox
afabri Dec 17, 2024
fc120de
Add Cartesian_const_iterator to Bbox
afabri Dec 17, 2024
bef9494
Missed one this-> :<
afabri Dec 18, 2024
a14fad4
Add constructor from Bbox_2/3
afabri Dec 18, 2024
f37c588
Add operator+(int) and operator-(other)
afabri Dec 18, 2024
e70b88f
Add Compute_squared_distance to traits (todo document in concept, and…
afabri Dec 18, 2024
279a411
WIP: Towards dimension independent FrechetDS
afabri Dec 18, 2024
92aa6c6
WIP before meeting
afabri Dec 18, 2024
2bbb7b2
Implement box in sphere test
afabri Dec 18, 2024
19f8b9c
Address some review points
afabri Dec 19, 2024
201f658
Address some review points
afabri Dec 19, 2024
10be823
Address some review points
afabri Dec 19, 2024
be5bfc2
Address some review points
afabri Dec 20, 2024
e75f05d
also test double + filter
sloriot Dec 20, 2024
45f9985
add missing operator
sloriot Dec 20, 2024
e819ac8
hide force filtering and the traits in NP
sloriot Dec 20, 2024
ef6a2b4
Address some review points
afabri Dec 20, 2024
756fe01
Address some review points
afabri Dec 20, 2024
81488c0
possible solution for default traits
sloriot Dec 20, 2024
c51fac5
advance the iterator
afabri Dec 27, 2024
3189228
Test Cartesian_const_iterator with Concatenate_iterator
afabri Dec 27, 2024
3699067
Fix construction of end iterator
afabri Dec 27, 2024
3273aed
set bound so that some curves ARE closer
afabri Dec 27, 2024
06e6ffa
whitespace
afabri Dec 27, 2024
85c7348
precision -> error_bound
afabri Dec 27, 2024
315668b
Move header to internal
afabri Dec 27, 2024
b03a73e
Remove _ from namespace
afabri Dec 27, 2024
067b6e5
Rename to CGAL::Frechet_distance::Neighbor_search
afabri Dec 27, 2024
1ade912
Document class
afabri Dec 27, 2024
6f86527
rename function
afabri Dec 29, 2024
fa8bec9
Adress errors/warnings in testsuite
afabri Jan 1, 2025
8926fab
Deal with empty curves
afabri Jan 2, 2025
7ecd0ad
fix max
afabri Jan 2, 2025
890b631
Adress warnings/errors with VC++
afabri Jan 3, 2025
99c9193
disambiguate =
sloriot Jan 3, 2025
63214f4
remove debug
sloriot Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Frechet_distance.h>
#include <CGAL/IO/WKT.h>

#include <ostream>
#include <fstream>

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

int main(int argc, char* argv[])
{
Expand All @@ -21,7 +19,7 @@ int main(int argc, char* argv[])
std::ifstream in((argc > 1) ? argv[2] : CGAL::data_file_path("wkt/LetterAbis.wkt"));
CGAL::IO::read_linestring_WKT(in, B);
}
bool res = CGAL::is_Frechet_distance_larger<Traits>(A, B, 0.001);
bool res = CGAL::is_Frechet_distance_larger(A, B, 0.001);
std::cout << std::boolalpha << res << std::endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_3.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/IO/WKT.h>

#include <ostream>
#include <fstream>

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

int main(int argc, char* argv[])
{
Expand All @@ -22,7 +20,7 @@ int main(int argc, char* argv[])
CGAL::IO::read_linestring_WKT(in, B);
}

std::pair<double, double> res = CGAL::approximate_Frechet_distance<Traits>(A, B, 0.000001);
std::pair<double, double> res = CGAL::approximate_Frechet_distance(A, B, 0.000001);
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#include <CGAL/Epick_d.h>
#include <CGAL/Frechet_distance.h>
#include <CGAL/Frechet_distance_traits_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_d;
using Point = Kernel::Point_d;

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> B = { 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::approximate_Frechet_distance<Traits>(A, B, 0.000001);
std::pair<double, double> res = CGAL::approximate_Frechet_distance(A, B, 0.000001);
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
return 0;
}
82 changes: 74 additions & 8 deletions Frechet_distance/include/CGAL/Frechet_distance.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <CGAL/license/Frechet_distance.h>
#include <CGAL/basic.h>
#include <CGAL/Frechet_distance/internal/Frechet_distance.h>
#include <CGAL/Dimension.h>

#include <CGAL/Named_function_parameters.h>

Expand All @@ -27,6 +28,61 @@
namespace CGAL
{

#ifdef CGAL_EIGEN3_ENABLED
template<class Dim> struct Epick_d;
template<class Dim> struct Epeck_d;

template < typename P, int D>
struct Ambient_dimension<P, Epick_d<Dimension_tag<D>>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that go into Epick_d.h @sloriot ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could add a template Ambient_dimension inside the class Kernel_d_interface that says everything has Base::Dimension as ambient dim, since that's what CGAL::Ambient_dimension looks for by default.

{
static constexpr int value = D;
};

template < typename P, int D>
struct Ambient_dimension<P, Epeck_d<Dimension_tag<D>>>
{
static constexpr int value = D;
};
#endif

namespace internal
{
template <typename P,
int Dimension = ::CGAL::Ambient_dimension<P>::value >
struct Get_default_traits_base
#ifdef CGAL_EIGEN3_ENABLED
{
using type = Frechet_distance_traits_d<typename Kernel_traits<P>::Kernel>;
};
#else
;
#endif

template <typename P>
struct Get_default_traits_base<P, 2>
{
using type = Frechet_distance_traits_2<typename Kernel_traits<P>::Kernel>;
};

template <typename P>
struct Get_default_traits_base<P, 3>
{
using type = Frechet_distance_traits_3<typename Kernel_traits<P>::Kernel>;
};

template <class P, class K=typename Kernel_traits<P>::Kernel>
struct Get_default_traits
{
using type = typename Get_default_traits_base<P>::type;
};

template <class P>
struct Get_default_traits<P, ::CGAL::internal_kernel_traits::Dummy_kernel<P>>
{
using type = ::CGAL::internal_kernel_traits::Dummy_kernel<P>;
};
} // end of internal namespace

/**
* \ingroup PkgFrechetDistanceFunctions
* determines if the Frechet distance between two polylines is larger than a given distance bound.
Expand All @@ -43,14 +99,14 @@ namespace CGAL
* \cgalNamedParamsBegin
* \cgalParamNBegin{geom_traits}
* \cgalParamDescription{an instance of a geometric traits class}
* \cgalParamType{Traits}
* \cgalParamDefault{`Traits()`}
* \cgalParamType{a model of `FrechetDistanceTraits`}
* \cgalParamDefault{`Frechet_distance_traits_2`, `Frechet_distance_traits_3`, or`Frechet_distance_traits_d`, depending on the dimension of the point type.}
* \cgalParamNEnd
* \cgalNamedParamsEnd
*
* \pre the polylines must not be empty
*/
template <class Traits, class PointRange, class NamedParameters = parameters::Default_named_parameters>
template <class PointRange, class NamedParameters = parameters::Default_named_parameters>
bool is_Frechet_distance_larger(const PointRange& polyline1,
const PointRange& polyline2,
const double distance_bound,
Expand All @@ -59,6 +115,11 @@ bool is_Frechet_distance_larger(const PointRange& polyline1,
constexpr bool force_filtering =
internal_np::Lookup_named_param_def<internal_np::force_filtering_t, NamedParameters, std::false_type>::type::value;

using Point_d = std::remove_cv_t<std::remove_reference_t<decltype(*polyline1.begin())>>;
using Default_traits = typename internal::Get_default_traits<Point_d>::type;
using Traits = typename internal_np::Lookup_named_param_def<internal_np::geom_traits_t,
NamedParameters,
Default_traits>::type;
Traits traits = parameters::choose_parameter<Traits>(
parameters::get_parameter(np, internal_np::geom_traits));

Expand Down Expand Up @@ -92,8 +153,8 @@ bool is_Frechet_distance_larger(const PointRange& polyline1,
* \cgalNamedParamsBegin
* \cgalParamNBegin{geom_traits}
* \cgalParamDescription{an instance of a geometric traits class}
* \cgalParamType{Traits}
* \cgalParamDefault{`Traits()`}
* \cgalParamType{a model of `FrechetDistanceTraits`}
* \cgalParamDefault{`Frechet_distance_traits_2`, `Frechet_distance_traits_3`, or`Frechet_distance_traits_d`, depending on the dimension of the point type.}
* \cgalParamNEnd
* \cgalNamedParamsEnd
*
Expand All @@ -102,7 +163,7 @@ bool is_Frechet_distance_larger(const PointRange& polyline1,
* @return an interval enclosing the exact result, the difference between the upper and
* the lower bound being less than `precision`.
*/
template <class Traits, class PointRange, class NamedParameters = parameters::Default_named_parameters>
template <class PointRange, class NamedParameters = parameters::Default_named_parameters>
std::pair<double,double> approximate_Frechet_distance(const PointRange& polyline1,
const PointRange& polyline2,
const double precision,
Expand All @@ -111,9 +172,14 @@ std::pair<double,double> approximate_Frechet_distance(const PointRange& polyline
constexpr bool force_filtering =
internal_np::Lookup_named_param_def<internal_np::force_filtering_t, NamedParameters, std::false_type>::type::value;

Traits traits = parameters::choose_parameter<Traits>(
parameters::get_parameter(np, internal_np::geom_traits));
using Point_d = std::remove_cv_t<std::remove_reference_t<decltype(*polyline1.begin())>>;
using Default_traits = typename internal::Get_default_traits<Point_d>::type;
using Traits = typename internal_np::Lookup_named_param_def<internal_np::geom_traits_t,
NamedParameters,
Default_traits>::type;

Traits traits = parameters::choose_parameter<Traits>(
parameters::get_parameter(np, internal_np::geom_traits));

constexpr bool filtered = force_filtering ||
std::is_same_v<typename decltype(Frechet_distance_::internal::toCurve<force_filtering>(polyline1, traits))::IFT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ auto FrechetDistanceNearNeighborsDS<PointRange, Traits>::get_close_curves(

auto predicate = [&](PolylineID id) {
CGAL_assertion(id < curves.size());
return is_Frechet_distance_larger<Traits>(
curve, curves[id], distance);
return is_Frechet_distance_larger(
curve, curves[id], distance, parameters::geom_traits(Traits()));
};
auto new_end = std::remove_if(result.begin(), result.end(), predicate);
result.erase(new_end, result.end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ int main()
{
using Traits = MinimalFrechetTraits<double>;
std::vector<Traits::Point_d> curve;
/* bool decision = */ CGAL::is_Frechet_distance_larger<Traits>(curve, curve, 0.1, params::force_filtering(std::true_type()));
/* bool decision = */ CGAL::is_Frechet_distance_larger(
curve, curve, 0.1, params::force_filtering(std::true_type())
.geom_traits(Traits()));
}

{
using Traits = MinimalFrechetTraits<CGAL::Exact_rational>;
std::vector<Traits::Point_d> curve;
/* bool decision = */ CGAL::is_Frechet_distance_larger<Traits>(curve, curve, 0.1, params::force_filtering(std::true_type()));
/* bool decision = */ CGAL::is_Frechet_distance_larger(
curve, curve, 0.1, params::force_filtering(std::true_type())
.geom_traits(Traits()));
}



return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ static double testFrechetDistance()
*/
timer.start();
auto decision =
! CGAL::is_Frechet_distance_larger<TestTraits>(
! CGAL::is_Frechet_distance_larger(
curves[query.id1], curves[query.id2], query.distance,
params::force_filtering(std::bool_constant<force_filtering>()));
params::force_filtering(std::bool_constant<force_filtering>())
.geom_traits(TestTraits()));
timer.stop();

if (decision != query.decision) {
Expand Down
Loading