Closed
Description
Most appropriate sub-area of p5.js?
- Accessibility (Web Accessibility)
- Color
- Core/Environment/Rendering
- Data
- Dom
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Other (specify if possible)
Feature enhancement details:
Sometimes I want to use a vector's normalized form in an equation, but I don't want to mutate my original vector. In these cases it would be nice to have a static version of .normalize()
.
For example:
// current method
const normalizedVector = myVector.copy().normalize()
// proposed method
const normalizedVector = p5.Vector.normalize(myVector)
This would follow the pattern of .mag()
, .add()
, and other existing vector functions that have both a mutative prototype version and a static version.
I'd be happy to submit a PR implementing this enhancement, with tests and docs, if you think this would be a valuable addition.