10 likes | 84 Views
class double3x3 { double3 x,y,z; // the 3 rows of the Matrix }. In OBB code: orientMat.x = double3(t->eigVec[0].x,t->eigVec[1].x,t->eigVec[2].x); orientMat.y = double3(t->eigVec[0].y,t->eigVec[1].y,t->eigVec[2].y);
E N D
class double3x3 { double3 x,y,z; // the 3 rows of the Matrix } In OBB code: orientMat.x = double3(t->eigVec[0].x,t->eigVec[1].x,t->eigVec[2].x); orientMat.y = double3(t->eigVec[0].y,t->eigVec[1].y,t->eigVec[2].y); orientMat.z = double3(t->eigVec[0].z,t->eigVec[1].z,t->eigVec[2].z); // Modal Matrix form, eigenvectors are colomn-wise Frame (U,V,N) -> (X,Y,Z), R = (Eigen vectors in columns, modal-matrix form) Frame (X,Y,Z) -> (U,V,N), R = (Eigen vectors in rows) For rotation, columns form orthonormal basis and are the axes for new reference frame. Since R is orthonormal, A-1 = AT Real-time collision detection, By Christer Ericson has this : Mine looks like this: V0 V1 V2 D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); V0 V1 V2 B.u[0] B.u[1] A.u[0] T B.t B.u[2] A.t a b A.u[2] A.u[1] a+b A.t is in world coords B.u[0] • Need to find: • T in OBB A’s frame: • T = (B.t-A.t) • T = [dot(T,a.u[0]), • dot(T,a.u[1]), • dot(T,a.u[2])] • (ie (X,Y,Z) -> (U,V,N) on T) • Rotation from B to A: • R[i][j] = Dot(a.u[i],b.u[j]) • R = AT.B if vectors are columns • = A.BT if vectors are rows b B.rbo.u[0] A.u[0] T B.rbo.u[1] B.u[1] a-b B.t B.u[2] a A.rbo.u[0] A.u[1] A.u[2] A.t B.rbo.t B.rbo.u[2] A.rbo.t A.rbo.u[2] A.rbo.u[1] • Need to find: • T in OBB A’s frame. • Rotation from B to A. A.rbo.t is in world coords A.t is in rbo coords