Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

PShape.contains() is broken for transformed shapes (double invert)

未關閉
#1,445 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
java

研究方向

從 PShape.java 中的 contains() 開始,issue 指出這裡存在兩次連續的矩陣反轉。執行提供的 translated-rectangle repro,並驗證移除多餘的反轉操作後,經過轉換的形狀呼叫 contains(120, 120) 會回傳 true。

由索引模型根據 Issue 內容生成。

描述

paused

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.

主要語言
Java
星號
497
分支
183
平均合併
4 小時 39 分鐘
30 天內合併 PR
3

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

processing/processing4 的其他 Issue

查看 processing/processing4 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。