Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5370 > unrolled thread

Explicitly specifying the 3d viewing options (pan, rotate, etc.)

Started byTheo Moore <tsg.moore@googlemail.com>
First post2011-10-04 05:40 +0000
Last post2011-11-28 10:56 +0000
Articles 7 — 6 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Explicitly specifying the 3d viewing options (pan, rotate, etc.) Theo Moore <tsg.moore@googlemail.com> - 2011-10-04 05:40 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) Simon <simonjtyler@gmail.com> - 2011-10-05 07:59 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) David Reiss <dbreiss@gmail.com> - 2011-10-05 08:00 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-05 08:10 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) Peter Breitfeld <phbrf@t-online.de> - 2011-10-05 08:16 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) Chris Young <cy56@comcast.net> - 2011-11-28 10:56 +0000
    Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.) Chris Young <cy56@comcast.net> - 2011-11-28 10:56 +0000

#5370 — Explicitly specifying the 3d viewing options (pan, rotate, etc.)

FromTheo Moore <tsg.moore@googlemail.com>
Date2011-10-04 05:40 +0000
SubjectExplicitly specifying the 3d viewing options (pan, rotate, etc.)
Message-ID<j6e684$ke8$1@smc.vnet.net>
Hi,

I'm looking for an easy way to specify the 3d viewing options that you
can alter by clicking a 3d plot and dragging your mouse. For example,
plot a graph using:

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]

And then click and rotate it (or click and zoom in/out, etc.). Is
there a way to output the parameters which were used as I manually
rotated it, so that one could duplicate this (now-changed) graphic
from an explicit command?

[toc] | [next] | [standalone]


#5385

FromSimon <simonjtyler@gmail.com>
Date2011-10-05 07:59 +0000
Message-ID<j6h2os$6o1$1@smc.vnet.net>
In reply to#5370
There was a good talk about this at the recent virtual conference
Lights, Camera, Graphics!, by Yu-Sung Chang
http://www.wolfram.com/events/virtual-conference-2011/presentations/#3

In particular, you want the Graphics3D options
ViewPoint, ViewAngle, ViewVertical and ViewCenter

[toc] | [prev] | [next] | [standalone]


#5387

FromDavid Reiss <dbreiss@gmail.com>
Date2011-10-05 08:00 +0000
Message-ID<j6h2qq$6pi$1@smc.vnet.net>
In reply to#5370
One simple approach is to create a Dynamic entity that shows the
values of the options that you are interested in.  Here's an example:

DynamicModule[{viewPoint = N@{Pi, Pi/2, 2}},
 Column[{
   Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
    ViewPoint -> Dynamic[viewPoint]],
   Dynamic[viewPoint]
   }
  ]
 ]

Best,
David

On Oct 4, 1:40 am, Theo Moore <tsg.mo...@googlemail.com> wrote:
> Hi,
>
> I'm looking for an easy way to specify the 3d viewing options that you
> can alter by clicking a 3d plot and dragging your mouse. For example,
> plot a graph using:
>
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
>
> And then click and rotate it (or click and zoom in/out, etc.). Is
> there a way to output the parameters which were used as I manually
> rotated it, so that one could duplicate this (now-changed) graphic
> from an explicit command?

[toc] | [prev] | [next] | [standalone]


#5397

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-10-05 08:10 +0000
Message-ID<j6h3e1$73d$1@smc.vnet.net>
In reply to#5370
On Tue, 04 Oct 2011 06:40:20 +0100, Theo Moore <tsg.moore@googlemail.com>  
wrote:

> Hi,
>
> I'm looking for an easy way to specify the 3d viewing options that you
> can alter by clicking a 3d plot and dragging your mouse. For example,
> plot a graph using:
>
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
>
> And then click and rotate it (or click and zoom in/out, etc.). Is
> there a way to output the parameters which were used as I manually
> rotated it, so that one could duplicate this (now-changed) graphic
> from an explicit command?
>

When you have the output you want, copy it and paste into the following:

AbsoluteOptions[<<paste here>>, {PlotRange, ViewCenter, ViewPoint,  
ViewVertical}]

which will give you the values of these options resulting from your  
manipulations. There are quite a lot of AbsoluteOptions apart from these;  
you might wish to specify some additional ones if you've e.g. adjusted the  
image size and want to preserve this as well.

[toc] | [prev] | [next] | [standalone]


#5408

FromPeter Breitfeld <phbrf@t-online.de>
Date2011-10-05 08:16 +0000
Message-ID<j6h3oi$75p$1@smc.vnet.net>
In reply to#5370
Theo Moore wrote:

> Hi,
>
> I'm looking for an easy way to specify the 3d viewing options that you
> can alter by clicking a 3d plot and dragging your mouse. For example,
> plot a graph using:
>
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
>
> And then click and rotate it (or click and zoom in/out, etc.). Is
> there a way to output the parameters which were used as I manually
> rotated it, so that one could duplicate this (now-changed) graphic
> from an explicit command?
>

You may use the following function:

getViews[pic_]:=
Flatten[Union[Extract[pic,Position[pic,#]]&/@
  {ViewPoint->_, ViewCenter->_, ViewVertical->_,
   ViewAngle->_, ViewVector->_, ViewRange->_}]];

To apply it, do the following:
Drag, rotate, ... your pic until it looks like you want.

Then enter getViews[] in a new cell, paste the pic between the brackets
and evaluate.

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

[toc] | [prev] | [next] | [standalone]


#6787

FromChris Young <cy56@comcast.net>
Date2011-11-28 10:56 +0000
Message-ID<javpcs$jbr$1@smc.vnet.net>
In reply to#5370
On 2011-10-04 05:40:20 +0000, Theo Moore said:

> Hi,
> 
> I'm looking for an easy way to specify the 3d viewing options that you
> can alter by clicking a 3d plot and dragging your mouse. For example,
> plot a graph using:
> 
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
> 
> And then click and rotate it (or click and zoom in/out, etc.). Is
> there a way to output the parameters which were used as I manually
> rotated it, so that one could duplicate this (now-changed) graphic
> from an explicit command?


All you need is to add the ViewPoint option, which takes a point in 
x,y,z coordinates. I think the most convenient way to do it is to use 
spherical coordinates.

Pictures are at http://home.comcast.net/~cy56/ViewPoint.tiff and 
http://home.comcast.net/~cy56/ViewPoint.png and a notebook file is at 
http://home.comcast.net/~cy56/ViewPoint.nb.

Below, the \[Function] is actually the "RightTeeArrow" symbol for pure 
functions. See the "Functions" help page. I was trying to get a mesh 
consisting of Villarceau circles or "Clifford Parallels" for the torus. 
What I've got in fact produces two crossing Villarceau circles.

I think the "tee-arrow" notation for pure functions is helpful as a 
reminder just what parameters are available for each mesh function, and 
that you can define as many of the mesh functions as you want whatever 
combination of parameters in each one as you want to.

torus[c_, a_, \[Theta]_, \[Phi]_] := ( {
    {Cos[\[Theta]], -Sin[\[Theta]], 0},
    {Sin[\[Theta]], Cos[\[Theta]], 0},
    {0, 0, 1}
   } ).((( {
        {Cos[\[Phi]], 0, -Sin[\[Phi]]},
        {0, 1, 0},
        {Sin[\[Phi]], 0, Cos[\[Phi]]}
       } ).( {
        {a},
        {0},
        {0}
       } ) + ( {
       {c},
       {0},
       {0}
      } )))


Manipulate[
 Show[
  Graphics3D[
   {
    {Gray, Sphere[{0, 0, 0}, sphereR]},
    {Red, Sphere[{c, 0, 0}, sphereR]}
    }
   ],
  ParametricPlot3D[
   torus[c, a, u, v], {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},
   MeshFunctions ->
    {
     {x, y, z, \[Theta], \[Phi]} \[Function] x^2 + (y - a)^2 + c^2
     (*  {x,y,z,u,v}\[Function]v-y  *)
     },
   Mesh -> mesh,
   MeshStyle -> Tube[tubeR],
   PlotStyle -> {Orange, Opacity[opac]},
   PlotPoints -> plotPts
   ] ,

  Axes -> True,
  AxesLabel -> {"x", "y", "z"},
  PlotRange -> {{-4, 4}, {-4, 4}, {-3, 3}},
  PlotRangePadding -> 0.1,
  BoxRatios -> {8, 8, 6},
  ViewPoint ->
   Dynamic[
    {
     viewR Cos[view\[Theta]] Sin[view\[Phi]],
     viewR Sin[view\[Theta]] Sin[view\[Phi]],
     viewR Cos[view\[Phi]]
     }
    ]
  ],
 {{c, 3}, 0, 4},
 {{a, 1}, 0, 3},
 {{sphereR, 0.1}, 0, 0.5},
 {{tubeR, 0.05}, 0, 0.5},
 {{opac, 0.5}, 0, 1},
 {{mesh, 2}, 0, 16, 1},
 {{plotPts, 100}, 0, 100, 1},
 {{viewR, 100}, 0, 100},
 {{view\[Theta], 0 \[Degree]}, 0 \[Degree], 360 \[Degree]},
 {{view\[Phi], 0 \[Degree]}, 0 \[Degree], 180 \[Degree]}
 ]

[toc] | [prev] | [next] | [standalone]


#6788

FromChris Young <cy56@comcast.net>
Date2011-11-28 10:56 +0000
Message-ID<javpdr$jc1$1@smc.vnet.net>
In reply to#5370
On 2011-10-04 05:40:20 +0000, Theo Moore said:

> Hi,
> 
> I'm looking for an easy way to specify the 3d viewing options that you
> can alter by clicking a 3d plot and dragging your mouse. For example,
> plot a graph using:
> 
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
> 
> And then click and rotate it (or click and zoom in/out, etc.). Is
> there a way to output the parameters which were used as I manually
> rotated it, so that one could duplicate this (now-changed) graphic
> from an explicit command?

I forgot to add the ViewPoint readout. For this, all you need is the 
PlotLabel option. (I got this from a Google online sample from Stan 
Wagon's "Mathematica in Action", a great book.)

PlotLabel -> Dynamic[
  StringForm[
   "ViewPoint=``",
   NumberForm[Chop[{
								viewR Cos[viewθ] Sin[viewφ],
      			   		viewR Sin[viewθ] Sin[viewφ],
      			   	   viewR Cos[viewφ]
								}],
							3
						]
   ]
  ]

There's a picture at http://home.comcast.net/~cy56/ViewPoint2.tiff and 
a notebook at http://home.comcast.net/~cy56/ViewPoint2.nb .

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web