[p5.js 2.0+ Bug Report]: 3x3 p5.Matrix.transpose() ignores passed matrix/array input and produces incorrect results
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- computer-graphics
Research direction
Start with p5.Matrix.transpose() and the skipped tests in test/unit/math/p5.Matrix.js. Reproduce both 3x3 calls using a matrix and an array, then make the behavior match the expected transposed values [1, 4, 7, 2, 5, 8, 3, 6, 9] and run the relevant matrix tests.
Written by the indexing model from the issue text.
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- WebGPU
- p5.strands
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
No response
Web browser and version
No response
Operating system
No response
Steps to reproduce this
The p5.Matrix.transpose() method is incorrectly handling the 3x3 case when a source matrix or array is passed in.
Current implementation does not reliably transpose the supplied source matrix and can leave the result incorrect or inconsistent. The skipped tests already describe this expected behavior in test/unit/math/p5.Matrix.js.
Steps:
- Create a 3x3 matrix using new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9])
- Call transpose() with the matrix itself or with a 3x3 array:
mat.transpose(mat)
mat.transpose([1, 2, 3, 4, 5, 6, 7, 8, 9])
- Compare the result to the expected transposed matrix [1, 4, 7, 2, 5, 8, 3, 6, 9]
Snippet:
const mat = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
console.log(mat.transpose(mat).mat3);
// expected: [1, 4, 7, 2, 5, 8, 3, 6, 9]
console.log(mat.transpose([1, 2, 3, 4, 5, 6, 7, 8, 9]).mat3);
// expected: [1, 4, 7, 2, 5, 8, 3, 6, 9]
Can i be assigned this issue @limzykenneth @perminder-17
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from processing/p5.js
-
Area:Core Area:DOM
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
processing/p5.js#9189 ·
-
[Bug]: p5.Image.prototype.copy and blend do not scale destination coordinates for high pixel density Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
processing/p5.js#9169 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
processing/p5.js#9129 ·
-
[p5.js 2.0+ Bug Report]: splitTokens() returns [] for a caret delimiter and throws for a backslash Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
processing/p5.js#9126 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
processing/p5.js#9125 · 1 comment ·
All issues in processing/p5.js
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·