Refactor Vector types to support 64-bit precision via define switch

This commit is contained in:
Wojtek Figat
2022-05-25 20:04:33 +02:00
parent 1303740611
commit f82e370392
55 changed files with 2264 additions and 5482 deletions

View File

@@ -631,7 +631,8 @@ namespace Math
}
// Given a heading which may be outside the +/- PI range, 'unwind' it back into that range
static float UnwindRadians(float a)
template<typename T>
static T UnwindRadians(T a)
{
while (a > PI)
a -= TWO_PI;
@@ -641,12 +642,13 @@ namespace Math
}
// Utility to ensure angle is between +/- 180 degrees by unwinding
static float UnwindDegrees(float a)
template<typename T>
static T UnwindDegrees(T a)
{
while (a > 180.f)
a -= 360.f;
while (a < -180.f)
a += 360.f;
while (a > 180)
a -= 360;
while (a < -180)
a += 360;
return a;
}