当前位置: 首页>>代码示例>>C++>>正文


C++ Matrixd::getRotate方法代码示例

本文整理汇总了C++中Matrixd::getRotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrixd::getRotate方法的具体用法?C++ Matrixd::getRotate怎么用?C++ Matrixd::getRotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrixd的用法示例。


在下文中一共展示了Matrixd::getRotate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendMatrix

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();
}
开发者ID:mchao92,项目名称:magiclens,代码行数:32,代码来源:myserverthread.cpp

示例2: setByMatrix

/** 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 );
}
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:11,代码来源:FirstPersonManipulator.cpp

示例3: computeNodeCenterAndRotation

void SceneGraphManipulator::computeNodeCenterAndRotation(Vec3d& nodeCenter, Quat& nodeRotation) const
{
    Matrixd localToWorld;
    computeNodeLocalToWorld(localToWorld);

    if (validateNodePath())
        nodeCenter = Vec3d(_trackNodePath.back()->getBound().center())*localToWorld;
    else
        nodeCenter = Vec3d(0.0f,0.0f,0.0f)*localToWorld;

    // scale the matrix to get rid of any scales before we extract the rotation.
    double sx = 1.0/sqrt(localToWorld(0,0)*localToWorld(0,0) + localToWorld(1,0)*localToWorld(1,0) + localToWorld(2,0)*localToWorld(2,0));
    double sy = 1.0/sqrt(localToWorld(0,1)*localToWorld(0,1) + localToWorld(1,1)*localToWorld(1,1) + localToWorld(2,1)*localToWorld(2,1));
    double sz = 1.0/sqrt(localToWorld(0,2)*localToWorld(0,2) + localToWorld(1,2)*localToWorld(1,2) + localToWorld(2,2)*localToWorld(2,2));
    localToWorld = localToWorld*Matrixd::scale(sx,sy,sz);

    nodeRotation = localToWorld.getRotate();
}
开发者ID:ConfusedReality,项目名称:pkg_augmented-reality_polAR,代码行数:18,代码来源:SceneGraphManipulator.cpp

示例4: set

void Quat::set(const Matrixd& matrix)
{
    *this = matrix.getRotate();
}
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:4,代码来源:Quat.cpp

示例5: setByMatrix

void TerrainManipulator::setByMatrix(const Matrixd& matrix)
{

    Vec3d lookVector(- matrix(2,0),-matrix(2,1),-matrix(2,2));
    Vec3d eye(matrix(3,0),matrix(3,1),matrix(3,2));

    OSG_INFO<<"eye point "<<eye<<std::endl;
    OSG_INFO<<"lookVector "<<lookVector<<std::endl;

    if (!_node)
    {
        _center = eye+ lookVector;
        _distance = lookVector.length();
        _rotation = matrix.getRotate();
        return;
    }


    // need to reintersect with the terrain
    const BoundingSphere& bs = _node->getBound();
    float distance = (eye-bs.center()).length() + _node->getBound().radius();
    Vec3d start_segment = eye;
    Vec3d end_segment = eye + lookVector*distance;

    Vec3d ip;
    bool hitFound = false;
    if (intersect(start_segment, end_segment, ip))
    {
        OSG_INFO << "Hit terrain ok A"<< std::endl;
        _center = ip;

        _distance = (eye-ip).length();

        Matrixd rotation_matrix = Matrixd::translate(0.0,0.0,-_distance)*
                                  matrix*
                                  Matrixd::translate(-_center);

        _rotation = rotation_matrix.getRotate();

        hitFound = true;
    }

    if (!hitFound)
    {
        CoordinateFrame eyePointCoordFrame = getCoordinateFrame( eye );

        if (intersect(eye+getUpVector(eyePointCoordFrame)*distance,
                      eye-getUpVector(eyePointCoordFrame)*distance,
                      ip))
        {
            _center = ip;

            _distance = (eye-ip).length();

            _rotation.set(0,0,0,1);

            hitFound = true;
        }
    }


    CoordinateFrame coordinateFrame = getCoordinateFrame(_center);
    _previousUp = getUpVector(coordinateFrame);

    clampOrientation();
}
开发者ID:yueying,项目名称:osg,代码行数:66,代码来源:TerrainManipulator.cpp


注:本文中的Matrixd::getRotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。