MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Rotable Graphics and ViewPoint

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78505] Re: Rotable Graphics and ViewPoint
  • From: Januk <ggroup at sarj.ca>
  • Date: Tue, 3 Jul 2007 05:31:15 -0400 (EDT)
  • References: <f67mco$2vu$1@smc.vnet.net>

Hi Helen,

You can get part of what you want using DynamicModules and Dynamic
Objects (i.e. easy resetting to some set of standard view points and
view verticals):

CADView[pl_, opts___?OptionQ] := DynamicModule[{vpv, vv, vp},
    Panel[
      {
          vpv = { {1.3, -2.4, 2}, Automatic };
          Row[{
              Button["Automatic", vpv = { {1.3, -2.4, 2},
Automatic }],
              Button["Top", vpv = {{0, 0,  }, {0, 1, 0} }],
              Button["Bottom", vpv = { {0, 0, - }, {0, 1, 0} }],
              Button["Left", vpv = { {- , 0, 0}, {0, 0, 1} }],
              Button["Right", vpv = { { , 0, 0}, {0, 0, 1} }],
              Button["Front", vpv = { {0, - , 0}, {0, 0, 1} }],
              Button["Back", vpv = { {0,  , 0}, {0, 0, 1} }]
              }],

          Dynamic[{vp, vv} = vpv;
            Show[pl, ViewPoint -> vp, ViewVertical ->
              vv, opts, ImageSize -> 400]]
          } // Column
      ]]

CADView[pl_, {viewpoint_, viewvertical_:{0,0,1}}, opts___?OptionQ] :=
DynamicModule[{vpv, vv, vp},
    Panel[
      {
          vpv = { viewpoint, viewvertical };
          Row[{
              Button["Automatic", vpv = { {1.3, -2.4, 2},
Automatic }],
              Button["Top", vpv = {{0, 0,  }, {0, 1, 0} }],
              Button["Bottom", vpv = { {0, 0, - }, {0, 1, 0} }],
              Button["Left", vpv = { {- , 0, 0}, {0, 0, 1} }],
              Button["Right", vpv = { { , 0, 0}, {0, 0, 1} }],
              Button["Front", vpv = { {0, - , 0}, {0, 0, 1} }],
              Button["Back", vpv = { {0,  , 0}, {0, 0, 1} }],
              Button["Original", vpv = { viewpoint, viewvertical }]
              }],

          Dynamic[{vp, vv} = vpv;
            Show[pl, ViewPoint -> vp, ViewVertical ->
              vv, opts, ImageSize -> 400]]
          } // Column
      ]]

One bug with this is that you can't press one button, rotate the
graphic and then press that same button.  I don't really understand
why that doesn't work.  The work-around is easy enough; simply press a
different button before pressing the first one a second time.

Hope that helps,
Januk

On Jul 1, 3:50 am, Helen Read <h... at together.net> wrote:
> First of all, I love the ability in 6.0 to grab 3D graphics and spin
> them around with the mouse. However, it would be nice if there were a
> more obvious way to return to the original ViewPoint and ViewVertical
> settings. Re-executing the graphic doesn't do it. I just now discovered
> that deleting the output cell before re-executing *does* return the
> graphic to the original ViewPoint / ViewVertical, but this (to me)
> wasn't an obvious thing to do. (I've had 6.0 for a good six or eight
> weeks, and I just now thought of it. Up until now I had been copying the
> input into a new cell and executing the new one, which I found a bit
> annoying.) OK, deleting the output before re-executing does work, but
> it's an extra step that I don't think should be necessary.
>
> Also, after rotating a graphic with the mouse, it would be nice to have
> an easy way to save a copy of the input for the graphic with the current
> ViewPoint (and ViewVertical) settings. Right now the only way I can see
> to extract the ViewPoint (and ViewVertical) is to open up the output
> cell (Shft-Ctrl-E), scroll all the way to the end, copy the ViewPoint
> and ViewVertical, close up the cell, and paste the ViewPoint and
> ViewVertical into my input. This isn't something I'd ever suggest to my
> students.
>
> So here's what I would really like.
>
> 1. Re-executing a 3D graphic would return it to the original ViewPoint
> and ViewVertical settings.
>
> 2. An easy way to make a copy of a graphic with the current ViewPoint
> and ViewVertical settings pasted into the input, sort of like the way
> Paste Snapshot works for Manipulate, so that I can delete all output
> before quitting, come back later and recreate the graphic in the state
> that I had it.
>
> (With regard to #2, my students have limited storage space on the
> network, and it also makes the files smaller for passing them around via
> e-mail or web if we can save them with output deleted.)
>
> --
> Helen Read
> University of Vermont




  • Prev by Date: Re: AW: position of matrix elements for intervals
  • Next by Date: Re: Integrating DircaDelta[x]
  • Previous by thread: Re: Re: Rotable Graphics and ViewPoint
  • Next by thread: Re: Rotable Graphics and ViewPoint