Open smokku opened 4 years ago
let dist_x = i32::abs(center_x - x); let dist_y = i32::abs(center_y - y); self.apply_paint(center_x + dist_x, y); self.apply_paint(center_x - dist_x, y); self.apply_paint(x, center_y + dist_y); self.apply_paint(x, center_y - dist_y);
This will give only 3 symetric points, as one of the calculations center_x + dist_x or center_x - dist_x will be the same as x (or center_y + dist_y/center_y - dist_y will be the same as y).
center_x + dist_x
center_x - dist_x
x
center_y + dist_y
center_y - dist_y
y
Correct formula is:
self.apply_paint(center_x + dist_x, center_y + dist_y); self.apply_paint(center_x - dist_x, center_y - dist_y); self.apply_paint(center_x - dist_x, center_y + dist_y); self.apply_paint(center_x + dist_x, center_y - dist_y);
This is visible in C31 map:
This will give only 3 symetric points, as one of the calculations
center_x + dist_x
orcenter_x - dist_x
will be the same asx
(orcenter_y + dist_y
/center_y - dist_y
will be the same asy
).Correct formula is: