Is there a method to rotate a frame or object?
this is my attempt(rotate y 90 degrees):
TxTransformation select; TxTransformation fr = new TxTransformation( 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0); TxTransformation ry90 = select * fr;
The result is the same as the manual rotation of the y-axis 90 degrees
and I try this:
but the result is not correct.
Solved! Go to Solution.
TxTransformation consists of 3X3 rotation matrix and translation vector.
Setting the RotationRPY_XYZ, set the 3X3 matrix.
It is using the Roll-Pitch-Yaw X_Y_Z method, meaning rotation are done relative to the fixed original axes, in the order
rotation around X axis, then rotation around Y axis, and finally around Z axis.
Hope it answered your question....
I am rotating Location which is almost the same like frame for 180 degree. Important in this case is that you change absolute location and not only rotation! But like Yizhar mention this is the matrix, so for example if you change RY for 180 degrees also values RX and RZ will change but orientation will be ok.
Here is part of my code:
private void m_btnRx_Click(object sender, EventArgs e)
double rx = FlipLocation.AbsoluteLocation.RotationRPY_XYZ.X;
double ry = FlipLocation.AbsoluteLocation.RotationRPY_XYZ.Y;
double rz = FlipLocation.AbsoluteLocation.RotationRPY_XYZ.Z;
double degreeRx = RadToDegree(rx);
double flipedRx = FlipRotation(degreeRx);
double newRx = DegreeToRad(flipedRx);
TxTransformation absLoc = FlipLocation.AbsoluteLocation;
absLoc.RotationRPY_XYZ = new TxVector(newRx,ry,rz);
FlipLocation.AbsoluteLocation = absLoc;
private double FlipRotation(double rotation)
if (rotation > 0)
newRotation = rotation - 180;
newRotation = rotation + 180;
Hope this will somehow help you!
There are two options for rotating existing matrix:
The result of both methods is the same.
If used several times in a loop, option #1 tent to accumulate more calculation errors, as both, creating matrix from rotations and extracting rotation from matrix involved in many trigonometric calculation.
The second method is more stable, as include just matrix multifaction.