4
$\begingroup$

I am trying to generate a picture similar to the second one found here to illustrate the idea of a rotation matrix defining a new coordinate system. The problem is showing both the original (standard cartesian) set of axes and the transformed (45 degree clockwise about the z axis) axes together in 3D without manually making them a graphic and drawing each axis line. Preferably, I would be able to color the axes, but this isn't strictly necessary.

As a minor other note, if the solution is possible without using some of the more advanced features, that would be prefered.

$\endgroup$

2 Answers 2

1
$\begingroup$

A starting point could be:

\[Theta] = \[Pi]/6;
pts1 = {{{0, 0, 0}, {1, 0, 0}}, {{0, 0, 0}, {0, 1, 0}}};
pts2 = RotationTransform[\[Theta], {0, 0, 1}][#] & /@ pts1;
Graphics3D[Join[{Black, Thickness[0.007], Arrow[{{0, 0, 0}, {0, 0, 1}}]}, 
{Red,Arrow[#] & /@ pts1}, {Blue, Arrow[#] & /@ pts2}], Axes -> True, 
Boxed -> False, AxesOrigin -> {0, 0, 0}, AxesLabel -> {"x", "y", "z"}]

enter image description here

Add

Interactive rotation:

Manipulate[
pts1 = {{{0, 0, 0}, {1, 0, 0}}, {{0, 0, 0}, {0, 1, 0}}};
pts2 = RotationTransform[\[Theta], {0, 0, 1}][#] & /@ pts1;

Graphics3D[Join[{Black, Thickness[0.007], Arrow[{{0, 0, 0}, {0, 0, 1}}]},
{Red,Arrow[#] & /@ pts1}, {Blue, Arrow[#] & /@ pts2},
{Text[Style[#[[1]], 14, Bold, Black], #[[2]]] & /@ {{"x", {1.3, 0, 0}},
{"y", {0, 1.3, 0}}, {"z", {0, 0, 1.3}}}}, 
{Text[Style["x'", 14, Bold, Blue], 
 RotationTransform[\[Theta], {0, 0, 1}][#] & /@ {{1.1, 0.2, 0}}]},
 {Text[Style["y'", 14, Bold, Blue],RotationTransform[\[Theta], {0, 0, 1}][#] & /@ 
 {{-0.2, 1.1, 0}}]},
 {Black, InfiniteLine[#] & /@ pts2}], 
 Axes -> True, Boxed -> False, AxesOrigin -> {0, 0, 0}, 
 PlotRange -> ConstantArray[{-1.1, 1.1}, 3],
 PlotLabel -> "Rotation angle \[Theta] = " <> ToString[TraditionalForm@\[Theta]] <> " rd"],
 {\[Theta], 0, 2 \[Pi], \[Pi]/50}
]

enter image description here

$\endgroup$
2
  • $\begingroup$ While this gives most of the visual I want, I would like the transformed axes to be ruled (in order to drive home the transformed coordinates),just like the axes drawn when you tell graphics axes-> True, and behave similarly. $\endgroup$ Commented Feb 6, 2018 at 7:13
  • $\begingroup$ @BrandonMyers see my edit... $\endgroup$ Commented Feb 6, 2018 at 11:00
0
$\begingroup$

Just to get you started, not a full reproduction of the linked image.

None of these are advanced features, but it does require drawing the lines manually.

i = {1, 0};
j = {0, 1};

originArrow[pt_] := Arrow[{{0, 0}, pt}];

i2 = RotationMatrix[45 Degree].i;
j2 = RotationMatrix[45 Degree].j;

Graphics[{Black, 
  Text["x0", i, {-1, 0}], Text["y0", j, {0, -1}],
  Red, originArrow@i, originArrow@j,
  Black, 
  Text["x'", i2, {-1, 0}], Text["y'", j2, {0, -1}],
  Blue, originArrow@i2, originArrow@j2}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.