diff -r 7e7a03e85ac4 -r a325ed57ebfe rust/land2d/src/lib.rs --- a/rust/land2d/src/lib.rs Thu Oct 18 22:23:25 2018 +0200 +++ b/rust/land2d/src/lib.rs Thu Oct 18 22:34:09 2018 +0200 @@ -4,7 +4,7 @@ use std::cmp; use std::ops; -use integral_geometry::{Point, LinePoints}; +use integral_geometry::{LinePoints, ArcPoints, Point}; pub struct Land2D { pixels: vec2d::Vec2D, @@ -149,9 +149,15 @@ } pub fn fill_from_iter(&mut self, i: I, value: T) -> usize - where I: std::iter::Iterator + where + I: std::iter::Iterator, { - i.map(|p| self.map(p.y, p.x, |v| {*v = value; 1})).count() + i.map(|p| { + self.map(p.y, p.x, |v| { + *v = value; + 1 + }) + }).count() } pub fn draw_line(&mut self, from: Point, to: Point, value: T) -> usize { @@ -279,9 +285,9 @@ radius: i32, f: F, ) -> usize { - >::apply_around_circle(radius, &mut |dx, dy| { - self.fill_circle_lines(x, y, dx, dy, &f) - }) + ArcPoints::new(radius) + .map(&mut |p: Point| self.fill_circle_lines(x, y, p.x, p.y, &f)) + .sum() } #[inline] @@ -307,13 +313,16 @@ pub fn draw_thick_line( &mut self, - x1: i32, - y1: i32, - x2: i32, - y2: i32, + from: Point, to: Point, radius: i32, value: T, ) -> usize { + for deltas in ArcPoints::new(radius) { + for points in LinePoints::new(from, to) { + + } + } + >::apply_around_circle(radius, &mut |dx, dy| { >::apply_along_line(x1, y1, x2, y2, &mut |x, y| { >::change_dots_around(x, y, dx, dy, &mut |x, y| {