diff --git a/include/Spherical.h b/include/Spherical.h index b28b7f6..69cfe8c 100644 --- a/include/Spherical.h +++ b/include/Spherical.h @@ -21,6 +21,8 @@ struct Spherical { /// @details The angle is automatically normalized to -180 .. 180 float elevationAngle; + float distance; + /// @brief Create a new spherical vector with zero degrees and distance Spherical(); /// @brief Create a new spherical vector @@ -33,6 +35,8 @@ struct Spherical { /// @brief A spherical vector with zero degree angles and distance const static Spherical zero; + + float GetSwing(); }; #endif \ No newline at end of file diff --git a/src/Spherical.cpp b/src/Spherical.cpp new file mode 100644 index 0000000..c6bee5c --- /dev/null +++ b/src/Spherical.cpp @@ -0,0 +1,23 @@ +#include "Spherical.h" + +#include + +Spherical::Spherical() { + this->polarAngle = 0; + this->elevationAngle = 0; + this->distance = 0; +} + +Spherical::Spherical(float polarAngle, float elevationAngle, float distance) { + this->polarAngle = polarAngle; + this->elevationAngle = elevationAngle; + this->distance = distance; +} + +const Spherical Spherical::zero = Spherical(0, 0, 0); + +float Spherical::GetSwing() { + // Not sure if this is correct + return sqrtf(polarAngle * polarAngle + elevationAngle * elevationAngle); + +} \ No newline at end of file