processing / processing/processing4
PShape.contains() is broken for transformed shapes (double invert)
オープン
まだ誰も着手していません。
paused
- 主要言語
- Java
- スター
- 494
- フォーク
- 183
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 3
説明
contains() in PShape is inverting the matrix twice, so it cancels itself out and hit-testing runs in the wrong space.
In PShape.java:
PMatrix inverseCoords = matrix.get();
inverseCoords.invert();
inverseCoords.invert();
inverseCoords.mult(new PVector(x, y), p);
That second invert() should not be there.
So for translated/rotated/scaled shapes, contains(x, y) gives wrong answers.
Quick repro:
PShape s = createShape(RECT, 0, 0, 50, 50);
s.translate(100, 100);
println(s.contains(120, 120)); // false, should be true
Expected: point-in-shape test respects the shape transform.
Actual: transform handling is wrong because inverse matrix is never actually applied.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
PShape.java の contains() から始めます。ここでは、issue が連続する 2 回の行列反転を特定しています。提供された translated-rectangle repro を実行し、余分な反転を削除すると、変換されたシェイプに対して contains(120, 120) が true を返すことを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- computer-graphics
- issue の種類
- バグ
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100