It appears that the viewpoint selector for 3D graphics is absent in 6.0
(Mac version). Is there an alternate way to manually choose a view
(other than trying different viewpoints repeatedly)? Suggestions
appreciated.
Ravi
University of Washington
Here's a view point selector for you. I am not sure that I do the
copying right, so corrections are welcome. Click the buttons to copy
the values.
viewPointSelector[gr_Graphics3D] :=
DynamicModule[
{vp = ViewPoint /. Options[Graphics3D],
vv = ViewVertical /. Options[Graphics3D],
va = ViewAngle /. Options[Graphics3D]},
Module[{copy},
copy[expr_] :=
NotebookPut[Notebook[{ToString[expr]}], ClipboardNotebook[]];
Panel[Column[
{Show[gr,
ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv],
ViewAngle -> Dynamic[va],
SphericalRegion -> True, ImageSize -> 380],
Grid[
{{Button["ViewPoint", copy[vp]], Dynamic[vp]},
{Button["ViewVertical", copy[vv]], Dynamic[vv]},
{Button["ViewAngle", copy[va]], Dynamic[va]}},
Alignment -> {Left, Baseline}]}
],
ImageSize -> 400
]]]
(Side note: It would be nice if an automatically indented StandardForm
expression would preserve the indentation levels exactly when copied.)
You can try this:
Manipulate[
Module[{x, y, z},
x = r Sin[\[Theta]] Cos[\[Phi]];
y = r Sin[\[Theta]] Sin[\[Phi]];
z = r Cos[\[Theta]];
Graphics3D[Cylinder[], ViewPoint -> {x, y, z}]
],
"ViewPoint",
{{r, 3}, 1.5, 10, Appearance -> "Labeled"},
{{\[Theta], Pi/4}, 0, Pi, Appearance -> "Labeled"},
{{\[Phi], Pi/6}, -Pi, Pi, Appearance -> "Labeled"}
]
1) Make your plot.
2) Use the mouse to obtain the viewpoint that you want.
3) Right in front (on the left) of the plot output type 'Options[' and
right after the plot (on the right) type ', Viewpoint'] and then evaluate.
4) That will give you the current Viewpoint option, which you could then
copy into the plot Input specification.
--
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
"Ravi Balasubramanian" <br...@cs.washington.edu> wrote in message
news:fs26q4$96$1...@smc.vnet.net...
This 3D ViewPoint Selector closely resembles the one that was part of the
Mathematica Front End in versions 3,4 and 5. The ViewVertical is held fixed
at the default setting and the ViewPoint can be changed using the mouse,
Cartesian coordinate sliders, Spherical parameter sliders (theta tilt angle,
phi rotation angle about the z-axis, and the r distance), and by typing in
the various settings (click the + at the end of the sliders). All the
controls including the mouse input are linked so that any change in one
setting updates all the rest. The axes are labeled in color for easy
reference.
Note that the symbol Global`g is used. Change the graphic to whatever you
wish.
To free up ViewVertical, change vv from None to InputField, change to
Method -> {"RotationControl" -> "ArcBall"} and change to ViewVertical ->
Dynamic[vv]. Then the rotate rotate control (dot with a counter-clockwize
arrow) will appear in the corners of the graphic and a ViewVertical field
will appear and change as the mouse moves the graphics. No sliders are
linked to the ViewVertical setting.
Q.E.D.
Manipulate[
Show[g, TicksStyle -> {Red, Green, Blue}, Ticks -> None, Axes -> True,
AxesStyle -> Thread[List[{Red, Green, Blue}, Thick]],
BaseStyle -> {FontWeight -> Bold, FontFamily -> "sans-serif", 28},
LabelStyle -> 14, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
AxesLabel -> {"X", "Y", "Z"}, SphericalRegion -> True,
Method -> {"RotationControl" -> "Globe"},
ViewPoint ->
Dynamic[vp,
Function[{v, e}, \[Theta] =
Mod[ArcTan[v[[3]], Norm[v[[1 ;; 2]]]] 180/\[Pi], 180]; \[Phi] =
Mod[ArcTan[v[[1]], v[[2]]] 180/\[Pi], 360];
r = Norm[v]; {x, y, z} = e = v, HoldRest]],
ViewVertical ->
Dynamic[vv, Function[{v, e}, e = {0., 0., 1.}(*v*), HoldRest]]], {{x, 1.3,
"x"}, -4, 4,
Manipulator[
Dynamic[x, (\[Theta] =
Mod[ArcTan[z, Norm[{#, y}]] 180/\[Pi], 180]; \[Phi] =
Mod[ArcTan[#, y] 180/\[Pi], 360]; r = Norm[{#, y, z}]; vp = {#, y, z};
x = #) &], #2, Appearance -> "Labeled"] &}, {{y, -2.4, "y"}, -4, 4,
Manipulator[
Dynamic[y, (\[Theta] =
Mod[ArcTan[z, Norm[{x, #}]] 180/\[Pi], 180]; \[Phi] =
Mod[ArcTan[x, #] 180/\[Pi], 360]; r = Norm[{x, #, z}]; vp = {x, #, z};
y = #) &], #2, Appearance -> "Labeled"] &}, {{z, 2.0, "z"}, -4, 4,
Manipulator[
Dynamic[z, (\[Theta] = Mod[ArcTan[#, Norm[{x, y}]] 180/\[Pi], 180];
r = Norm[{x, y, #}]; vp = {x, y, #}; z = #) &], #2,
Appearance -> "Labeled"] &}, {{\[Theta],
Mod[ArcTan[2., Norm[{1.3, -2.4}]] 180/\[Pi], 180], "\[Theta]"}, 0, 180,
Manipulator[
Dynamic[\[Theta], ({x, y, z} =
vp = r {Sequence @@ ({Cos[\[Phi] \[Pi]/180],
Sin[\[Phi] \[Pi]/180]} Sin[# \[Pi]/180]),
Cos[# \[Pi]/180]}; \[Theta] = #) &], #2,
Appearance -> "Labeled"] &}, {{\[Phi],
Mod[ArcTan[1.3, -2.4] 180/\[Pi], 360], "\[Phi]"}, 0, 360,
Manipulator[
Dynamic[\[Phi], ({x, y} =
vp[[1 ;; 2]] =
r { Cos[# \[Pi]/180],
Sin[# \[Pi]/180]} Sin[\[Theta] \[Pi]/180]; \[Phi] = #) &], #2,
Appearance -> "Labeled"] &}, {{r, Norm[{1.3, -2.4, 2.0}], "r"}, 0, 9,
Manipulator[
Dynamic[
r, ({x, y, z} =
vp = # {Sequence @@ ({Cos[\[Phi] \[Pi]/180],
Sin[\[Phi] \[Pi]/180]} Sin[\[Theta] \[Pi]/180]),
Cos[\[Theta] \[Pi]/180]}; r = #) &], #2,
Appearance -> "Labeled"] &},
{{vp, {1.3, -2.4, 2.0}, "ViewPoint"},
InputField[
Dynamic[vp, (\[Theta] =
Mod[ArcTan[#[[3]], Norm[#[[1 ;; 2]]]] 180/\[Pi], 180]; \[Phi] =
Mod[ArcTan[#[[1]], #[[2]]] 180/\[Pi], 360];
r = Norm[#]; {x, y, z} = vp = #) &]] &}, {{vv, {0., 0., 1.},
"ViewVertical"}, None},
Initialization :> (g = Plot3D[Cos[x + Cos[y]], {x, -Pi, Pi}, {y, -Pi, Pi}])]
(*END*)