p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
[ ] [Inline documentation] is included / updated - n/a (bugfix)
[x] [Unit tests] are included / updated
Note: eslint passes but emits one warning.
p5.js/src/core/reference.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]
misc implementation notes
Also considered this alternative implementation using the static methods to avoid a local copy of the vector, but I think it turns out harder to read, and requires the normalisation calculation happen twice.
Resolves #7088
Changes:
Added unit tests to check the reflect functions (static and instance) don't alter the given surfaceNormal vector.
Changed the common p5.Vector reflect function so that the given surfaceNormal vector is not mutated unexpectedly.
Did so by making a local copy of the input vector:
Screenshots of the change: n/a
PR Checklist
npm run lint
passesNote: eslint passes but emits one warning.
misc implementation notes
Also considered this alternative implementation using the static methods to avoid a local copy of the vector, but I think it turns out harder to read, and requires the normalisation calculation happen twice.