* Sets a vector's magnitude to a given value. * * The static version of `setMag()`, as in `p5.Vector.setMag(v, 10)`, returns * a new p5.Vector object and doesn't change the * original. * * @param {Number} len new length for this vector. * @chainable
(n)
| 1833 | * } |
| 1834 | */ |
| 1835 | setMag(n) { |
| 1836 | return this.normalize().mult(n); |
| 1837 | } |
| 1838 | |
| 1839 | /** |
| 1840 | * Calculates the angle a 2D vector makes with the positive x-axis. |
no test coverage detected