amethyst / amethyst/rustrogueliketutorial
C30 DLASymmetry::Both is incorrectly calculated
- 主要语言
- Rust
- 星标
- 970
- 派生
- 166
- PR 合并指标
- 30 天内没有已合并 PR
描述
```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);
```
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。