Re: Dynamic Rotation: Coupling of Two or More Graphics3D objects?

*To*: mathgroup at smc.vnet.net*Subject*: [mg85884] Re: Dynamic Rotation: Coupling of Two or More Graphics3D objects?*From*: Szabolcs Horvát <szhorvat at gmail.com>*Date*: Tue, 26 Feb 2008 07:51:51 -0500 (EST)*Organization*: University of Bergen*References*: <fpucui$mcd$1@smc.vnet.net>

W. Craig Carter wrote: > Hello, > Can anyone suggest a path that I might explore to couple the > on-screen of one graphical 3d object to another? > > I've tried what I consider to be obvious: using Manipulate > to dynamically control viewpoints of several objects, but > this is too slow to be useful for my purposes. > > I'd prefer to rotate on object on-screen and have another > (in, say, the same graphics grid) transform in response. > > For example: > GraphicsRow[Graphics3D /@ {Cuboid[], Sphere[]}] > > For a concrete example. I'd like to rotate the cube about > its origin, but have the sphere rotate about an arbitrary > fixed point. > > If I can't do the coupling, the below (kind of) works, but > is cludgy: > > Manipulate[ > GraphicsRow[{Graphics3D[Cuboid[], > ViewPoint -> 10 {Cos[t] Sin[p], Sin[t] Sin[p], Cos[p]}], > Graphics3D[Cuboid[], > ViewPoint -> {a, b, c} + > 10 {Cos[t] Sin[p], Sin[t] Sin[p], Cos[p]}]}], > {{a, 5}, 1, 10}, {{b, 5}, 1, 10}, {{c, 5}, 1, 10}, > {{t, Pi}, 0, 2 Pi}, {{p, Pi/2}, -Pi, Pi}] > > A potential problem is that I can rotate one and then lose > the correspondence (which I could fix with a result button, > but...) Hi, a few days ago I sent an example exactly for this: http://groups.google.com/group/comp.soft-sys.math.mathematica/msg/b0b89dd8d573fa14 Here's the example again: 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]]} ] I hope this helps, Szabolcs