Minor cleanup
parent
10823b9714
commit
4f0d77eeea
|
@ -1,5 +1,5 @@
|
||||||
use super::Pfloat;
|
use super::Pfloat;
|
||||||
use cgmath::{Angle, Deg, EuclideanSpace, Point2};
|
use cgmath::{Angle, Deg, Point2, Vector2};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Polar {
|
pub struct Polar {
|
||||||
|
@ -10,9 +10,11 @@ pub struct Polar {
|
||||||
|
|
||||||
impl Polar {
|
impl Polar {
|
||||||
pub fn to_cartesian(self) -> Point2<Pfloat> {
|
pub fn to_cartesian(self) -> Point2<Pfloat> {
|
||||||
return Point2 {
|
let v = Vector2 {
|
||||||
x: self.radius * self.angle.sin(),
|
x: self.radius * self.angle.sin(),
|
||||||
y: self.radius * self.angle.cos(),
|
y: self.radius * self.angle.cos(),
|
||||||
} + self.center.to_vec();
|
};
|
||||||
|
|
||||||
|
return self.center + v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue