Skip to content

Commit

Permalink
Vector3: Simplified applyMatrix4().
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 17, 2017
1 parent 6df71f7 commit c9d12c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/math/Vector3.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,13 @@ Object.assign( Vector3.prototype, {
var x = this.x, y = this.y, z = this.z;
var e = m.elements;

this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ];
this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ];
this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ];
var w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ];
var w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );

return this.divideScalar( w );
this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;
this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;
this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;

return this;

},

Expand Down

0 comments on commit c9d12c1

Please sign in to comment.