0
$\begingroup$

I have a 10x10 grid of unit squares (picture a partial coordinate grid bounded by (0,0) and (10,10)) given by

squares = Table[Table[
              Graphics[{EdgeForm[Directive[Black]],
                        White,
                        Rectangle[{i-1,j-1}]
                       }], {j, 1, 10}], {i, 1, 10}];

grid = Show[squares]

and a field of parallel red lines with slope 1,

lines = Table[Graphics[{Red,
                        Thickness[.0025],
                        Line[{{-5-i, -5}, {15-i, 15}}]
                       }], {i, -10, 10}];
lights = Show[lines]

I'm trying to visualize which cells each line passes through as the grid rotates in increments of 10 degrees. However, I get an error when trying to evaluate

Show[{Rotate[grid, 10 Degree], lights}]

Is there some way I can manipulate the grid (i.e. rotate it about its center) while keeping the lines at their fixed position?

$\endgroup$
  • 1
    $\begingroup$ With your last line of code you are rotating the shown image, not the underlying entities! Look at Rotate's examples in the documentation. $\endgroup$ – Aisamu Nov 20 '14 at 20:30
  • $\begingroup$ Yes, I see the problem. Thanks for the heads up $\endgroup$ – user170231 Nov 21 '14 at 3:34
  • $\begingroup$ Also, I'd like to mention that I found a better way for writing up my grid using Graphics[Table[...]] instead of Table[Graphics[...]] $\endgroup$ – user170231 Nov 21 '14 at 3:35

Your Answer

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

Browse other questions tagged or ask your own question.