2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CRELANGLE
|
|
|
|
#define _CRELANGLE
|
2022-10-03 04:49:11 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "Kyoto/Math/CMath.hpp"
|
|
|
|
|
|
|
|
class CRelAngle {
|
|
|
|
public:
|
2022-10-09 05:37:23 +00:00
|
|
|
float AsDegrees() const { return x0_angle * (180.f / M_PIF); }
|
|
|
|
float AsRadians() const { return x0_angle; }
|
2022-10-03 04:49:11 +00:00
|
|
|
// ArcCosine__9CRelAngleFf weak
|
|
|
|
|
|
|
|
CRelAngle& operator+=(const CRelAngle& v) {
|
|
|
|
x0_angle += v.x0_angle;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
CRelAngle& operator-=(const CRelAngle& v) {
|
|
|
|
x0_angle -= v.x0_angle;
|
|
|
|
return *this;
|
|
|
|
}
|
2022-10-09 05:37:23 +00:00
|
|
|
CRelAngle& operator*=(float v) {
|
2022-10-03 04:49:11 +00:00
|
|
|
x0_angle *= v;
|
|
|
|
return *this;
|
|
|
|
}
|
2022-10-09 05:37:23 +00:00
|
|
|
CRelAngle& operator/=(float v) {
|
2022-10-03 04:49:11 +00:00
|
|
|
x0_angle /= v;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// __lt__9CRelAngleCFRC9CRelAngle
|
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static CRelAngle FromDegrees(float deg) { return CRelAngle(deg * (M_PIF / 180.f)); }
|
|
|
|
static CRelAngle FromRadians(float rad) { return CRelAngle(rad); }
|
2022-10-03 04:49:11 +00:00
|
|
|
|
|
|
|
private:
|
2022-10-09 05:37:23 +00:00
|
|
|
CRelAngle(float rad) : x0_angle(rad) {}
|
2022-10-03 04:49:11 +00:00
|
|
|
|
|
|
|
float x0_angle;
|
|
|
|
};
|
|
|
|
CHECK_SIZEOF(CRelAngle, 0x4)
|
|
|
|
|
|
|
|
// __mi__FRC9CRelAngleRC9CRelAngle
|
|
|
|
// __pl__FRC9CRelAngleRC9CRelAngle
|
|
|
|
// __dv__FRC9CRelAnglef
|
2022-10-17 02:33:08 +00:00
|
|
|
static inline float sine(const CRelAngle& angle) { return sin(angle.AsRadians()); }
|
|
|
|
static inline float cosine(const CRelAngle& angle) { return cos(angle.AsRadians()); }
|
2022-10-03 04:49:11 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CRELANGLE
|