8
$\begingroup$

Bug introduced in 8.0 or earlier and persisting through 13.2 or later. Fixed in 13.3.1 on Windows 10


I have the following mapping on the complex plane: $$ z \mapsto \tau \mu z-1, $$ where $\mu$ is complex, $\tau$ is real number. I want to draw the image of left unit semidisk and play with $\tau$.

μ = 0.16255558520216132` + 0.1849493244071408` I;

pic[τ_] := Block[{d, ds},
   d = Disk[{0, 0}, 1, {π/2, 3 π/2}];
   ds =
    Fold[GeometricTransformation, d,
       {RotationTransform[Arg@#, {0, 0}],
        ScalingTransform[τ Abs@# {1, 1}],
        TranslationTransform[{-1, 0}]
        }] & @ μ;
   Graphics@{Gray, d, Red, Opacity[.5], ds}
   ];

Manipulate[
 Dynamic@Show[pic[τ], Frame -> True, Axes -> True, 
   AxesOrigin -> {0, 0}, PlotRange -> zz {{-100, 100}, {-100, 100}},
   ImageSize -> 400
   ],
 {τ, 0.01, 1000, 0.01},
 {zz, 0.01, 10, 0.01}
 ]

Here zz is introduced to control zooming. The problem is that I get different (wrong) images for different zooms. It is clearly seen for big $\tau$'s.

enter image description hereenter image description hereenter image description here

It looks very like a bug, but I can not rule out that I'm making some silly mistake (Mathematica 8.0.4). So, what is the problem here and what is the best way of doing the job (I have several mappings for different $\mu$ actually)?

$\endgroup$
8
  • 1
    $\begingroup$ I'd have implemented pic[] this way: pic[τ_] := Block[{d, ds}, d = Disk[{0, 0}, 1, {π/2, 3 π/2}]; ds = GeometricTransformation[d, Composition[TranslationTransform[{-1, 0}], ScalingTransform[τ Abs[μ] {1, 1}], RotationTransform[Arg[μ], {0, 0}]]]; Graphics @ {Gray, d, Red, Opacity[.5], ds}] $\endgroup$ Aug 17, 2012 at 17:24
  • 3
    $\begingroup$ Here's another way to visualize your transformation of a disk: ParametricPlot[Through[{Re, Im}[τ μ r Exp[I θ] - 1]], {r, 0, 1}, {θ, π/2, 3 π/2}]] $\endgroup$ Aug 17, 2012 at 17:38
  • $\begingroup$ @J.M. thank you very much! Unfortunately Composition produces the same erroneous result. ParametricPlot is a viable alternative. Still the problem with composite GeometricTransformations remains. $\endgroup$
    – faleichik
    Aug 17, 2012 at 20:18
  • 2
    $\begingroup$ Minimal example of the problem: Evaluate Graphics@GeometricTransformation[Disk[],Composition[ScalingTransform[{800,800}],RotationTransform[0.1,{0,0}]]] and resize the graphic with the mouse. $\endgroup$ Aug 17, 2012 at 21:41
  • 1
    $\begingroup$ You can apply the transformations beforehand to the key-coordinates of the disk, which transforms Disk[{0, 0}, 1, {α, β}] to Disk[{-1, 0}, τ Abs[μ], {α, β} + Arg[μ]]. This explicit form will work fine with Graphics. $\endgroup$
    – Silvia
    Aug 18, 2012 at 17:57

1 Answer 1

4
$\begingroup$

This is surely a bug. The misbehavior certainly persists through V10.2. In fact, the two images below are of the same computation. The only difference is where they appear on the screen (as I scrolled the notebook, the transformed red disk jumped around).

μ = 0.16255558520216132` + 0.1849493244071408` I;

pic[τ_] := Block[{d, ds, arc},
   d = Disk[{0, 0}, 1, {π/2, 3 π/2}];
   ds = GeometricTransformation[d, 
       TranslationTransform[{-1, 0}] . 
        ScalingTransform[τ Abs@# {1, 1}] .
        RotationTransform[Arg@#, {0, 0}]] &@ μ;
   Graphics@ {Gray, d, Red, Opacity[.5], ds}];

Manipulate[
 Dynamic@Show[pic[τ], Frame -> True, Axes -> True, 
   AxesOrigin -> {0, 0}, PlotRange -> 100 zz , 
   ImageSize -> 222],
 {τ, 0.01, 1000, 0.01}, {zz, 0.01, 10, 0.01}]

As others have observed, PlotRange and ImageSize can affect what is displayed.

Note that the graphics are sent to the front end with the disk inside GeometricTransformationBox (one with my code, three nested ones with the OP's code). They appear to be correct, so the issue is with the front end (or possibly the GPU, I suppose). The workarounds by Silvia and J. M. avoid the use of GeometricTransformationBox. This sort of misbehavior has been noted since, e.g. Weird behaviour when using Scale, Rotate in Graphics.

$\endgroup$
1

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.