From 94a3105a61c2283d83e30c9e195f171fc3a6c014 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Sat, 28 Dec 2024 10:04:04 +0100 Subject: [PATCH] Cleanup --- AngleAxis.h | 45 --------------------------------------------- Axis.cpp | 41 ----------------------------------------- Axis.h | 39 --------------------------------------- CMakeLists.txt | 4 ++-- Range.cpp | 48 ------------------------------------------------ Range.h | 50 -------------------------------------------------- 6 files changed, 2 insertions(+), 225 deletions(-) delete mode 100644 AngleAxis.h delete mode 100644 Axis.cpp delete mode 100644 Axis.h delete mode 100644 Range.cpp delete mode 100644 Range.h diff --git a/AngleAxis.h b/AngleAxis.h deleted file mode 100644 index 4d51c30..0000000 --- a/AngleAxis.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0.If a copy of the MPL was not distributed with this -// file, You can obtain one at https ://mozilla.org/MPL/2.0/. - -#ifndef ANGLEAXIS_H -#define ANGLEAXIS_H - -#include "Angle.h" -#include "Direction.h" -#include "Quaternion.h" - -namespace Passer { -namespace LinearAlgebra { - -// Isn't this the same as SphericalOf ????????????? - -template -class AngleAxisOf { - public: - float angle; - DirectionOf axis; - - AngleAxisOf(); - AngleAxisOf(float angle, DirectionOf axis); - AngleAxisOf(Quaternion q); - AngleAxisOf(float angle, Vector3 axis); - - const static AngleAxisOf zero; - - Quaternion ToQuaternion(); - - DirectionOf GetSwing(); -}; - -using AngleAxisSingle = AngleAxisOf; -using AngleAxis16 = AngleAxisOf; -using AngleAxis = AngleAxisOf; - -} // namespace LinearAlgebra -} // namespace Passer -using namespace Passer::LinearAlgebra; - -#endif -*/ \ No newline at end of file diff --git a/Axis.cpp b/Axis.cpp deleted file mode 100644 index 2403e4b..0000000 --- a/Axis.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0.If a copy of the MPL was not distributed with this -// file, You can obtain one at https ://mozilla.org/MPL/2.0/. -/* -#include "Axis.h" - -#include "Quaternion.h" -#include "Vector3.h" - -#include - -Axis::Axis() { - horizontalAngle = Angle(); - verticalAngle = Angle(); -} - -Axis::Axis(Angle horizontal, Angle vertical) { - this->horizontalAngle = horizontal; - this->verticalAngle = vertical; -}; - -Axis::Axis(Vector3 v) { - this->horizontalAngle = - atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg; - this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg; -} - -const Axis Axis::forward = Axis(0.0f, 0.0f); -const Axis Axis::back = Axis(180.0f, 0.0f); -const Axis Axis::up = Axis(0.0f, 90.0f); -const Axis Axis::down = Axis(0.0f, -90.0f); -const Axis Axis::left = Axis(-90.0f, 0.0f); -const Axis Axis::right = Axis(90.0f, 0.0f); - -Vector3 Axis::ToVector3() { - Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()), - this->horizontalAngle.ToFloat(), 0) * - Vector3::forward; - return v; -} -*/ \ No newline at end of file diff --git a/Axis.h b/Axis.h deleted file mode 100644 index 971af2f..0000000 --- a/Axis.h +++ /dev/null @@ -1,39 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0.If a copy of the MPL was not distributed with this -// file, You can obtain one at https ://mozilla.org/MPL/2.0/. -/* -#ifndef AXIS_H -#define AXIS_H - -#include "Angle.h" - -namespace Passer { -namespace LinearAlgebra { - -struct Vector3; - -class Axis { -public: - Angle horizontalAngle; - Angle verticalAngle; - - Axis(); - Axis(Angle horizontal, Angle vertical); - Axis(Vector3 v); - - const static Axis forward; - const static Axis back; - const static Axis up; - const static Axis down; - const static Axis left; - const static Axis right; - - Vector3 ToVector3(); -}; - -} // namespace LinearAlgebra -} // namespace Passer -using namespace Passer::LinearAlgebra; - -#endif -*/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c50090..38bbf0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,8 +32,8 @@ else() "Polar.cpp" "Spherical.cpp" "Matrix.cpp" - "Axis.cpp" - "AngleAxis.cpp" + # "Axis.cpp" + # "AngleAxis.cpp" "SwingTwist.cpp" "Direction.cpp" ) diff --git a/Range.cpp b/Range.cpp deleted file mode 100644 index d6b9e1b..0000000 --- a/Range.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "Range.h" - -/* -Range16::Range16() { this->range = 0; } - -Range16::Range16(float f) { - // clamp the float range to -1..1 - if (f < -1.0F) - f = -1.0F; - else if (f > 1.0F) - f = 1.0F; - - // map -1..1 to 0..65535 - this->range = (unsigned short)((f + 1.0F) * 65535.0F); -} - -Range16::Range16(short s) { - // clamp the range to -32767..32767 - // This is needed because the representation can support +/-32768 (like 2s - // complement) - if (s < -32767) - s = -32767; - else if (s > 32767) - s = 32767; - - this->range = (unsigned short)(s + 32767); -} - -Range16 Range16::operator-(Range16 a) { this->range - a.range; }; -Range16 Range16::operator+(Range16 a) { this->range + a.range; }; - -Range16 &Range16::operator-() { -this->range; } - -bool Range16::operator==(Range16 a) { this->range == a.range; } -bool Range16::operator!=(Range16 a) { return (this->range != a.range); } - -bool Range16::operator<(Range16 a) { return (this->range < a.range); } -bool Range16::operator>(Range16 a) { return (this->range > a.range); } -bool Range16::operator<=(Range16 a) { return (this->range <= a.range); } -bool Range16::operator>=(Range16 a) { return (this->range >= a.range); } -*/ - -template <> RangeUsing::RangeUsing(float f) { - this->value = (unsigned char)((f + 1.0f) * 127.0F); -} -template <> RangeUsing::RangeUsing(float f) { - this->value = (unsigned short)((f + 1.0F) * 32767.0F); -} \ No newline at end of file diff --git a/Range.h b/Range.h deleted file mode 100644 index 65f1dba..0000000 --- a/Range.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef RANGE_H -#define RANGE_H - -namespace Passer { -namespace LinearAlgebra { - -/* -/// @brief Signed range. May be renamed to SignedRange later -class Range16 { -public: - Range16(); - Range16(float range); // range -1..1 - Range16(short range); // range -32768..32767 - - inline Range16 operator-(Range16 a); - inline Range16 operator+(Range16 a); - inline virtual Range16 &operator-(); - - inline bool operator==(Range16 a); - inline bool operator!=(Range16 a); - - inline bool operator<(Range16 a); - inline bool operator>(Range16 a); - inline bool operator<=(Range16 a); - inline bool operator>=(Range16 a); - -protected: - // How do we make sure we have 16 bit range on every platform? - // uint16_t range; // 16-bit range - unsigned short range; // 16-bit range -}; -*/ - -template class RangeUsing { -public: - RangeUsing(float range); // range -1..1 - - inline RangeUsing operator-(RangeUsing a) { this->value - a.value; } - inline RangeUsing operator+(RangeUsing a) { this->value + a.value; } - inline RangeUsing operator-() { this->value = -this.value; } - inline T GetValue() { return value; } - - T value; -}; - -} // namespace LinearAlgebra -} // namespace Passer -using namespace Passer::LinearAlgebra; - -#endif \ No newline at end of file