prime/include/Kyoto/Math/CAbsAngle.hpp

52 lines
1.1 KiB
C++
Raw Permalink Normal View History

#ifndef _CABSANGLE
#define _CABSANGLE
2022-10-05 23:06:15 +00:00
#include "types.h"
#include "Kyoto/Math/CMath.hpp"
class CAbsAngle {
public:
float AsDegrees() const { return x0_angle * (180.f / M_PIF); }
float AsRadians() const { return x0_angle; }
2022-10-05 23:06:15 +00:00
// ArcCosine__9CAbsAngleFf weak
// -> calls ArcCosineR__5CMathFf
CAbsAngle& operator+=(const CAbsAngle& v) {
x0_angle += v.x0_angle;
return *this;
}
CAbsAngle& operator-=(const CAbsAngle& v) {
x0_angle -= v.x0_angle;
return *this;
}
CAbsAngle& operator*=(float v) {
2022-10-05 23:06:15 +00:00
x0_angle *= v;
return *this;
}
CAbsAngle& operator/=(float v) {
2022-10-05 23:06:15 +00:00
x0_angle /= v;
return *this;
}
// __apl__9CAbsAngleFRC9CRelAngle
// __ami__9CAbsAngleFRC9CRelAngle
static CAbsAngle FromDegrees(float deg) {
2022-10-05 23:06:15 +00:00
return CAbsAngle(CMath::ClampRadians(deg * (M_PIF / 180.f)));
}
static CAbsAngle FromRadians(float rad) { return CAbsAngle(CMath::ClampRadians(rad)); }
2022-10-05 23:06:15 +00:00
private:
CAbsAngle(float rad) : x0_angle(rad) {}
2022-10-05 23:06:15 +00:00
float x0_angle;
};
CHECK_SIZEOF(CAbsAngle, 0x4)
// __mi__FRC9CAbsAngleRC9CAbsAngle
static inline float cosine(const CAbsAngle& angle) { return cos(angle.AsRadians()); }
2022-10-05 23:06:15 +00:00
#endif // _CABSANGLE