diff options
Diffstat (limited to 'src/bitmap.rs')
-rw-r--r-- | src/bitmap.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bitmap.rs b/src/bitmap.rs index 0b1754a..ff41cb8 100644 --- a/src/bitmap.rs +++ b/src/bitmap.rs | |||
@@ -333,3 +333,10 @@ pub fn positive_angle_with_x(start: MapPoint, end: MapPoint) -> f64 { | |||
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() | 334 | (numer / denum).atan().to_degrees() |
335 | } | 335 | } |
336 | |||
337 | pub fn manhattan( | ||
338 | MapPoint { x: sx, y: sy }: MapPoint, | ||
339 | MapPoint { x: ex, y: ey, .. }: MapPoint, | ||
340 | ) -> u32 { | ||
341 | abs_difference(sx, ex) + abs_difference(sy, ey) | ||
342 | } | ||