amethyst / amethyst/rustrogueliketutorial

C30 DLASymmetry::Both is incorrectly calculated

オープン
#130 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。