Title: `shear_x()`, `shear_y()` and `apply_matrix()` draw the wrong shape · Issue #269 · processing/libprocessing · GitHub
Open Graph Title: `shear_x()`, `shear_y()` and `apply_matrix()` draw the wrong shape · Issue #269 · processing/libprocessing
X Title: `shear_x()`, `shear_y()` and `apply_matrix()` draw the wrong shape · Issue #269 · processing/libprocessing
Description: Shapes drawn under a shear come out as a rotated rectangle instead of a parallelogram. The same thing happens when a non-uniform scale() is followed by rotate(). Reproduction (processing-py) from processing_py import * def setup(): size(...
Open Graph Description: Shapes drawn under a shear come out as a rotated rectangle instead of a parallelogram. The same thing happens when a non-uniform scale() is followed by rotate(). Reproduction (processing-py) from p...
X Description: Shapes drawn under a shear come out as a rotated rectangle instead of a parallelogram. The same thing happens when a non-uniform scale() is followed by rotate(). Reproduction (processing-py) from p...
Opengraph URL: https://github.com/processing/libprocessing/issues/269
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`shear_x()`, `shear_y()` and `apply_matrix()` draw the wrong shape","articleBody":"Shapes drawn under a shear come out as a rotated rectangle instead of a parallelogram. The same thing happens when a non-uniform `scale()` is followed by `rotate()`.\n\n### Reproduction (processing-py)\n\n```python\nfrom processing_py import *\n\ndef setup():\n size(400, 400)\n\ndef draw():\n background(240)\n translate(100, 100)\n shear_x(PI / 6)\n rect(0, 0, 150, 150)\n\nrun()\n```\n\n### Expected behavior\n\nA parallelogram leaning to the right, same as in Processing.\n\n### Actual behavior\n\nA rotated rectangle.\n\nIn the screenshot, blue is what libprocessing draws. Green is the correct shape. Red dots are what `screen_x()` / `screen_y()` return for the corners. They match the green shape, not the drawn one. The last panel (rotate, then scale) is drawn correctly.\n\n\u003cimg width=\"1200\" height=\"800\" alt=\"shear_2d\" src=\"https://github.com/user-attachments/assets/8a540121-c321-4f2d-aa66-f9d687524d7d\" />\n\nIt happens in 3D too. Here is `scale(1.6, 0.6, 1)` followed by `rotate_y()` on a box:\n\n\u003cimg width=\"800\" height=\"600\" alt=\"squashed_box_3d_overlay\" src=\"https://github.com/user-attachments/assets/02182f47-14ab-4c34-b43c-34f445cd0274\" />\n\n### Cause\n\nBefore each draw, the current matrix is turned into a Bevy `Transform` using `to_scale_rotation_translation()`. This happens in `spawn_mesh` in `render/mod.rs` and in `TransformStack::to_bevy_transform`. A `Transform` can only hold translation, rotation and scale. A shear doesn't fit, so it gets lost.\n\n`compute_global_transform` in `gltf.rs` does the same thing, so glTF scenes with a non-uniformly scaled parent are probably affected too.\n\n### Proposed fix\n\nWhen the matrix fits in a `Transform` keep the current path. When it doesn't, apply the matrix to the mesh vertices and normals and use a translation-only `Transform`. Existing sketches would render exactly the same. I would add unit tests and a visual test case.\n\nI would like to work on this if the approach sounds good.\n","author":{"url":"https://github.com/Akshats-git","@type":"Person","name":"Akshats-git"},"datePublished":"2026-11-11T17:39:13Z","url":"https://github.com/processing/libprocessing/issues/269"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:671707d9-e60c-45e2-2233-86df9829ff33 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C86C:2FDE44:1155DD:175CD2:6B05F765 |
| html-safe-nonce | f84ab10c405ade742b8a746cee510a3cb369e45d5e6ed2813c03e8e82e13c7d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODZDOjJGREU0NDoxMTU1REQ6MTc1Q0QyOjZCMDVGNzY1IiwidmlzaXRvcl9pZCI6IjYwOTkxNDE3NzU4OTU5NTEyMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | baeb926d38d1d53d44d1715483eca71828db34e94c9a46a548e044396c30d3e0 |
| hovercard-subject-tag | issue:6333934926 |
| 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/libprocessing/269/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8c12a9150b447906250d276467e2f4ce4d25d2a129ccf1ab2baab9bfe2ac30c/processing/libprocessing/issues/269 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8c12a9150b447906250d276467e2f4ce4d25d2a129ccf1ab2baab9bfe2ac30c/processing/libprocessing/issues/269 |
| og:image:alt | Shapes drawn under a shear come out as a rotated rectangle instead of a parallelogram. The same thing happens when a non-uniform scale() is followed by rotate(). Reproduction (processing-py) from p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Akshats-git |
| hostname | github.com |
| expected-hostname | github.com |
| None | c214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece |
| turbo-cache-control | no-preview |
| go-import | github.com/processing/libprocessing git https://github.com/processing/libprocessing.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 1101329545 |
| octolytics-dimension-repository_nwo | processing/libprocessing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1101329545 |
| octolytics-dimension-repository_network_root_nwo | processing/libprocessing |
| 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 | 7d164a4e71eb333b2b17fd5b17e18efb7855505c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width