PShape does not provide getters for rectMode / ellipseMode
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 48/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- java
研究方向
從 PShape 類別開始,檢查受保護的 ellipseMode 和 rectMode 欄位以及其現有的公開 API。新增一種讓呼叫端能夠查詢這兩種模式的方式,然後確認基本圖形轉換程式碼能夠區分每種模式下參數的意義。
由索引模型根據 Issue 內容生成。
描述
Most relevant area for this enhancement?
Core/Environment/Rendering
Feature to enhance
The PShape class
Enhancement details
Enhancement description
I was half way developing some classes to convert between PShapes and OPENRNDR Shapes but got stuck.
When dealing with PShape.PRIMITIVE types, PShape.getKind() returns what kind of shape is it (rect, ellipse, ...) and the PShape.getParams() returns an array of float values (x, y, width...) One needs to know the kind to know what the float values mean. But it's not sufficient, because if one called ellipseMode before, the values may mean center x and y, or corner x and y, either width or radius.
I didn't find a way to query ellipseMode or rectMode.
Benefits
Adding a way to query this information would help cross framework use of the PShape data structures.
Challenges
I think adding two getters to PShape shouldn't have any negative impact, but I'm not very familiar with the code base to be sure.
Additional context
Here a wip function where I try to convert an ELLIPSE PShape to an OPENRNDR Shape. This is incomplete, because the meaning of params 0, 1, 2 and 3 depend on the ellipseMode used, and there's no way to figure this out (I think).
PShape.PRIMITIVE -> {
listOf( // 101
when (kind) {
PShape.RECT -> Rectangle( // 30
params[0] * 1.0, params[1] * 1.0,
params[2] * 1.0, params[3] * 1.0
).contour
PShape.ELLIPSE -> Ellipse( // 31
params[0] * 1.0, params[1] * 1.0,
params[2] * 0.5, params[3] * 0.5
).contour
PShape.LINE -> LineSegment(
params[0] * 1.0, params[1] * 1.0,
params[2] * 1.0, params[3] * 1.0
).contour
// ARC, TRIANGLE, QUAD, SPHERE, BOX
else -> error("unsupported primitive kind: $kind")
}
)
PShape holds ellipseMode and rectMode variables, but they are protected and without getters.
Would you like to help implement this enhancement?
I’m not sure yet
- 主要語言
- Java
- 星號
- 497
- 分支
- 183
- 平均合併
- 4 小時 39 分鐘
- 30 天內合併 PR
- 3
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
processing/processing4 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 64/100
processing/processing4#1554 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
processing/processing4#1515 · 1 個 reaction ·
-
bug
難度 3/5 1-2 天 新手友好度 55/100
processing/processing4#1573 ·
-
startup error 未關閉
難度 4/5 3-5 天 新手友好度 25/100
processing/processing4#1569 · 7 則留言 ·
-
Binaries under bin directory lack executable permissions for the snap and .deb packages for Linux 未關閉bug
processing/processing4#1567 · 3 則留言 · 1 個 reaction · 已指派 1 人 ·
查看 processing/processing4 的全部 Issue
相似的 Issue
-
area/plugin
難度 2/5 1-3 小時 新手友好度 75/100
kestra-io/plugin-kestra#190 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
apache/rocketmq-dashboard#5064 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
wso2/dpdp-accelerator#287 ·