amethyst / amethyst/rustrogueliketutorial
C30 DLASymmetry::Both is incorrectly calculated
- Lingua principale
- Rust
- Stelle
- 970
- Fork
- 166
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
```rust
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`).
Correct formula is:
```rust
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);
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.