Minor cleanup

master
Mark 2023-12-25 10:29:52 -08:00
parent 10823b9714
commit 4f0d77eeea
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
1 changed files with 5 additions and 3 deletions

View File

@ -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;
} }
} }