Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.5K Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to get absolute options used by Graphics3D?

Posted 3 years ago
POSTED BY: Werner Geiger
6 Replies
Posted 2 years ago
POSTED BY: Werner Geiger
Posted 2 years ago

From this MSE post:

vp = Options[Graphics3D, ViewPoint][[1, 2]];
Graphics3D[Cube[], ViewPoint -> Dynamic[vp]]
Dynamic[vp]
POSTED BY: Hans Milton
Posted 2 years ago
POSTED BY: Werner Geiger
Posted 2 years ago

I might be misunderstanding what you are wanting to do.

One interpretation of what information you are trying to get (from my own personal experience of messing with the 3D plots) is that you want the ViewVector property to update in real time when you are interacting with the plot. I've tried similar solutions to the one from Hans Milton below in the past without success (at least in the cloud notebooks - may it works on the local wolfram app? - I haven't tried b/c I just wanted to stick with the cloud version)

Part of the issue is that when you are manipulating the plot in the output viewer - I believe this ViewPoint is related to some property on the FrontEnd and is not actually changing the ViewVector property of the underlying graphics3D object.

This is a solution that I came up with recently that mostly worked for me. It's not perfect but it at least lets you rotate the 3D plot. Just replace g1 with whatever you are trying to plot. The cool thing about this is that you don't have to replot g1 with the new ViewPoint property. You can just use the new Graphics object g2.

g1 = Graphics3D[{Sphere[],Cuboid[]}];
    Manipulate[With[{v = RotationTransform[\[Theta]z[[1]]*-2Pi+Pi, {0, 0, 1}][{Pi, 0,Pi}]}, 
            g2= Show[g1, ViewPoint -> {v[[1]],v[[2]],\[Theta]z[[2]]*-40+20}, 
         SphericalRegion -> True]],{{\[Theta]z,{.5,.5}},Locator}]
Dynamic[Options[g2,ViewPoint]]
Dynamic[Show[g2]]
POSTED BY: Damien Waden
Posted 2 years ago

Sorry, Damien, for responding so late. I have overlooked your reply.

For me, using Dynamic does not change anything (and I would not understand why it should). The option ViewVector i still shown as Automatic not with its true value.

POSTED BY: Werner Geiger
Posted 2 years ago

This works for me:

g = Graphics3D[{Cube[]}, ImageSize -> Small]
Dynamic[AbsoluteOptions[g]]
POSTED BY: Damien Waden
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard