summaryrefslogtreecommitdiff
path: root/src/helpers/MiscFunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
-rw-r--r--src/helpers/MiscFunctions.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 1b0f9467..88e6fa51 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -518,3 +518,19 @@ int64_t configStringToInt(const std::string& VALUE) {
}
return std::stoll(VALUE);
}
+
+double normalizeAngleRad(double ang) {
+ if (ang > M_PI * 2) {
+ while (ang > M_PI * 2)
+ ang -= M_PI * 2;
+ return ang;
+ }
+
+ if (ang < 0.0) {
+ while (ang < 0.0)
+ ang += M_PI * 2;
+ return ang;
+ }
+
+ return ang;
+} \ No newline at end of file