MCPcopy
hub / github.com/mrdoob/three.js / transformDirection

Method transformDirection

src/math/Vector3.js:525–539  ·  view source on GitHub ↗

* Transforms the direction of this vector by a matrix (the upper left 3 x 3 * subset of the given 4x4 matrix and then normalizes the result. * * @param {Matrix4} m - The matrix. * @return {Vector3} A reference to this vector.

( m )

Source from the content-addressed store, hash-verified

523 * @return {Vector3} A reference to this vector.
524 */
525 transformDirection( m ) {
526
527 // input: THREE.Matrix4 affine matrix
528 // vector interpreted as a direction
529
530 const x = this.x, y = this.y, z = this.z;
531 const e = m.elements;
532
533 this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;
534 this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;
535 this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;
536
537 return this.normalize();
538
539 }
540
541 /**
542 * Divides this instance by the given vector.

Callers 15

Vector3.tests.jsFile · 0.45
onBeforeRenderMethod · 0.45
lightTargetDirectionFunction · 0.45
ReflectVector.jsFile · 0.45
Position.jsFile · 0.45
Tangent.jsFile · 0.45
createRadianceContextFunction · 0.45
setupViewFunction · 0.45
applyMatrix4Method · 0.45
updateMethod · 0.45
setupMethod · 0.45

Calls 1

normalizeMethod · 0.95

Tested by

no test coverage detected