// explicit btMatrix3x3(stringbtScalar m) { setFromOpenGLSubMatrix(m); } /*@brief Constructor from Quaternion */ public btMatrix3x3( ref btQuaternion q ) { //setRotation( q ); float d = q.length2(); //btFullAssert(d != (float)(0.0)); float s = btScalar.BT_TWO / d; float xs = q.x * s, ys = q.y * s, zs = q.z * s; float wx = q.w * xs, wy = q.w * ys, wz = q.w * zs; float xx = q.x * xs, xy = q.x * ys, xz = q.x * zs; float yy = q.y * ys, yz = q.y * zs, zz = q.z * zs; m_el0.x = btScalar.BT_ONE - ( yy + zz ); m_el0.y = xy - wz; m_el0.z = xz + wy; m_el0.w = 0; m_el1.x = xy + wz; m_el1.y = btScalar.BT_ONE - ( xx + zz ); m_el1.z = yz - wx; m_el1.w = 0; m_el2.x = xz - wy; m_el2.y = yz + wx; m_el2.z = btScalar.BT_ONE - ( xx + yy ); m_el2.w = 0; m_el3.x = 0; m_el3.y = 0; m_el3.z = 0; m_el3.w = 1; }
public static void setRotation( out btMatrix3x3 result, ref btQuaternion q ) { float d = q.length2(); #if PARANOID_ASSERTS Debug.Assert( d != 0 ); #endif float s = btScalar.BT_TWO / d; float xs = q.x * s, ys = q.y * s, zs = q.z * s; float wx = q.w * xs, wy = q.w * ys, wz = q.w * zs; float xx = q.x * xs, xy = q.x * ys, xz = q.x * zs; float yy = q.y * ys, yz = q.y * zs, zz = q.z * zs; btMatrix3x3.setValue( out result, btScalar.BT_ONE - ( yy + zz ), xy - wz, xz + wy, xy + wz, btScalar.BT_ONE - ( xx + zz ), yz - wx, xz - wy, yz + wx, btScalar.BT_ONE - ( xx + yy ) ); }