Piece::Piece(const boost::shared_ptr<Board>& board, unsigned int row, unsigned int column) : mType(Bar), mColumn(column), mRow(row), mBoard(board), mStuck(false) { mType = getRandomType(); mRotation = getRandomRotation(); for(int k=0; k<sNumBlocks; ++k) { mColors[k] = Block::getRandomColor(); } turnOn(); }
void getRandomPose(double Pose[16]) { double R[9], t[3]; srand((unsigned int)time(0)); getRandomRotation(R); t[0] = (float)rand()/(float)(RAND_MAX); t[1] = (float)rand()/(float)(RAND_MAX); t[2] = (float)rand()/(float)(RAND_MAX); rtToPose(R,t,Pose); }