You cannot optimize integral division like this. You end up multiplying by 0, 1 or 2 instead of whole spectre of ratios.
--- a/rust/landgen/src/outline.rs Sat Nov 03 09:08:13 2018 +0300
+++ b/rust/landgen/src/outline.rs Sat Nov 03 10:57:47 2018 +0100
@@ -210,10 +210,9 @@
+ random_numbers.next().unwrap() as i32
% (dist_right as i32 + dist_left as i32 - min_distance * 2);
- let offset = d / p.integral_norm() as i32;
Some(Point::new(
- mid_point.x + p.x * offset as i32,
- mid_point.y + p.y * offset as i32,
+ mid_point.x + p.x * d / p.integral_norm() as i32,
+ mid_point.y + p.y * d / p.integral_norm() as i32,
))
}
}