Mathematica Asked by David E Speyer on December 17, 2020
I am trying to create a notebook which will graphically display the effect of simple geometric maps, for the purpose of teaching linear algebra. Here is what I thought would work.
I created an image called map. It is 920 pixels wide and 797 tall. Here it is displayed on background coordinate axes.
Show[map, Axes -> True, PlotRange -> {{-1200, 1200}, {-1200, 1200}}]
Now, I want to show this image rotated by $pi/6$ around $(0,0)$. Here is what I thought would work:
Show[
ImageForwardTransformation[map, ({{Cos[Pi/6], -Sin[Pi/6]}, {Sin[Pi/6], Cos[Pi/6]}}.#) &,
PlotRange -> All],
Axes -> True, PlotRange -> {{-1200, 1200}, {-1200, 1200}}]
Here is the output:
As you can see, the origin is in the wrong place! I expected ImageForwardTransformation to create a new image whose image coordinates would be rotated from the old image coordinates. For example, if $0 < theta < pi/2$, and the old coordinates are $[0,w] times [0,h]$, then the new ones would be $[-(sin theta) h, (cos theta) w] times [0, (sin theta) w + (cos theta) h]$.
Instead, it seems that ‘ImageForwardTransform[]’ always translates the lower left pixel to be at $(0,0)$, so the new coordinates are $[0, (cos theta) w+(sin theta) h] times [0, (sin theta) w + (cos theta) h]$.
I tried a bunch of variants on the above code, but I think I am missing something basic and it probably isn’t useful to copy over all the failures. Is there an easy way to make ‘ImageForwardTransform[]’ work correctly with axes and other graphics objects? Or is there some variant function I should be using instead? (I tried ImageGraphics and Rotate instead, with the idea of using graphics objects everywhere instead of images, but that didn’t work either; I’ll add details of the failure if people want.)
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP