Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123263] Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.)
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 29 Nov 2011 07:06:40 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Nice.

Bobby

On Mon, 28 Nov 2011 04:53:42 -0600, Chris Young <cy56 at comcast.net> wrote:

> 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]}
>  ]
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: How to integrate a function over a polygon
  • Next by Date: Re: Memory low for PDE
  • Previous by thread: Re: Explicitly specifying the 3d viewing options (pan, rotate, etc.)
  • Next by thread: Ragged region boundary