Anonymous | Login 2019-10-17 06:52 MSK Project: All Projects Community Open CASCADE
 My View | View Issues | Change Log | Roadmap

View Issue Details  Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0025574Community[OCCT] OCCT:Foundation Classespublic2014-12-09 14:122016-04-20 15:49
ReporterBenjaminBihler
Assigned Toabv
PrioritynormalSeveritymajor
StatusclosedResolutionfixed
PlatformLinuxOSDebian 6.0OS Version32 bit
Product Version[OCCT] 6.8.0
Target Version[OCCT] 7.0.0Fixed in Version[OCCT] 7.0.0
Summary0025574: gp_YawPitchRoll Euler Angle computation gives wrong results
DescriptionIf I perform a Y-P-R rotation by hand and afterwards create a displacement transformation from the origin to the target of the rotation, I would expect it to give me the Euler angles that I have used for the rotation. It doesn't. The values differ.

Please see the code below.
Steps To Reproduce#include <gp_Quaternion.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>

void testEulerAngleRotation()
{
gp_Ax2 world;

// Perform three rotations using the yaw-pitch-roll convention.
// This means: rotate around the original z axis with angle alpha,
// then rotate around the new y axis with angle beta,
// then rotate around the new x axis with angle gamma.
Standard_Real alpha = 0.0 / 180.0 * M_PI;
Standard_Real beta = -35.0 / 180.0 * M_PI;
Standard_Real gamma = 90.0 / 180.0 * M_PI;

const gp_Quaternion rotationZ(world.Direction(), alpha);
const gp_Vec rotY = rotationZ.Multiply(world.YDirection());
const gp_Vec rotX = rotationZ.Multiply(world.XDirection());

const gp_Quaternion rotationY(rotY, beta);
const gp_Vec rotZ = rotationY.Multiply(world.Direction());
const gp_Vec rotRotX = rotationY.Multiply(rotX);

const gp_Quaternion rotationX(rotRotX, gamma);
const gp_Vec rotRotZ = rotationX.Multiply(rotZ);

gp_Ax2 result(gp_Pnt(0.0, 0.0, 0.0), rotRotZ, rotRotX);

// Now compute the Euler angles
gp_Trsf transformation;
transformation.SetDisplacement(gp_Ax2(), result);

Standard_Real computedAlpha;
Standard_Real computedBeta;
Standard_Real computedGamma;

transformation.GetRotation().GetEulerAngles(gp_YawPitchRoll, computedAlpha,
computedBeta, computedGamma);

// We expect now to get the same angles as we have used for our rotations
std::cout << "alpha: " << alpha / M_PI * 180.0 << " and computed alpha: "
<< computedAlpha / M_PI * 180.0 << std::endl;
std::cout << "beta: " << beta / M_PI * 180.0 << " and computed beta: "
<< computedBeta / M_PI * 180.0 << std::endl;
std::cout << "gamma: " << gamma / M_PI * 180.0 << " and computed gamma: "
<< computedGamma / M_PI * 180.0 << std::endl;
}
TagsNo tags attached.
Test case numberbugs fclasses bug25574
Attached Files

Relationships
 related to 0025946 closed shoogen extrinsic Euler conventions in gp_Quaternion