0
votes

Using HelixToolkit in my code i have a rotation matrix (3x3) like :

UX  VX  WX

UY  VY  WY

UZ  VZ  WZ

And i want to rotate a GeometryModel3D. I found the RotateTransform3D and i need a Vector3D with an angle :

// Create and apply a transformation that rotates the object.
RotateTransform3D myRotateTransform3D = new RotateTransform3D();
 AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
**myAxisAngleRotation3d.Axis = new Vector3D(0, 3, 0);
myAxisAngleRotation3d.Angle = 40;**
myRotateTransform3D.Rotation = myAxisAngleRotation3d;
// Add the rotation transform to a Transform3DGroup
Transform3DGroup myTransform3DGroup = new Transform3DGroup();
myTransform3DGroup.Children.Add(myRotateTransform3D);
//ajoute the transformation to the model
model3D.Transform = myTransform3DGroup;

How can i calculate the vector and the angle from my rotation matrix ?

1

1 Answers

1
votes

If you already calculated the matrix, you can just use it with a general MatrixTransform3D. Just set the values of the matrix to the calculated ones.

If, however, you really want to calculate the rotation axis and angle, you have to solve a linear equation system. Take a look at the Wikipedia entry. But then, you would calculate far too much than you actually need.