MCPcopy Create free account
hub / github.com/melonjs/melonJS / projectN

Method projectN

packages/melonjs/src/math/vector3d.ts:472–475  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

dotMethod · 0.95
scaleMethod · 0.95
length2Method · 0.45

Tested by

no test coverage detected