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

Method project

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

* project this vector on to another vector. * @param v - The vector to project onto. * @returns Reference to this object for method chaining

(v: Vector2d | Vector3d)

Source from the content-addressed store, hash-verified

459 * @returns Reference to this object for method chaining
460 */
461 project(v: Vector2d | Vector3d) {
462 const ratio = this.dot(v) / v.length2();
463 return this.scale(ratio, ratio, ratio);
464 }
465
466 /**
467 * Project this vector onto a vector of unit length.<br>

Calls 3

dotMethod · 0.95
scaleMethod · 0.95
length2Method · 0.45

Tested by

no test coverage detected