8
$\begingroup$

Say I make a set of three Graphics3D images, here of three different cones, by evaluating:

{Graphics3D[{Cone[{{0, 0, 0}, {2, 3, 4}}, 3]}], 
 Graphics3D[{Cone[{{1, 0, 1}, {1, 1, 1}}, 4]}], 
 Graphics3D[{Cone[{{1, 1, 1}, {9, 9, 9}}, 4]}]}

I would like to manually rotate one of the images showing a single cone, and have the other objects follow that rotation, or at least rotate to the final state once I let go of my mouse. Is this possible?

$\endgroup$
6
  • $\begingroup$ Are you asking how to couple the mouse actions that Mathematica supports automatically when a Graphics3D image is displayed? Or are you asking how to do it using some dynamic construct such as Manipulate. I don't think the first is possible. At least, I don't how to do it. I'm sure the second can be done. However, in both cases, you are asking for others to do a heck of a lot work for you with no effort on your part. $\endgroup$
    – m_goldberg
    Mar 17, 2013 at 7:18
  • $\begingroup$ @m_goldberg I just want to do the following: rotate one image manually some number of degrees $(\theta,\phi)$, then apply that same rotation to the other images. Surely there must be some simple way to do this? I don't necessarily need the other images to follow dynamically. $\endgroup$ Mar 17, 2013 at 7:23
  • $\begingroup$ What do you mean by "manually"? $\endgroup$
    – m_goldberg
    Mar 17, 2013 at 7:26
  • $\begingroup$ @m_goldberg I want to click and drag to orient the image how I'd like. $\endgroup$ Mar 17, 2013 at 7:27
  • 1
    $\begingroup$ Related: Extract current viewing parameters from a 3D view? $\endgroup$
    – Yves Klett
    Mar 17, 2013 at 15:29

1 Answer 1

13
$\begingroup$

Make the settings for both ViewPoint and ViewVertical dynamic:

DynamicModule[{vp = {2, -2, 1}, vv = {0, 0, 1}}, 
GraphicsRow[{Graphics3D[{Cone[{{0, 0, 0}, {2, 3, 4}}, 3]}, SphericalRegion -> True,
  ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]], 
 Graphics3D[{Cone[{{1, 0, 1}, {1, 1, 1}}, 4]}, SphericalRegion -> True,
  ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]], 
 Graphics3D[{Cone[{{1, 1, 1}, {9, 9, 9}}, 4]}, SphericalRegion -> True,
  ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]]}]]

enter image description here


enter image description here


Thanks: @Szabolcs for pointing out the need for ViewVertical in addition to ViewPoint to have the three graphics line up properly.

See also: Yu-Sung Chang's answer/tutorial in response to a related question.

$\endgroup$
5
  • $\begingroup$ Great - perfect! $\endgroup$ Mar 17, 2013 at 7:35
  • 2
    $\begingroup$ +1. Well, I knew it could done with a dynamic construct, but I didn't realize it could be done this easily. $\endgroup$
    – m_goldberg
    Mar 17, 2013 at 7:40
  • $\begingroup$ A more elaborate answer can be found here. $\endgroup$ Mar 17, 2013 at 8:00
  • $\begingroup$ @Sjoerd, thank you. I was looking for that link. $\endgroup$
    – kglr
    Mar 17, 2013 at 8:07
  • $\begingroup$ @Szabolcs, thank you; updated the answer with your suggestion. $\endgroup$
    – kglr
    Mar 17, 2013 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.