How can I apply 2 rotations on a shape ?

I rotate a shape with gp_Trsf.SetRotation(). The first around Y and the second around X. The problem is that the second rotation seem rotate around an X axes in a rotated coord. system, not the original X axes. How can I rotate around the original X axes ?

gp_Trsf aTrsf1,aTrsf2;
aTrsf1.SetRotation(gp::OY(),.7);
aTrsf2.SetRotation(gp::OX(),.2);

gp_Trsf FTrasf = aTrsf2 * aTrsf1;

BRepBuilderAPI_Transform aBRepTrsf(aPrism, FTrasf);
aNewPrism = FTrasf.Shape();

Rob Bachrach's picture

Try reversing your dot product. I think you will see the desired result:

gp_Trsf FTrasf = aTrsf1 * aTrsf2;

Sharjith Naramparambath's picture

Perform both rotations independantly like this...

gp_Trsf aTrsf1,aTrsf2;
aTrsf1.SetRotation(gp::OY(),.7);
aTrsf2.SetRotation(gp::OX(),.2);

BRepBuilderAPI_Transform aBRepTrsf(aPrism, aTrsf1);
BRepBuilderAPI_Transform aBRepTrsf(aPrism, aTrsf2);
aNewPrism = aBrepTrsf.Shape();

Hope this solves your problem