From 5c3dfa66d34f0ac27cb1a64fccb88fad4de61897 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 6 Sep 2024 13:17:14 +0200 Subject: [PATCH] Adde degrees/readians and poc ACos --- Angle.cpp | 13 +++++++++++++ Angle.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Angle.cpp b/Angle.cpp index f6cc704..d9b805b 100644 --- a/Angle.cpp +++ b/Angle.cpp @@ -87,6 +87,14 @@ template <> float AngleOf::ToFloat() const { return value; } +template +float AngleOf::InDegrees() const { + return this->ToFloat(); +} +template +float AngleOf::InRadians() const { + return this->ToFloat() * Deg2Rad; +} // template <> // AngleOf AngleOf::pi = 3.1415927410125732421875F; @@ -185,6 +193,11 @@ AngleOf AngleOf::MoveTowards(AngleOf fromAngle, return fromAngle.ToFloat() + d; } +template +float AngleOf::ACos(AngleOf a) { + return acosf(a.InRadians()); +} + template <> AngleOf AngleOf::CosineRuleSide(float a, float b, diff --git a/Angle.h b/Angle.h index e02fcc3..842b3e1 100644 --- a/Angle.h +++ b/Angle.h @@ -22,6 +22,8 @@ class AngleOf { // operator float() const; float ToFloat() const; + float InDegrees() const; + float InRadians() const; inline T GetBinary() const { return this->value; } @@ -55,6 +57,8 @@ class AngleOf { AngleOf toAngle, AngleOf maxAngle); + static float ACos(AngleOf); + static AngleOf CosineRuleSide(float a, float b, AngleOf gamma); static AngleOf CosineRuleAngle(float a, float b, float c);