aboutsummaryrefslogtreecommitdiff
path: root/src/bitmap.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-07 14:37:33 +0100
committerAkshay <[email protected]>2021-04-07 14:37:33 +0100
commitf57f03cd87d205d8304008d08c05f53c34b44435 (patch)
treee1a1da435a4ae8a21209c304d15130d254be7c97 /src/bitmap.rs
parentc84c38544bc6e81f0b0482e4e82b6c95848c1a0c (diff)
use floating angles
Diffstat (limited to 'src/bitmap.rs')
-rw-r--r--src/bitmap.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bitmap.rs b/src/bitmap.rs
index 2f96a99..ba5c8f1 100644
--- a/src/bitmap.rs
+++ b/src/bitmap.rs
@@ -325,11 +325,11 @@ pub fn reflect_figure(figure: &[MapPoint], around: MapPoint) -> Vec<MapPoint> {
325 figure.iter().map(|pt| pt.reflect(around)).collect() 325 figure.iter().map(|pt| pt.reflect(around)).collect()
326} 326}
327 327
328pub fn positive_angle_with_x(start: MapPoint, end: MapPoint) -> u32 { 328pub fn positive_angle_with_x(start: MapPoint, end: MapPoint) -> f64 {
329 if end.x == start.x { 329 if end.x == start.x {
330 return 90; 330 return 90.;
331 } 331 }
332 let numer = (end.y as f64 - start.y as f64).abs(); 332 let numer = (end.y as f64 - start.y as f64).abs();
333 let denum = (end.x as f64 - start.x as f64).abs(); 333 let denum = (end.x as f64 - start.x as f64).abs();
334 (numer / denum).atan().to_degrees() as u32 334 (numer / denum).atan().to_degrees()
335} 335}