Extract current viewing parameters from a 3D view?
You can dynamically extract ViewPoint
and others like this (also useful for synchronization of different plots etc.):
vp = Options[Graphics3D, ViewPoint][[1, 2]];
Graphics3D[Cuboid[], ViewPoint -> Dynamic[vp]]
This value is now constantly updated:
Dynamic[vp]
{1.3, -2.4, 2.}
This seem also to work fine with other functions that use the ViewPoint
option. Below, ViewPoint
and ViewVertical
are in sync for both objects:
{vp, vv} = Options[Graphics3D, {ViewPoint, ViewVertical}][[All, 2]];
Grid[{{Graphics3D[Cuboid[], ViewPoint -> Dynamic[vp],
ViewVertical -> Dynamic[vv]],
ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0,
2 Pi}, {v, -Pi, Pi}, ViewPoint -> Dynamic[vp],
ViewVertical -> Dynamic[vv]]}}]
Perhaps the most easiest way is to use Options
Graphics3D[Cuboid[]]
to plot the figure;- Manipulate the figure at your will,such as zooming in, rotate and so on;
- Copy the manipulated figure and add
//Options
after it, and press enter. You will get the options of the manipulated figure.
The following function may be helpful:
ExtrahiereViews[ll_]:=
Flatten[Union[Extract[ll,Position[ll,#]]&/@
{ViewPoint->_, ViewCenter->_, ViewVertical->_,
ViewAngle->_, ViewVector->_, ViewRange->_}]];
How to do:
- Enter
ExtrahiereViews[]
in a cell below the graphic. - Move the graphic to your liking.
- Set the cursor between the brackets of
ExtrahiereViews
. - Make a "Copy output from above" (CtrlShiftL) and evaluate. You'll get the values.