Example #1
0
void MyServerThread::sendMatrix(Matrixd transNode)
{
  float matrix1[16];
   
  Vec3 objTrans = transNode.getTrans();
  Quat objQuad = transNode.getRotate();
  
  //cout << "  Orientation  " << objQuad.x() << "," << objQuad.y() << "," << objQuad.z() << "," << objQuad.w() << endl; // orientation
  //cout << "  Postion  " << objTrans.x() << "," << objTrans.y() << "," << objTrans.z() << endl; // position
  
/*for (int i=0; i<4; ++i){
    for (int j=0; j<4; ++j)
       {
        cout << transNode(i,j) << "   " ; // position
       }
  cout << endl;
} */

cout << endl;

  for (int i=0; i<4; ++i)
    for (int j=0; j<4; ++j)
        matrix[i*4+j] = transNode(i,j);
        
 for(int i=0; i<16; i++)
        {
         cout <<"matrix:" << i << "   " << matrix1[i] << endl;
        }

  //memcpy(buf,matrix1,sizeof(float)*16);
  //sendMSG();
}
/** Set the position of the manipulator using a 4x4 matrix.*/
void FirstPersonManipulator::setByMatrix( const Matrixd& matrix )
{
   // set variables
   _eye = matrix.getTrans();
   _rotation = matrix.getRotate();

   // fix current rotation
   if( getVerticalAxisFixed() )
      fixVerticalAxis( _eye, _rotation, true );
}