processing / processing/processing4
PShape does not provide getters for rectMode / ellipseMode
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 494
- フォーク
- 183
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 3
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
PShape クラスから始め、既存の public API とともに、protected な ellipseMode フィールドと rectMode フィールドを調べます。呼び出し側が両方のモードを確認できる方法を追加し、その後、プリミティブ図形の変換コードが各モードにおけるパラメーターの意味を区別できることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- computer-graphics
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100