Find relative position of axes of cube after rotation

I am rotating a cube through a series of 90 degree rotations using quaternions and I want to be able to get relative positions of the quaternions after a rotation compared with its original position that I have stored.

IE I'd like to know which axis is now equivalent to the original x axis (and if it is inverted), and so on...

I'm using threejs, but I'm sure that's not necessary for answering.


Use this pattern to determine the direction the x-axis is pointing after applying a series of rotations.

var dir = new THREE.Vector3( 1, 0, 0 );
dir.applyQuaternion( q1 );
dir.applyQuaternion( q2 ); // etc...

To see it visually, you can add axes as a child of your cube mesh. The axes will be rotated automatically.

var axes = new THREE.AxisHelper( 100 );
mesh.add( axes );

three.js r.71

链接地址: http://www.djcxy.com/p/81826.html

上一篇: 在iOS中使用openGL 2旋转模型

下一篇: 旋转后查找立方体轴的相对位置