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

MathGroup Archive 2009

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

Search the Archive

Re: Synchronous zooming of 3D graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95975] Re: Synchronous zooming of 3D graphics
  • From: Fred <fred.heberle at gmail.com>
  • Date: Sat, 31 Jan 2009 01:14:05 -0500 (EST)
  • References: <glvkc0$e56$1@smc.vnet.net>

On Jan 30, 2:28 pm, Fred <fred.hebe... at gmail.com> wrote:
> Hi,
>
> I'm trying to link the real-time actions of two 3D graphics objects in
> a graphics row (a stereo pair).  After a web search, I found a nice
> way to link the rotation of the two 3D objects, but nothing about how
> to link zoom (or translation for that matter).  I'm not even sure
> which Graphics3D options are changing when a 3D object is zoomed in or
> out.  While I can dynamically display the values of ViewPoint and
> ViewVertical, I can't do the same for any of the other relevant
> options (ViewMatrix, ViewCenter, ViewVector) that I suspect might be
> changing during a zoom (AbsoluteOptions just shows "Automatic" for
> these options, so I think there's a bug).
>
> Here is the code I found for linking rotation (courtesy ofhttp://web.ift.=
uib.no/~szhorvat/mmatricks.php):
>
> gr = Graphics3D[Cuboid[], SphericalRegion -> True, Boxed -> False]
>
> (* Initialize vp and vv with the default values: *)
>
> vp = ViewPoint /. Options[Graphics3D]
> vv = ViewVertical /. Options[Graphics3D]
>
> Row[
>  {Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]],
>   Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]]}
> ]
>
> Does anyone know of some similar trick for linking zoom?  Thanks.

OK, solved my own problem, but I'll post the answer for posterity.
Zooming in or out changes the value of ViewAngle, and panning changes
the value of ViewCenter.  So the above code can be amended:

gr = Graphics3D[Cuboid[], SphericalRegion -> True, Boxed -> False];

(* Initialize vp, vv, va, and vc with the default values: *)

vp = ViewPoint /. AbsoluteOptions[Graphics3D];
vv = ViewVertical /. AbsoluteOptions[Graphics3D];
va = ViewAngle /. AbsoluteOptions[Graphics3D];
vc = ViewCenter /. AbsoluteOptions[Graphics3D];

Row[
 {Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv],
ViewAngle -> Dynamic[va], ViewCenter -> Dynamic[vc]],
  Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv],
ViewAngle -> Dynamic[va], ViewCenter -> Dynamic[vc]]}
]



  • Prev by Date: Re: integration
  • Next by Date: Re: Taking sums across indices of a SparseArray efficiently
  • Previous by thread: Synchronous zooming of 3D graphics
  • Next by thread: Dynamic Module