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
501d6a65
Commit
501d6a65
authored
Oct 20, 2021
by
Dennis Gläser
Browse files
[geomisection][1d-1d-3d-point] avoid calls to two_norm()
parent
523915de
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/geometry/geometryintersection.hh
View file @
501d6a65
...
...
@@ -1328,20 +1328,17 @@ public:
const
auto
v2
=
geo2
.
corner
(
1
)
-
geo2
.
corner
(
0
);
const
auto
ac
=
geo2
.
corner
(
0
)
-
geo1
.
corner
(
0
);
const
auto
v1Norm
=
v1
.
two_norm
();
const
auto
eps
=
eps_
*
v1Norm
;
const
auto
eps2
=
eps
*
eps
;
const
auto
eps3
=
eps2
*
eps
;
const
auto
v1Norm2
=
v1
.
two_norm2
();
const
auto
eps2
=
eps_
*
v1Norm2
;
const
auto
n
=
crossProduct
(
v1
,
v2
);
// first check if segments are parallel
using
std
::
abs
;
if
(
n
.
two_norm2
()
<
eps
3
*
v1Norm
)
if
(
n
.
two_norm2
()
<
eps
2
*
v1Norm
2
)
{
// check if they lie on the same line
const
auto
acNorm
=
ac
.
two_norm
();
if
(
abs
(
ac
*
v1
)
<
acNorm
*
v1Norm
)
if
(
crossProduct
(
v1
,
ac
).
two_norm2
()
>
eps2
)
return
false
;
// they lie on the same line,
...
...
@@ -1349,7 +1346,7 @@ public:
const
auto
sp
=
v1
*
v2
;
if
(
sp
<
0.0
)
{
if
(
ac
Norm
<
eps
)
if
(
ac
.
two_norm2
()
<
eps
2
)
{
intersection
=
geo2
.
corner
(
0
);
return
true
;
}
if
(
(
geo2
.
corner
(
1
)
-
geo1
.
corner
(
1
)).
two_norm2
()
<
eps2
)
...
...
@@ -1370,7 +1367,6 @@ public:
// in-plane normal vector on v1
auto
v1Normal
=
crossProduct
(
v1
,
n
);
v1Normal
/=
v1Normal
.
two_norm
();
// intersection point on v2 in local coords
const
auto
t2
=
-
1.0
*
(
ac
*
v1Normal
)
/
(
v2
*
v1Normal
);
...
...
@@ -1380,12 +1376,12 @@ public:
return
false
;
// compute global coordinates
auto
i
s
Point
=
geo2
.
global
(
t2
);
auto
i
ntersection
Point
=
geo2
.
global
(
t2
);
// check if point lies on v1
if
(
intersectsPointGeometry
(
i
s
Point
,
geo1
))
if
(
intersectsPointGeometry
(
i
ntersection
Point
,
geo1
))
{
intersection
=
std
::
move
(
i
s
Point
);
intersection
=
std
::
move
(
i
ntersection
Point
);
return
true
;
}
...
...
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