Mathematica Asked by user49535 on December 23, 2020
The Mathematica function EulerMatrix[{Alpha, Beta, Gamma},{a,b,c}]
gives the Euler matrix for rotation about X, Y and Z axes. Here by choosing the order of a, b and c, we can change the order of rotations with respect to the three axes.
My question is, how to find Euler matrix for a rotation for which the "old" axes are not X, Y and Z axes. For example, I want to find a Euler Matrix in {3, 1, 3} format for which Old axes are, Axis 1 = {1, -1, 0}, Axis 2 = {1, 1, -2} and Axis 3 = {1, 1, 1}.
Will appreciate any help. Thanks
Edit:
You could use RotationMatrix
to build your own EulerMatrix by rotating about your custom axes 1,2, and 3.
First check that you can reproduce EulerMatrix[{[Alpha], [Beta], [Gamma]}, {3, 1, 3}]
with RotationMatrix
:
RotationMatrix[[Alpha], {0, 0, 1}].RotationMatrix[[Beta], {1, 0,0}].RotationMatrix[[Gamma], {0, 0, 1}]
(* Check this is equivalent to EulerMatrix[{[Alpha], [Beta], [Gamma]}, {3, 1, 3}] *)
EulerMatrix[{[Alpha], [Beta], [Gamma]}, {3, 1, 3}] - % // Simplify
(* {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} *)
Now rotate about your custom axes 1,2,3 in the format 3-1-3:
(* Define custom axis *)
Axis1 = {1, -1, 0}; Axis2 = {1, 1, -2}; Axis3 = {1, 1, 1};
(* Euler Matrix in 3-1-3 format about the custom axis*)
RotationMatrix[[Alpha], Axis3].RotationMatrix[[Beta],Axis1].RotationMatrix[[Gamma], Axis3]//Simplify
Answered by Ferca on December 23, 2020
It is simpler to work with normalized axes. If you have old axes given by: old={{1,0,0},{0,1,0},0,0,1}} and you want Euler rotation around new axes: new, you may rotate a vector vec relative to the new system by first transforming the vector to the new system, apply the Euler rotation and transform the vector back to the old system.
Toward this aim, we define a rotation matrix (axis rotation matrix): arm that rotates the old axes into new axes. Note that the columns of this matrix are the new axis in the old system. Further,this matrix transforms coordinates from the old system into coordinates in the new system. We define a second rotation matrix (vector rotation matrix): vrm, that rotates a vector vec={1,1,1}/Sqrt[3] in the new system. Here is the code and graphics for this:
old = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
orig = {0, 0, 0};
vec = {1, 1, 1}/Sqrt[3];
Row[{Red, "Vector ", Green, "New Axes ", Black, "Old Axes"}]
Manipulate[
arm = EulerMatrix[{a, b, c}];
vrm = EulerMatrix[{va, vb, vc}];
rotvec = Inverse[arm].vrm.arm.vec;(*here is the vector rotated*)
Graphics3D[{
Arrow[{orig, #}] & /@ old
, Green, Arrow[{orig, #}] & /@ Transpose@arm,
MapThread[Text[#2, 1.1 #1] &, {Transpose@arm, {"xn", "yn", "zn"}}]
, Red, Arrow[{orig, #}] &[rotvec]
}, SphericalRegion -> True, Axes -> True, BoxRatios -> {1, 1, 1},
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}]
, {{va, 0, "a-vec"}, 0, 2 Pi}, {{vb, 0, "b-vec"}, 0,
Pi}, {{vc, 0, "c-vec"}, 0, 2 Pi}, {{a, 0, "a-axes"}, 0,
2 Pi}, {{b, 0, "b-axes"}, 0, Pi}, {{c, 0, "c-axes"}, 0, 2 Pi}]
Answered by Daniel Huber on December 23, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP