本文整理汇总了C++中Rotation::asMat33方法的典型用法代码示例。如果您正苦于以下问题:C++ Rotation::asMat33方法的具体用法?C++ Rotation::asMat33怎么用?C++ Rotation::asMat33使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rotation
的用法示例。
在下文中一共展示了Rotation::asMat33方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertAnglesToDirectionCosines
/**
* Convert angles to direction cosines.
* @param aE1 1st Euler angle.
* @param aE2 2nd Euler angle.
* @param aE3 3rd Euler angle.
* @param rDirCos Vector of direction cosines.
*/
void SimbodyEngine::convertAnglesToDirectionCosines(double aE1, double aE2, double aE3, double rDirCos[3][3]) const
{
Vec3 angs(aE1, aE2, aE3);
Rotation aRot;
aRot.setRotationToBodyFixedXYZ(angs);
Mat33::updAs(&rDirCos[0][0]) = aRot.asMat33();
}
示例2: convertQuaternionsToDirectionCosines
/**
* Convert quaternions to direction cosines.
* @param aQ1 1st Quaternion.
* @param aQ2 2nd Quaternion.
* @param aQ3 3rd Quaternion.
* @param aQ4 4th Quaternion.
* @param rDirCos Vector of direction cosines.
*/
void SimbodyEngine::convertQuaternionsToDirectionCosines(double aQ1, double aQ2, double aQ3, double aQ4, double rDirCos[3][3]) const
{
Rotation R;
R.setRotationFromQuaternion(Quaternion(Vec4(aQ1, aQ2, aQ3, aQ4)));
Mat33::updAs(&rDirCos[0][0]) = R.asMat33();
}
示例3: doRequiredTasks
//.........这里部分代码省略.........
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, XAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, XAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, XAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, XAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, XAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, XAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, XAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, XAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, XAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, XAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, XAxis, 1.2, ZAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, XAxis, 1.2, ZAxis, 1.3, ZAxis );
// Test rotation with three angles and three axes YXX, YXY, YXZ, YYX, YYY, YYZ, YZX, YZY, YZZ
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, YAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, YAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, YAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, YAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, YAxis, 1.2, XAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, YAxis, 1.2, XAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, YAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, YAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, YAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, YAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, YAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, YAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, YAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, YAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, YAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, YAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, YAxis, 1.2, ZAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, YAxis, 1.2, ZAxis, 1.3, ZAxis );
// Test rotation with three angles and three axes ZXX, ZXY, ZXZ, ZYX, ZYY, ZYZ, ZZX, ZZY, ZZZ
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, ZAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, ZAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, ZAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, ZAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, ZAxis, 1.2, XAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, ZAxis, 1.2, XAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, ZAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, ZAxis, 0.3, YAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, ZAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, ZAxis,-1.3, YAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, ZAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, ZAxis, 1.2, YAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, ZAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, ZAxis, 0.3, ZAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, ZAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, ZAxis,-1.3, ZAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, ZAxis, 1.2, ZAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, ZAxis, 1.2, ZAxis, 1.3, ZAxis );
// This used to fail
test = test && testRotationThreeAxes( BodyRotationSequence, -3.2288591161895095, XAxis, -3.1415926535897931, YAxis, -3.1415926535897931, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.2288591161895095, XAxis, -3.1415926535897931, YAxis, -3.1415926535897931, XAxis );
// Test Rotation quaternion methods.
test = test && testQuaternion( 0.5, 0.1, 0.2, 0.3 );
test = test && testQuaternion(-0.5, 0.1, 0.2, -0.3 );
Quaternion unnorm(Vec4(1,2,3,4), true); // don't do this at home
SimTK_TEST_NOTEQ(unnorm.norm(), Real(1)); // shouldn't have normalized
Quaternion fixedUp;
fixedUp = unnorm.normalize();
SimTK_TEST_EQ(fixedUp.norm(), Real(1));
unnorm.normalizeThis();
SimTK_TEST_EQ(unnorm.norm(), Real(1));
// Test construction of nearby orthogonal rotation matrix from a generic Mat33.
Rotation nearbyRotation( testRotation.asMat33() );
test = test && nearbyRotation.areAllRotationElementsSameToMachinePrecision( testRotation );
// Exhaustive test of 1-angle, 2-angle, and 3-angle rotations
test = test && exhaustiveTestof1AngleRotation();
test = test && exhaustiveTestof2AngleRotation();
test = test && exhaustiveTestof3AngleRotation();
// Exhaustive test of 3-angle rotations near singularity
test = test && exhaustiveTestof3AngleTwoAxesRotationNearSingularity();
test = test && exhaustiveTestof3AngleThreeAxesRotationNearSingularity();
// Exhaustive test of Quaterions
test = test && exhaustiveTestofQuaternions();
// Test special handling of body-fixed XYZ.
test = test && testSetRotationToBodyFixedXYZ();
// Test out special code for rotating symmetric matrices.
test = test && testReexpressSymMat33();
return test;
}