Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
3e505614
Commit
3e505614
authored
Jun 17, 2021
by
Andrew Heather
Committed by
Mattijs Janssens
Jun 18, 2021
Browse files
ENH: Vector2D - added isClose function
parent
b8768e28
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/primitives/Vector2D/Vector2D.H
View file @
3e505614
...
...
@@ -116,13 +116,18 @@ public:
//- Access to the vector y component
inline
Cmpt
&
y
();
//- Normalise the vector by its magnitude
inline
Vector2D
<
Cmpt
>&
normalise
();
//- Perp dot product (dot product with perpendicular vector)
inline
scalar
perp
(
const
Vector2D
<
Cmpt
>&
b
)
const
;
//- Return true if vector is within tol
inline
bool
isClose
(
const
Vector2D
<
Cmpt
>&
b
,
const
scalar
tol
=
1e-10
)
const
;
};
...
...
src/OpenFOAM/primitives/Vector2D/Vector2DI.H
View file @
3e505614
...
...
@@ -126,7 +126,18 @@ operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
template
<
class
Cmpt
>
inline
scalar
Vector2D
<
Cmpt
>::
perp
(
const
Vector2D
<
Cmpt
>&
b
)
const
{
return
x
()
*
b
.
y
()
-
y
()
*
b
.
x
();
return
x
()
*
b
.
y
()
-
y
()
*
b
.
x
();
}
template
<
class
Cmpt
>
inline
bool
Vector2D
<
Cmpt
>::
isClose
(
const
Vector2D
<
Cmpt
>&
b
,
const
scalar
tol
)
const
{
return
(
mag
(
x
()
-
b
.
x
())
<
tol
&&
mag
(
y
()
-
b
.
y
())
<
tol
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment