vectors created using random2d() do not respect angleMode(DEGREES) as those created with createVector() do
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Most appropriate sub-area of p5.js?
- Math (Vectors)
Details about the bug:
https://p5js.org/reference/#/p5.Vector/random2D
Random2d returns a p5.Vector just as createVector does.
https://p5js.org/reference/#/p5.Vector/heading states:
"Calculate the angle of rotation for this vector(only 2D vectors). p5.Vectors created using createVector() will take the current angleMode into consideration, and give the angle in radians or degree accordingly."
This fiddle shows that this does not consider angleMode(DEGREEES) if the vector is created with random2d: https://replit.com/@jgordon510/p5-template-68#script.js
It would seem like there should be parity between random2d and createVector. A likely practice might be to hardcode certain values into a game for testing and then replace them with random vectors one the logic is working. In that case, the lack of parity would cause it to break unexpectedly.
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.
Research direction
Start with the p5.Vector/random2D and p5.Vector/heading references, then compare their angleMode(DEGREES) behavior with vectors created by createVector(). Use the linked Replit example to reproduce the discrepancy; done means random2D vectors and createVector vectors behave consistently under the documented angle mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100