提交 c88fa50a 编写于 作者: P philogb 提交者: Mr.doob

Add Matrix4.rotationAxisAngleMatrix

上级 c8aacd8c
......@@ -294,6 +294,30 @@ THREE.Matrix4.rotationZMatrix = function ( theta ) {
};
THREE.Matrix4.rotationAxisAngleMatrix = function ( axis, angle ) {
//Based on http://www.gamedev.net/reference/articles/article1199.asp
var rot = new THREE.Matrix4();
var c = Math.cos( angle );
var s = Math.sin( angle );
var t = 1 - c;
var x = axis.x, y = axis.y, z = axis.z;
rot.n11 = t * x * x + c;
rot.n12 = t * x * y - s * z;
rot.n13 = t * x * z + s * y;
rot.n21 = t * x * y + s * z;
rot.n22 = t * y * y + c;
rot.n23 = t * y * z - s * x;
rot.n31 = t * x * z - s * y;
rot.n32 = t * y * z + s * x;
rot.n33 = t * z * z + c;
return rot;
};
THREE.Matrix4.makeInvert = function ( m1 ) {
//TODO: make this more efficient
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册