summaryrefslogtreecommitdiff
path: root/include/SSystem/SComponent
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2023-01-29 16:55:11 +0200
committerTal Hayon <talhayon1@gmail.com>2023-01-29 16:55:11 +0200
commitcb867a05c2d3ea5e2269bdd39bd0038f025e1a86 (patch)
tree4aeef02d45d4c9e6a7e526fe49cf4f5134dabb26 /include/SSystem/SComponent
parent7c49fbffb66fbfb0955abb0bf269c675697ddba5 (diff)
parente0f788b3dd6ca630c5b329459b232a20d30112db (diff)
Merge remote-tracking branch 'upstream/master' into dollibs4
Diffstat (limited to 'include/SSystem/SComponent')
-rw-r--r--include/SSystem/SComponent/c_angle.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/SSystem/SComponent/c_angle.h b/include/SSystem/SComponent/c_angle.h
index b54d8f7585..d87b220fb7 100644
--- a/include/SSystem/SComponent/c_angle.h
+++ b/include/SSystem/SComponent/c_angle.h
@@ -52,12 +52,44 @@ public:
cSAngle operator+(short, const cSAngle&);
cSAngle operator-(short, const cSAngle&);
+struct cAngle {
+ static f32 Radian_to_Degree(f32 rad) { return rad * 57.2957763671875f; }
+ static f32 Degree_to_Radian(f32 deg) { return deg * 0.017453292f; }
+ static s16 Degree_to_SAngle(f32 deg) { return deg * 182.04444885253906f; }
+ static f32 SAngle_to_Degree(s16 angle) { return (360.0f / 65536.0f) * angle; }
+ static f32 SAngle_to_Radian(s16 angle) { return 9.58738E-5f * angle; }
+ static f32 SAngle_to_Normal(s16 angle) { return 3.0517578E-5f * angle; }
+ static s16 Radian_to_SAngle(f32 rad) { return rad * 10430.378f; }
+
+ /* Converts Radian value into Degree value */
+ static f32 r2d(f32 r) { return Radian_to_Degree(r); }
+
+ /* Converts Degree value to s16 angle */
+ static s16 d2s(f32 d) { return Degree_to_SAngle(d); }
+
+ template <typename T>
+ static T Adjust(T f1, T f2, T f3);
+};
+
+template <typename T>
+T cAngle::Adjust(T f1, T f2, T f3) {
+ while (f1 >= f3) {
+ f1 -= f3 - f2;
+ }
+ while (f1 < f2) {
+ f1 += f3 - f2;
+ }
+ return f1;
+}
+
class cDegree {
private:
float mDegree;
public:
cDegree(float);
+ ~cDegree() {}
+
cDegree& Formal(void);
void Val(float);
float Radian(void) const;