Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica: Unable to zoom in/out using the mouse on a 3D graphics after Rotate[]

I made 3D graphics, and using the known method of zooming, which is to hold the Ctrl and now slide the mouse up and down to zoom in and out as described here

http://reference.wolfram.com/mathematica/howto/RotateZoomAndPanGraphics.html

This works ok.

But now I issue the command Rotate[g,90 Degree], and try to zoom on the generate plot (in the new output cell). But the zoom no longer works on that new rotated image.

I see it blinking black each time I slide the mouse, but it does not zoom in nor out.

Here is the command

     g=Graphics3D[ Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
        AxesOrigin->{0,0,0},
        PlotRange->{{-1,1},{-1,1},{-1,1}},
        Axes->True,
        AxesLabel->{"X","Y","Z"},
        ViewPoint->Front,
        Ticks->None]

now zoom works ok. Now type

 Rotate[g,90 Degree]

Now try zoom on the result of the above command. It does not work.

version 8.0.1, windows 7

thanks

like image 724
Nasser Avatar asked Nov 05 '22 21:11

Nasser


2 Answers

You are right, there is a bug in the interface.

After a few tries, pressing Ctrl and the mouse buttons, I was able to get a weird display:

enter image description here

And the zooming works (although inconsistently), but ... moving the mouse left to right!

like image 65
Dr. belisarius Avatar answered Nov 15 '22 09:11

Dr. belisarius


I think this is either an abusive or unanticipated use of the Rotate command, depending on your perspective.

Rotate creates a RotationBox wrapper that instructs the FrontEnd (I believe) to rotate it's contents. When you apply this to an object with its own rotation controls, you have conflicting methods.

Generally speaking, Rotate should not be used on dynamic elements. Consider this modified example from the documentation:

DynamicModule[{p1 = {0, 0}, p2 = {1, 0}, p3 = {0, 1}},
 {Framed@
   Graphics[Polygon[{Dynamic[p1], Dynamic[p2], Dynamic[p3]}], 
    PlotRange -> 1], 
  Column[
   {Slider2D[Dynamic[p1], {-1, 1}], 
    Slider2D[Dynamic[p2], {-1, 1}]~Rotate~(Pi/2), 
    Slider2D[Dynamic[p3], {-1, 1}]}]}]

enter image description here

Notice the strange behavior of the middle slider (try it), and also notice that its appearance is wrong. The latter is further indication that this use is noncanonical.

like image 33
Mr.Wizard Avatar answered Nov 15 '22 09:11

Mr.Wizard