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


C++ Matrix3::getColumn方法代码示例

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


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

示例1: getWorldTransform

/** get the world tansform of the linked position
 * @param worldTrans out parameter to palce transform in
 * @warning this method is called by physics library and should
 * not be called directly
 */
void MotionState::getWorldTransform(btTransform &worldTrans) const
{
	// set the location/origin
	Vector3 l = this->shape._getTranslation();
    if (this->position != nullptr)
        l += this->position->getLocation();
	worldTrans.setOrigin (btVector3(l.x(), l.y(), l.z()));
	
	// set the basis/rotational matrix
	// since openGL matrix is column major and Bullet is row
	// major, we have to do some converting

    Matrix3 matrix;
    if (this->position != nullptr)
    {
        matrix.setColumn(0, this->position->getLocalXAxis());
        matrix.setColumn(1, this->position->getUpVector());
        matrix.setColumn(2, this->position->getForwardVector());
    }
    matrix.multiply(this->shape._getRotation());


    btMatrix3x3 rot;
    rot.setValue(

        // fill in x axis, first column
        matrix.getColumn(0).x(),
        matrix.getColumn(0).y(),
        matrix.getColumn(0).z(),

        // fill in y axis, second column
        matrix.getColumn(1).x(),
        matrix.getColumn(1).y(),
        matrix.getColumn(1).z(),
                                
        // fill in z axis, thrid column
        matrix.getColumn(2).x(),
        matrix.getColumn(2).y(),
        matrix.getColumn(2).z()
    
    );
	worldTrans.setBasis(rot);
}
开发者ID:anobin,项目名称:3DMagic,代码行数:48,代码来源:MotionState.cpp

示例2: return

Real
estimateScalingFactor(Matrix3 const & m)
{
  return (m.getColumn(0).fastLength() + m.getColumn(1).fastLength() + m.getColumn(2).fastLength()) / 3.0f;
}
开发者ID:daerduoCarey,项目名称:Thea,代码行数:5,代码来源:Math.cpp

示例3: orthonormalBasisMatrix

Matrix3
orthonormalBasisMatrix(Matrix3 const & m)
{
  return orthonormalBasisMatrix(m.getColumn(0), m.getColumn(1), m.getColumn(2));
}
开发者ID:daerduoCarey,项目名称:Thea,代码行数:5,代码来源:Math.cpp

示例4:

inline Vector3 Camera::getWorldRVector() const
{
	Matrix3 m = world.getRotate();
    return m.getColumn(2);
}
开发者ID:pensistudios,项目名称:Ey3,代码行数:5,代码来源:Ey3Camera.cpp

示例5:

bool WindowedApp3d::moveObject ()
{
    // The coordinate system in which the rotations are applied is that of
    // the object's parent, if it has one.  The parent's world rotation
    // matrix is R, of which the columns are the coordinate axis directions.
    // Column 0 is "direction", column 1 is "up", and column 2 is "right".
    // If the object does not have a parent, the world coordinate axes are
    // used, in which case the rotation matrix is I, the identity.  Column 0
    // is (1,0,0) and is "direction", column 1 is (0,1,0) and is "up", and
    // column 2 is (0,0,1) and is "right".  This choice is consistent with
    // the use of rotations in the Camera and Light classes to store
    // coordinate axes.
    //
    // Roll is about the "direction" axis, yaw is about the "up" axis, and
    // pitch is about the "right" axis.

    if ( !m_bCameraMoveable || !motionObject )
        return false;

    RenderObject* pkParent = motionObject->getParent();
    Vector3 kAxis;
    float fAngle;
    Matrix3 kRot, kIncr;

	Matrix3 m;
    if ( m_iDoRoll )
    {
		
		motionObject->localTrans.getMatrix(m);
        kRot = m;

        fAngle = m_iDoRoll*m_fRotSpeed;
        if ( pkParent )
		{
			pkParent->worldTrans.getMatrix(m);	
            kAxis = m.getColumn(0);
		}
        else
            kAxis = Vector3::UNIT_X;

        kIncr.fromAxisAngle(kAxis,fAngle);
        motionObject->localTrans.setMatrix(kIncr*kRot);
        return true;
    }
	
    if ( m_iDoYaw )
    {
		motionObject->localTrans.getMatrix(m);
        kRot = m;

        fAngle = m_iDoYaw*m_fRotSpeed;
        if ( pkParent )
		{
			pkParent->worldTrans.getMatrix(m);	
            kAxis = m.getColumn(1);
		}
        else
            kAxis = Vector3::UNIT_Y;

        kIncr.fromAxisAngle(kAxis,fAngle);
        motionObject->localTrans.setMatrix(kIncr*kRot);
        return true;
    }

    if ( m_iDoPitch )
    {
		motionObject->localTrans.getMatrix(m);
        kRot = m;

        fAngle = m_iDoPitch*m_fRotSpeed;
        if ( pkParent )
		{
            pkParent->worldTrans.getMatrix(m);	
            kAxis = m.getColumn(2);
		}
        else
            kAxis = Vector3::UNIT_Z;

        kIncr.fromAxisAngle(kAxis,fAngle);
        motionObject->localTrans.setMatrix(kIncr*kRot);
        return true;
    }

    return false;
}
开发者ID:pensistudios,项目名称:Ey3,代码行数:85,代码来源:Ey3WindowedApp3d.cpp


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