Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
6e512196
Commit
6e512196
authored
Jul 22, 2021
by
Timo Koch
Committed by
Kilian Weishaupt
Jul 22, 2021
Browse files
[distance] Precompute distance p->a
parent
8bb64a6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/geometry/distance.hh
View file @
6e512196
...
@@ -84,10 +84,11 @@ inline typename Point::value_type
...
@@ -84,10 +84,11 @@ inline typename Point::value_type
distancePointSegment
(
const
Point
&
p
,
const
Point
&
a
,
const
Point
&
b
)
distancePointSegment
(
const
Point
&
p
,
const
Point
&
a
,
const
Point
&
b
)
{
{
const
auto
ab
=
b
-
a
;
const
auto
ab
=
b
-
a
;
auto
t
=
(
p
-
a
)
*
ab
;
const
auto
ap
=
p
-
a
;
const
auto
t
=
ap
*
ab
;
if
(
t
<=
0.0
)
if
(
t
<=
0.0
)
return
(
a
-
p
)
.
two_norm
();
return
ap
.
two_norm
();
const
auto
lengthSq
=
ab
.
two_norm2
();
const
auto
lengthSq
=
ab
.
two_norm2
();
if
(
t
>=
lengthSq
)
if
(
t
>=
lengthSq
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment