Created
July 21, 2014 13:56
-
-
Save gregtatum/5ce3a3aface226e5eba8 to your computer and use it in GitHub Desktop.
console.table for a three.js matrix4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Utils.consoleMatrix( threeJsMatrix, 3 ) | |
//Utils.consoleMatrix( threeJsMatrix ) | |
var Utils = { | |
consoleMatrix : function( matrix, decimalPlaces ) { | |
var i, j, el, results; | |
results = [ [], [], [], [] ]; | |
j = 0; | |
for( i=0; i < matrix.elements.length; i++ ) { | |
el = matrix.elements[i]; | |
if( typeof decimalPlaces === "number" ) { | |
el = Math.round( Math.pow(10, decimalPlaces) * el ) / Math.pow(10, decimalPlaces); | |
} | |
results[j].push( el ); | |
j++; | |
j %= 4; | |
} | |
console.table( results ); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment