Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: 3D ViewPoint Selector (V5.2) in higher Mathematica versions ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130339] Re: 3D ViewPoint Selector (V5.2) in higher Mathematica versions ?
  • From: "Alexander Elkins" <alexander_elkins at hotmail.com>
  • Date: Wed, 3 Apr 2013 22:50:37 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <kjgo10$pui$1@smc.vnet.net>

This one has been answered before, look for "Viewpoint selector for Mac in
6.0"
in the archives for this group and you will find an answer here:
forums.wolfram.com/mathgroup/archive/2008/Mar/msg00766.html

Here is my own version which uses slider manipulation to change ViewPoint
for a graphic using any combination of x,y,z position and/or angles and
radial distance:
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}])]

Hope this helps...

"Dr. Robert Kragler" <kragler at hs-weingarten.de> wrote in message
news:kjgo10$pui$1 at smc.vnet.net...
>
> Hi,
> in Mathematica V 5.2 there was a useful graphics tool being envoked by
Menu >
> Input > *3D ViewPoint Selector*. With this interactive palette/notebook
one
> could easily determine the Cartesian or Spherical coordinates (i.e.
{theta, phi,
> r} resp. {x,y,} ) of a wireframe cube and then paste these values for the
> optimized view of the rotated cube into another Mathematica graphics.
>
> Unfortunately this tool became obsolete from version 6.0. on (which is
mainly
> due to the fact that 3D graphics can be manipulated interactively in
higher
> Mathematica versions.) Nevertheless, in order to determine the optimum
viewpoint
> coordinates I sometimes miss this tool. And I just searched in the
installation
> tree structure of Mathematica V5.2 (and higher versions too) for a
notebook
> resp. palette with the name 3DViewPointSelector (or similar) but could not
find
> this tool even in V5.2. Of course, one could write a litte application
with
> Manipulate for rotating a wireframe cube and read out the viewpoint
coordinates.
> But if this tool already exists why do additional efforts...
>
> Does anyone know where to look for this nice graphics tool which (if
available)
> would certainly be applicable in other Mathematica versions too. Help
would be
> appreciated.
>
> Thanks  R. Kragler
>
> -- 
> Prof. Dr. Robert Kragler
> Email : kragler at hs-weingarten.de
> URL :   http://portal.hs-weingarten.de/web/kragler
>





  • Prev by Date: find position in a list made by string by searching incomplete string
  • Next by Date: extract from Reduce
  • Previous by thread: 3D ViewPoint Selector (V5.2) in higher Mathematica versions ?
  • Next by thread: Re: 3D ViewPoint Selector (V5.2) in higher Mathematica versions ?