* Project this vector onto a vector of unit length. * This is slightly more efficient than `project` when dealing with unit vectors. * @param v - The unit vector to project onto. * @returns Reference to this object for method chaining
(v: Vector2d | Vector3d)
| 470 | * @returns Reference to this object for method chaining |
| 471 | */ |
| 472 | projectN(v: Vector2d | Vector3d) { |
| 473 | const ratio = this.dot(v) / v.length2(); |
| 474 | return this.scale(ratio, ratio, ratio); |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * return a clone copy of this vector |