Add conversion from Spherical
This commit is contained in:
parent
66ff721dfe
commit
c274c3eac9
@ -2,6 +2,7 @@
|
||||
|
||||
#include "Angle.h"
|
||||
#include "Polar.h"
|
||||
#include "Spherical.h"
|
||||
|
||||
Polar::Polar() {
|
||||
angle = 0.0F;
|
||||
@ -26,6 +27,11 @@ Polar::Polar(Vector2 v) {
|
||||
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);
|
||||
|
||||
float Polar::Distance(const Polar &v1, const Polar &v2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user