From d10df1a509eced500d749a632c96b5e6032708dd Mon Sep 17 00:00:00 2001 From: Mikael Emtinger Date: Tue, 12 Apr 2011 22:02:30 +0200 Subject: [PATCH] Added functions for getPosition(), getColumnX(), getColumnY() and getColumnZ() to easier access the different components of the matrix. --- src/core/Matrix4.js | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/core/Matrix4.js b/src/core/Matrix4.js index a41df09e..7cb5d3ca 100644 --- a/src/core/Matrix4.js +++ b/src/core/Matrix4.js @@ -476,6 +476,59 @@ THREE.Matrix4.prototype = { return this; }, + + getPosition : function() { + + if( !this.position ) { + + this.position = new THREE.Vector3(); + + } + + this.position.set( this.n14, this.n24, this.n34 ); + + return this.position; + + }, + + getColumnX : function() { + + if( !this.columnX ) { + + this.columnX = new THREE.Vector3(); + + } + + this.columnX.set( this.n11, this.n21, this.n31 ); + + return this.columnX; + }, + + getColumnY : function() { + + if( !this.columnY ) { + + this.columnY = new THREE.Vector3(); + + } + + this.columnY.set( this.n12, this.n22, this.n32 ); + + return this.columnY; + }, + + getColumnZ : function() { + + if( !this.columnZ ) { + + this.columnZ = new THREE.Vector3(); + + } + + this.columnZ.set( this.n13, this.n23, this.n33 ); + + return this.columnZ; + }, setRotationFromEuler : function( v ) {