Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
04ad4deb
Commit
04ad4deb
authored
11 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
hopla
parent
feae43c6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Numeric/discreteFrechetDistance.cpp
+48
-0
48 additions, 0 deletions
Numeric/discreteFrechetDistance.cpp
Numeric/discreteFrechetDistance.h
+7
-0
7 additions, 0 deletions
Numeric/discreteFrechetDistance.h
with
55 additions
and
0 deletions
Numeric/discreteFrechetDistance.cpp
0 → 100644
+
48
−
0
View file @
04ad4deb
#include
"discreteFrechetDistance.h"
#include
"fullMatrix.h"
static
double
distance
(
const
SPoint3
&
p1
,
const
SPoint3
&
p2
){
return
p1
.
distance
(
p2
);
}
static
double
c
(
int
i
,
int
j
,
fullMatrix
<
double
>
&
CA
,
const
std
::
vector
<
SPoint3
>
&
P
,
const
std
::
vector
<
SPoint3
>
&
Q
)
{
double
CAij
;
if
(
CA
(
i
,
j
)
>-
1
){
CAij
=
CA
(
i
,
j
);
}
else
if
(
i
==
0
&&
j
==
0
){
CA
(
i
,
j
)
=
distance
(
P
[
0
],
Q
[
0
]);
// update the CA permanent
CAij
=
CA
(
i
,
j
);
// set the current relevant value
}
else
if
(
i
>
0
&&
j
==
0
){
CA
(
i
,
j
)
=
std
::
max
(
c
(
i
-
1
,
0
,
CA
,
P
,
Q
),
distance
(
P
[
i
],
Q
[
1
])
);
CAij
=
CA
(
i
,
j
);
}
else
if
(
i
==
0
&&
j
>
0
){
CA
(
i
,
j
)
=
std
::
max
(
c
(
0
,
j
-
1
,
CA
,
P
,
Q
),
distance
(
P
[
0
],
Q
[
j
])
);
CAij
=
CA
(
i
,
j
);
}
else
if
(
i
>
0
&&
j
>
0
){
double
temp
=
std
::
min
(
std
::
min
(
c
(
i
-
1
,
j
,
CA
,
P
,
Q
),
c
(
i
-
1
,
j
-
1
,
CA
,
P
,
Q
)),
c
(
i
,
j
-
1
,
CA
,
P
,
Q
));
CA
(
i
,
j
)
=
std
::
max
(
temp
,
distance
(
P
[
i
],
Q
[
j
]));
CAij
=
CA
(
i
,
j
);
}
else
{
CA
(
i
,
j
)
=
1.e22
;
}
return
CAij
;
}
double
discreteFrechetDistance
(
const
std
::
vector
<
SPoint3
>
&
P
,
const
std
::
vector
<
SPoint3
>
&
Q
){
const
int
sP
=
P
.
size
();
const
int
sQ
=
Q
.
size
();
fullMatrix
<
double
>
CA
(
sP
,
sQ
);
CA
.
setAll
(
-
1.0
);
double
cm
=
c
(
sP
-
1
,
sQ
-
1
,
CA
,
P
,
Q
);
return
cm
;
}
This diff is collapsed.
Click to expand it.
Numeric/discreteFrechetDistance.h
0 → 100644
+
7
−
0
View file @
04ad4deb
#ifndef _DISCRETE_FRECHET_DISTANCE_
#define _DISCRETE_FRECHET_DISTANCE_
#include
<vector>
#include
"SPoint3.h"
double
discreteFrechetDistance
(
const
std
::
vector
<
SPoint3
>
&
P
,
const
std
::
vector
<
SPoint3
>
&
Q
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment