MathGroup Archive 2008

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85887] Re: Dynamic Rotation: Coupling of Two or More Graphics3D objects?
  • From: Albert Retey <awnl at arcor.net>
  • Date: Tue, 26 Feb 2008 07:53:24 -0500 (EST)
  • 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...)

this last problem can be solved using Deploy, another thing that 
irritates me is that the sizes of the graphics in your code change when 
rotating, this can be avoided with the option SphericalRegion as in the 
following:

Manipulate[GraphicsRow[{
    Deploy@
     Graphics3D[Cuboid[],
      ViewPoint -> 10 {Cos[t] Sin[p], Sin[t] Sin[p], Cos[p]},
      SphericalRegion -> True
      ],
    Deploy@
     Graphics3D[Cuboid[],
      ViewPoint -> {a, b, c} +
        10 {Cos[t] Sin[p], Sin[t] Sin[p], Cos[p]},
      SphericalRegion -> True
      ]
    }],
  {{a, 5}, 1, 10}, {{b, 5}, 1, 10}, {{c, 5}, 1, 10}, {{t, Pi}, 0,
   2 Pi}, {{p, Pi/2}, -Pi, Pi}
  ]

Still, I think something goes wrong with the determination of your 
viewpoints, at some values the rotations seems to "jump". I have not 
investigated this any further, but I think you need to be more careful 
with the definition of the viewpoints in terms of t and p...

hth,

albert


  • Prev by Date: Re: Dynamic Rotation: Coupling of Two or More Graphics3D objects?
  • Next by Date: PointSize (and shape) frustration
  • Previous by thread: Re: Dynamic Rotation: Coupling of Two or More Graphics3D objects?
  • Next by thread: Another question on Assuming