Returns a new vector in same direction as this one with the length passed in * @param {number} [length] * @return {Vector2}
(length=1)
| 696 | * @param {number} [length] |
| 697 | * @return {Vector2} */ |
| 698 | normalize(length=1) |
| 699 | { |
| 700 | const l = this.length(); |
| 701 | return l ? this.scale(length/l) : new Vector2(0, length); |
| 702 | } |
| 703 | |
| 704 | /** Returns a new vector clamped to length passed in |
| 705 | * @param {number} [length] |
no test coverage detected