* 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 )
| 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. |
no test coverage detected