renames spherical magnitude to distance

This commit is contained in:
Pascal Serrarens 2024-01-31 10:36:40 +01:00
parent 276d293c9b
commit 78106912a9
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@
Spherical::Spherical() {
this->horizontalAngle = 0;
this->verticalAngle = 0;
this->magnitude = 0;
this->distance = 0;
}
// Spherical::Spherical(float polarAngle, float elevationAngle, float distance)
@ -22,11 +22,11 @@ Spherical::Spherical() {
Spherical::Spherical(Polar polar) {
this->horizontalAngle = polar.angle;
this->verticalAngle = 0.0F;
this->magnitude = polar.distance;
this->distance = polar.distance;
}
Spherical::Spherical(float distance, Angle horizontalAngle, Angle verticalAngle)
: magnitude(distance), horizontalAngle(horizontalAngle),
: distance(distance), horizontalAngle(horizontalAngle),
verticalAngle(verticalAngle) {}
Spherical::Spherical(Vector3 v) {
@ -34,7 +34,7 @@ Spherical::Spherical(Vector3 v) {
horizontalAngle =
atan2(v.y, signZ * sqrt(v.z * v.z + v.x * v.x)) * Angle::Rad2Deg;
verticalAngle = -atan2(v.x, sqrt(v.z * v.z + v.y * v.y)) * Angle::Rad2Deg;
magnitude = v.magnitude();
distance = v.magnitude();
}
const Spherical Spherical::zero = Spherical(0.0F, (Angle)0.0F, (Angle)0.0F);
@ -46,5 +46,5 @@ float Spherical::GetSwing() {
}
Polar Spherical::ProjectOnHorizontalPlane() {
Polar(horizontalAngle, magnitude);
return Polar(horizontalAngle, distance);
}

View File

@ -21,7 +21,7 @@ namespace Passer {
/// as a forward direction.
struct Spherical {
public:
float magnitude;
float distance;
/// @brief The angle in the horizontal plane in degrees, clockwise rotation
/// @details The angle is automatically normalized to -180 .. 180