Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
opSimulation
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Reinhard Biegel
opSimulation
Commits
bb2209e7
Commit
bb2209e7
authored
3 years ago
by
Uwe Woessner
Browse files
Options
Downloads
Patches
Plain Diff
oops missed constAbs in commonHelper, here it is
parent
4bb55ceb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sim/src/common/commonHelper.h
+8
-1
8 additions, 1 deletion
sim/src/common/commonHelper.h
sim/src/common/vector2d.h
+1
-6
1 addition, 6 deletions
sim/src/common/vector2d.h
with
9 additions
and
7 deletions
sim/src/common/commonHelper.h
+
8
−
1
View file @
bb2209e7
...
...
@@ -17,6 +17,13 @@
#include
"math.h"
#include
"common/globalDefinitions.h"
/* std::abs is not constexpr (at least up to C++20) other than gcc, MSVC sticks to this standard.
this is a constexpr version of abs which should work with all compilers*/
inline
constexpr
double
constAbs
(
double
a
)
noexcept
{
return
(
a
>=
0
)
?
a
:
-
a
;
}
//-----------------------------------------------------------------------------
//! @brief defines common helper functions like conversion from and to enums.
//-----------------------------------------------------------------------------
...
...
@@ -26,7 +33,7 @@ static constexpr double EPSILON = 0.001; //!Treat values smaller than epsilon as
[[
maybe_unused
]]
static
inline
constexpr
bool
DoubleEquality
(
double
value1
,
double
value2
,
double
epsilon
=
EPSILON
)
{
return
my
Abs
(
value1
-
value2
)
<=
epsilon
;
return
const
Abs
(
value1
-
value2
)
<=
epsilon
;
}
//! Returns the same angle but within the range [-PI, PI]
...
...
This diff is collapsed.
Click to expand it.
sim/src/common/vector2d.h
+
1
−
6
View file @
bb2209e7
...
...
@@ -18,16 +18,11 @@
#include
<cmath>
#include
"common/opExport.h"
#include
"common/globalDefinitions.h"
#include
"common/commonHelper.h"
namespace
Common
{
/* std::abs is not constexpr (at least up to C++20) other than gcc, MSVC sticks to this standard.
this is a constexpr version of abs which should work with all compilers*/
inline
constexpr
double
constAbs
(
double
a
)
noexcept
{
return
(
a
>=
0
)
?
a
:
-
a
;
}
/*!
* class for 2d vectors in cartesian coordinate system
...
...
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