I don't understand why Rotate[] and Translate[] behave differently. For example, ga and gb below look as I expected:

ga = Graphics[Line[{{0, 0}, {1, 0}}]];
gb = Rotate[ga, \[Pi]/4, {0, 0}];
gc = Translate[gb, {1, 1}];

But gc results in this: enter image description here


Your problem here is that you are calling Graphics too early. You want to Rotate and Translate the Line, not the Graphics.

ga = Line[{{0, 0}, {1, 0}}];
gb = Rotate[ga, \[Pi]/4, {0, 0}];
gc = Translate[gb, {1, 1}];

Will do what you want.

Graphics[{Red, ga, Blue, gb, Green, gc}]

enter image description here

  • $\begingroup$ Thank you! ${}{}$ $\endgroup$ – Joseph O'Rourke Sep 5 '20 at 15:15
  • $\begingroup$ Happy to help! :) $\endgroup$ – Carl Lange Sep 5 '20 at 15:15
  • $\begingroup$ @JosephO'Rourke just to add to this: for some reason WRI decided that Rotate should also be able to rotate arbitrary stuff displayed on the screen outside of a Graphics call, which is why your gb seemed to work. $\endgroup$ – b3m2a1 Sep 30 '20 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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