本文整理汇总了C++中Rotation::setRotationFromAngleAboutNonUnitVector方法的典型用法代码示例。如果您正苦于以下问题:C++ Rotation::setRotationFromAngleAboutNonUnitVector方法的具体用法?C++ Rotation::setRotationFromAngleAboutNonUnitVector怎么用?C++ Rotation::setRotationFromAngleAboutNonUnitVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rotation
的用法示例。
在下文中一共展示了Rotation::setRotationFromAngleAboutNonUnitVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doRequiredTasks
//-------------------------------------------------------------------
bool doRequiredTasks( ) {
// Use the next Rotation to test against (simple theta-lambda rotation)
Rotation testRotation;
// Test default constructor
Rotation defaultRotationConstructor;
testRotation.setRotationToIdentityMatrix();
bool test = defaultRotationConstructor.areAllRotationElementsSameToMachinePrecision( testRotation );
// Test copy constructor
testRotation.setRotationFromAngleAboutNonUnitVector( 1.0, Vec3(0.2, 0.4, 0.6) );
Rotation rotationCopyConstructor( testRotation );
test = test && rotationCopyConstructor.areAllRotationElementsSameToMachinePrecision( testRotation );
// Test operator =
Rotation rotationOperatorEqual = testRotation;
test = test && rotationOperatorEqual.areAllRotationElementsSameToMachinePrecision( testRotation );
// Test rotation by angle about arbitrary CoordinateAxis
testRotation.setRotationFromAngleAboutNonUnitVector( 0.1, Vec3(1.0, 0.0, 0.0) );
CoordinateAxis coordAxis = XAxis;
Rotation rotationCoordAxis( 0.1, coordAxis );
test = test && rotationCoordAxis.areAllRotationElementsSameToMachinePrecision( testRotation );
Real testTheta = rotationCoordAxis.convertOneAxisRotationToOneAngle( coordAxis );
test = test && fabs(0.1 - testTheta) < 10*SignificantReal;
// Test rotation by angle about XAxis, YAxis, ZAxis
test = test && testRotationOneAxis( 0.2, XAxis );
test = test && testRotationOneAxis( -0.2, XAxis );
test = test && testRotationOneAxis( 2.1, YAxis );
test = test && testRotationOneAxis( -2.1, YAxis );
test = test && testRotationOneAxis( 3.1, ZAxis );
test = test && testRotationOneAxis( -3.1, ZAxis );
// Test rotation with two angles and two axes XX, XY, XZ
test = test && testRotationTwoAxes( BodyRotationSequence, 0.2, XAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 0.2, XAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, 1.2, XAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 1.2, XAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, -3.1, XAxis, 1.2, ZAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, -3.1, XAxis, 1.2, ZAxis );
// Test rotation with two angles and two axes YX, YY, YZ
test = test && testRotationTwoAxes( BodyRotationSequence, 1.2, YAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 1.2, YAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, 2.2, YAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 2.2, YAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, -3.1, YAxis, 1.2, ZAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, -3.1, YAxis, 1.2, ZAxis );
// Test rotation with two angles and two axes ZX, ZY, ZZ
test = test && testRotationTwoAxes( BodyRotationSequence, 1.2, ZAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 1.2, ZAxis, 0.3, XAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, 2.2, ZAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, 2.2, ZAxis,-1.3, YAxis );
test = test && testRotationTwoAxes( BodyRotationSequence, -3.1, ZAxis, 1.2, ZAxis );
test = test && testRotationTwoAxes( SpaceRotationSequence, -3.1, ZAxis, 1.2, ZAxis );
// Test the construction of rotations from two given axes.
const UnitVec3 vi(0.01, 0.02, .9);
const Vec3 vj(-0.5, 0.5, 0.2);
test = test && testRotationFromTwoGivenAxes(vi, XAxis, vj, YAxis);
test = test && testRotationFromTwoGivenAxes(vi, YAxis, vj, XAxis);
test = test && testRotationFromTwoGivenAxes(vi, YAxis, vj, ZAxis);
test = test && testRotationFromTwoGivenAxes(vi, ZAxis, vj, YAxis);
test = test && testRotationFromTwoGivenAxes(vi, ZAxis, vj, XAxis);
test = test && testRotationFromTwoGivenAxes(vi, XAxis, vj, ZAxis);
// Test rotation with three angles and three axes XXX, XXY, XXZ, XYX, XYY, XYZ, XZX, XZY, XZZ
test = test && testRotationThreeAxes( BodyRotationSequence, 0.2, XAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 0.2, XAxis, 0.3, XAxis, 0.4, XAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, 1.2, XAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, 1.2, XAxis,-1.3, XAxis,-1.4, YAxis );
test = test && testRotationThreeAxes( BodyRotationSequence, -3.1, XAxis, 1.2, XAxis, 1.3, ZAxis );
test = test && testRotationThreeAxes( SpaceRotationSequence, -3.1, XAxis, 1.2, XAxis, 1.3, ZAxis );
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 );
//.........这里部分代码省略.........