Title: PShape does not provide getters for rectMode / ellipseMode · Issue #1359 · processing/processing4 · GitHub
Open Graph Title: PShape does not provide getters for rectMode / ellipseMode · Issue #1359 · processing/processing4
X Title: PShape does not provide getters for rectMode / ellipseMode · Issue #1359 · processing/processing4
Description: 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...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/processing/processing4/issues/1359
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PShape does not provide getters for rectMode / ellipseMode","articleBody":"### Most relevant area for this enhancement?\n\nCore/Environment/Rendering\n\n### Feature to enhance\n\nThe PShape class\n\n### Enhancement details\n\n#### Enhancement description\nI was half way developing some classes to convert between `PShape`s and OPENRNDR `Shape`s but got stuck. \n\nWhen 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.\n\nI didn't find a way to query `ellipseMode` or `rectMode`.\n\n#### Benefits\nAdding a way to query this information would help cross framework use of the `PShape` data structures.\n\n#### Challenges\nI 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.\n\n#### Additional context\nHere 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).\n\n```kotlin\n PShape.PRIMITIVE -\u003e {\n listOf( // 101\n when (kind) {\n PShape.RECT -\u003e Rectangle( // 30\n params[0] * 1.0, params[1] * 1.0,\n params[2] * 1.0, params[3] * 1.0\n ).contour\n\n PShape.ELLIPSE -\u003e Ellipse( // 31\n params[0] * 1.0, params[1] * 1.0,\n params[2] * 0.5, params[3] * 0.5\n ).contour\n\n PShape.LINE -\u003e LineSegment(\n params[0] * 1.0, params[1] * 1.0,\n params[2] * 1.0, params[3] * 1.0\n ).contour\n\n // ARC, TRIANGLE, QUAD, SPHERE, BOX\n else -\u003e error(\"unsupported primitive kind: $kind\")\n }\n )\n\n```\n\n`PShape` holds `ellipseMode` and `rectMode` variables, but they are `protected` and without getters.\n\n### Would you like to help implement this enhancement?\n\nI’m not sure yet","author":{"url":"https://github.com/hamoid","@type":"Person","name":"hamoid"},"datePublished":"2025-12-12T12:25:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1359/processing4/issues/1359"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2f5ce7e7-20a8-f738-2821-6145a674396b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2EA:EA98B:7AF7DF:AF4A75:696FAFE6 |
| html-safe-nonce | 4fd946666873ae90043f2f6646e1bce20c9f2c6933ebf61674b8653c9712e8eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkVBOkVBOThCOjdBRjdERjpBRjRBNzU6Njk2RkFGRTYiLCJ2aXNpdG9yX2lkIjoiMjM3OTgxODg4NzczODc5ODA1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 658ce2b2a00c6ca6fc284bb5fcedddf9a67c33c24f89bea83a72134e6a4498a2 |
| hovercard-subject-tag | issue:3723245381 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/processing4/1359/issue_layout |
| twitter:image | https://opengraph.githubassets.com/008be17137e7a8401bc96172b5b23558f88a97e5b791a8de04d7ce871a26abec/processing/processing4/issues/1359 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/008be17137e7a8401bc96172b5b23558f88a97e5b791a8de04d7ce871a26abec/processing/processing4/issues/1359 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hamoid |
| hostname | github.com |
| expected-hostname | github.com |
| None | 356c704aafcc9a6179b2bc62a546ee20a28226cdeddba29d8ae86c3750ef0f76 |
| turbo-cache-control | no-preview |
| go-import | github.com/processing/processing4 git https://github.com/processing/processing4.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 844382769 |
| octolytics-dimension-repository_nwo | processing/processing4 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 844382769 |
| octolytics-dimension-repository_network_root_nwo | processing/processing4 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e19b0670387556fcdd8027326ad85eecb0b536dd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width