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


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

ViewPoint selector (Stan Wagon's)

Started by"Christopher O. Young" <cy56@comcast.net>
First post2011-05-27 10:13 +0000
Last post2011-05-29 11:36 +0000
Articles 3 — 2 participants

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


Contents

  ViewPoint selector (Stan Wagon's) "Christopher O. Young" <cy56@comcast.net> - 2011-05-27 10:13 +0000
    Re: ViewPoint selector (Stan Wagon's) "Nasser M. Abbasi" <nma@12000.org> - 2011-05-28 11:20 +0000
      Re: ViewPoint selector (Stan Wagon's) "Nasser M. Abbasi" <nma@12000.org> - 2011-05-29 11:36 +0000

#2741 — ViewPoint selector (Stan Wagon's)

From"Christopher O. Young" <cy56@comcast.net>
Date2011-05-27 10:13 +0000
SubjectViewPoint selector (Stan Wagon's)
Message-ID<irntfc$sni$1@smc.vnet.net>
Here's a handy tool for adjusting the viewpoint from the latest edition of
Stan Wagon's "Mathematica in Action".

It's at Google Books at
http://books.google.com/books?id=EbVrWLNiub4C&pg=PA77&dq=Mathematica+%22Mesh
+option%22&source=gbs_selected_pages&cad=3#v=onepage&q&f=true

I'm not sure how to make a function out of this, which will accept any
function of x and y, or better, any 3D plot.

Also, it would be more helpful if it gave the x, y, and z coordinates that
corresponded to the angle, radius, and z coordinates used here.

f[x_, y_] := (x^2 + 3 y^2) E^(1 - x^2 - y^2)   (* Just an example; any 3D
plot should work *)


Manipulate[
 Plot3D[
  f[x, y],
  {x, -2, 2}, {y, -2.5, 2.5},
  Ticks -> All,
  AxesLabel -> {"x", "y", "z"},
  BoxRatios -> {4, 5, 3},
  Ticks -> {{0, 2}, Range[-2, 2], Range[0, 3]},
  SphericalRegion -> True,
  ViewPoint -> Dynamic[{r Cos[\[Theta]], r Sin[\[Theta]], z}],
  PlotLabel -> 
   Dynamic[StringForm["ViewPoint=``",
     NumberForm[Chop[{r Cos[\[Theta]], r Sin[\[Theta]], z}], 3]]
    ]
  ],
 {\[Theta], 0, 2 \[Pi]}, {{r, 1}, 0, 100}, {{z, 1}, -100, 100}
 ]

[toc] | [next] | [standalone]


#2762

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-05-28 11:20 +0000
Message-ID<irqlp5$e90$1@smc.vnet.net>
In reply to#2741
On 5/27/2011 3:13 AM, Christopher O. Young wrote:
> Here's a handy tool for adjusting the viewpoint from the latest edition of
> Stan Wagon's "Mathematica in Action".
>
> It's at Google Books at
> http://books.google.com/books?id=EbVrWLNiub4C&pg=PA77&dq=Mathematica+%22Mesh
> +option%22&source=gbs_selected_pages&cad=3#v=onepage&q&f=true
>
> I'm not sure how to make a function out of this, which will accept any
> function of x and y, or better, any 3D plot.
>
> Also, it would be more helpful if it gave the x, y, and z coordinates that
> corresponded to the angle, radius, and z coordinates used here.
>
> f[x_, y_] := (x^2 + 3 y^2) E^(1 - x^2 - y^2)   (* Just an example; any 3D
> plot should work *)
>
>
> Manipulate[
>   Plot3D[
>    f[x, y],
>    {x, -2, 2}, {y, -2.5, 2.5},
>    Ticks ->  All,
>    AxesLabel ->  {"x", "y", "z"},
>    BoxRatios ->  {4, 5, 3},
>    Ticks ->  {{0, 2}, Range[-2, 2], Range[0, 3]},
>    SphericalRegion ->  True,
>    ViewPoint ->  Dynamic[{r Cos[\[Theta]], r Sin[\[Theta]], z}],
>    PlotLabel ->
>     Dynamic[StringForm["ViewPoint=``",
>       NumberForm[Chop[{r Cos[\[Theta]], r Sin[\[Theta]], z}], 3]]
>      ]
>    ],
>   {\[Theta], 0, 2 \[Pi]}, {{r, 1}, 0, 100}, {{z, 1}, -100, 100}
>   ]
>
>

Thanks for posting it.

I made small improvements to the above to remove the juggling
of the image and the viewpoint displayed values that appear
due to change of values size in the display as the demo is run.

I do not like to see juggling in numerical data or images :)

Here is the updated version, this should run more smooth on the eye.

---------------------

Manipulate[
(
title=Style[Grid[{
{"ViewPoint = ",s[r Cos[\[Theta]]],s[r Sin[\[Theta]]],s[z]}
},Frame->All,Spacings->{1,1}],14
];

Plot3D[f[x,y],{x,-2,2},{y,-2.5,2.5},
Ticks->All,
AxesLabel->{"x","y","z"},
BoxRatios->{4,5,3},
Ticks->{{0,2},Range[-2,2],Range[0,3]},
SphericalRegion->True,
ViewPoint->Dynamic[{r Cos[\[Theta]],r Sin[\[Theta]],z}],
PlotLabel->title,
ImageSize->300,ImagePadding->{{10,10},{10,35}}]
),

{\[Theta],0,2 \[Pi]},{{r,1},0,100},{{z,1},-100,100},
Initialization:>
(
f[x_,y_]:=(x^2+3 y^2) E^(1-x^2-y^2);
s[n_]:=NumberForm[Chop[n],{6,3},
NumberSigns->{"-","+"},
NumberPadding->{"0","0"},
SignPadding->True];
)]

-----------------

--Nasser

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


#2785

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-05-29 11:36 +0000
Message-ID<irtb4d$pja$1@smc.vnet.net>
In reply to#2762
On 5/28/2011 4:20 AM, Nasser M. Abbasi wrote:

Just added a tiny improvement to the above (added labels to
the slides).

-------------------------------
Manipulate[
    (
     title=Style[Grid[{
        {"ViewPoint = ",s[r Cos[\[Theta] Degree]],s[r Sin[\[Theta] Degree]],s[z]}},
         Frame->All,
         Spacings->{1,1}],14
     ];

     Plot3D[f[x,y],{x,-2,2},{y,-2.5,2.5},
            Ticks->All,
            AxesLabel->{"x","y","z"},
            BoxRatios->{4,5,3},
            Ticks->{{0,2},Range[-2,2],Range[0,3]},
            SphericalRegion->True,
            ViewPoint->Dynamic[{r Cos[\[Theta] Degree],r Sin[\[Theta] Degree],z}],
            PlotLabel->title,
            ImageSize->300,
            ImagePadding->{{10,10},{10,35}}]
     ),

     {{\[Theta],0,"\[Theta]"},0,360,Appearance->"Labeled"},
     {{r,1},0,100,Appearance->"Labeled"},
     {{z,1},-100,100,Appearance->"Labeled"},

     Initialization:>
     (
      f[x_,y_]:=(x^2+3 y^2) E^(1-x^2-y^2);
      s[n_] := NumberForm[Chop[n],
                          {6,3},
                          NumberSigns->{"-","+"},
                          NumberPadding->{"0","0"},
                          SignPadding->True];
      )
]
-----------------------------------------


-Nasser

[toc] | [prev] | [standalone]


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


csiph-web