Add conversion from Spherical
This commit is contained in:
parent
66ff721dfe
commit
c274c3eac9
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Angle.h"
|
#include "Angle.h"
|
||||||
#include "Polar.h"
|
#include "Polar.h"
|
||||||
|
#include "Spherical.h"
|
||||||
|
|
||||||
Polar::Polar() {
|
Polar::Polar() {
|
||||||
angle = 0.0F;
|
angle = 0.0F;
|
||||||
@ -26,6 +27,11 @@ Polar::Polar(Vector2 v) {
|
|||||||
distance = v.magnitude();
|
distance = v.magnitude();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Polar::Polar(Spherical s) {
|
||||||
|
angle = s.horizontalAngle;
|
||||||
|
distance = s.distance * cosf(s.verticalAngle * Angle::Deg2Rad);
|
||||||
|
}
|
||||||
|
|
||||||
const Polar Polar::zero = Polar(0, 0);
|
const Polar Polar::zero = Polar(0, 0);
|
||||||
|
|
||||||
float Polar::Distance(const Polar &v1, const Polar &v2) {
|
float Polar::Distance(const Polar &v1, const Polar &v2) {
|
||||||
|
1
Polar.h
1
Polar.h
@ -37,6 +37,7 @@ public:
|
|||||||
Polar(float angle, float distance);
|
Polar(float angle, float distance);
|
||||||
|
|
||||||
Polar(Vector2 v);
|
Polar(Vector2 v);
|
||||||
|
Polar(Spherical s);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A polar vector with zero degrees and distance
|
/// A polar vector with zero degrees and distance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user