Returns a new vector clamped to length passed in * @param {number} [length] * @return {Vector2}
(length=1)
| 705 | * @param {number} [length] |
| 706 | * @return {Vector2} */ |
| 707 | clampLength(length=1) |
| 708 | { |
| 709 | const l = this.length(); |
| 710 | return l > length ? this.scale(length/l) : this.copy(); |
| 711 | } |
| 712 | |
| 713 | /** Returns the dot product of this and the vector passed in |
| 714 | * @param {Vector2} v - other vector |
no test coverage detected