Added initial spherical implementation
This commit is contained in:
parent
5ea0a101e5
commit
cc3102f757
@ -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
|
23
src/Spherical.cpp
Normal file
23
src/Spherical.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "Spherical.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
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);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user