Bug introduced in 8.0.4 or earlier and persisting through 11.2.0 or later, fixed in 12.0
(Edited to simplify drawing)
I have a drawing of two tangent circles:
circles = {Circle[{0, 0}, 1], Circle[{0, 0.5}, 0.5]};
Graphics[circles, ImageSize -> Small]
But when I draw a transformed version of it, the circles become misaligned in an erratic fashion. It seems to be dependent on the PlotRange
or something like that:
GraphicsGrid@
Partition[
Table[Graphics[
Rotate[Scale[circles, 12, {0, 0}], -45 Degree, {0, 0}],
PlotRange -> {{-a, a}, {-a, a}}, ImageSize -> 100], {a, 11, 20}],
5]
The error does not occur if either Scale
or Rotate
are removed, so apparently the two transformations are interacting badly. But why should they? Am I doing something wrong, or is this a bug?
(N.B. This is with a fresh kernel; Mathematica 10.0.1 on Mac.)
Right now I'm getting around the problem by defining something like
scaledCircles = With[{s = 12},
circles /. Circle[{x_, y_}, r_] :> Circle[{s x, s y}, s r]];
and then only applying Rotate
to it. But that's no way to live.
The documentation states that "When possible, Normal
will transform the coordinates explicitly" and gives an example of the form Normal@Scale[Cuboid...]
. So if it worked it would be a nice and automatic way to do my workaround. But Normal
doesn't work on scaled circles, for no reason I can fathom.
Manipulate[Graphics[Rotate[Scale[eye, 12.], -π/4], PlotRange -> {{-a, a}, {-a, a}}], {a, 100, 140}]
$\endgroup$