Skip to content

Commit

Permalink
fixup! Add polar coordinate conversion to transform tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Notgnoshi committed May 22, 2024
1 parent f0e6a7b commit 159dcce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ fn from_polar(coord: Coord) -> Coord {

fn to_polar(coord: Coord) -> Coord {
let r = f64::sqrt(coord.x.powi(2) + coord.y.powi(2));
let theta = f64::atan2(coord.y, coord.x);
let mut theta = f64::atan2(coord.y, coord.x);
if theta < 0.0 {
theta += 2.0 * std::f64::consts::PI;
}
coord! { x: r, y: theta}
}

Expand Down

0 comments on commit 159dcce

Please sign in to comment.