Created
September 22, 2013 01:40
-
-
Save amiller/6655891 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function mult_matrix(m1, m2) { | |
var m = []; | |
_.each(_.range(4), function (i) { | |
_.each(_.range(4), function (j) { | |
var x = 0; | |
_.each(_.range(4), function (k) { | |
x += m1[i * 4 + k] * m[k * 4 + j]; | |
}); | |
m[i * 4 + j]; = x; | |
}); | |
}); | |
} | |
function transpose_matrix(mat) { | |
mat_trans = []; | |
_.each(_.range(4), function (i) { | |
_.each(_.range(4), function (j) { | |
mat_trans.push(mat[j * 4 + i]); | |
}); | |
}); | |
return mat_trans; | |
} | |
function rotate_cuber($cube, mat) { | |
var mat_trans = transpose_matrix(mat); | |
mat_trans = remap_coordinate_system(mat_trans, 3, 1); | |
$cube.css({ | |
transform: 'matrix3d(' + mat_trans.join(',') + ')', | |
"transition-duration": '0s' | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment