是否可以查询Graphics3D的ViewPoint属性?

nil*_*ock 6 wolfram-mathematica

使用Graphics3D显示某些图形对象后,您可以通过交互式更改ViewPoint选项或简单地拖动,调整大小或旋转图像来移动图像.后者是否会在内部更改ViewPoint?可以查询一下吗?

例如.

按程序:

 Manipulate [
 viewpoint->{x,y,y};
 Graphics3D[Cuboid[],ViewPoint->viewpoint],
 ,{x,-25,25}
 ,{y,-25,25}
 ,{z,-25,25}]
Run Code Online (Sandbox Code Playgroud)

通过'鼠标'

Graphics3D[
    Cuboid[]] 
Run Code Online (Sandbox Code Playgroud)

可以模拟上述程序的效果.我可以通过旋转来查询对ViewPoint的影响吗?

Sza*_*lcs 8

试试这段代码:

gr = Graphics3D[Cuboid[], SphericalRegion -> True, Boxed -> False]

(* this is one way to extract the values: *)
vp = ViewPoint /. AbsoluteOptions[gr]
vv = ViewVertical /. AbsoluteOptions[gr]

(* the following is completely another way. try rotating the output of this: *)
Row[
 {Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]],
  Show[gr, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv]]}
]

(* values will dynamically update here: *)
Dynamic[vp]
Dynamic[vv]
Run Code Online (Sandbox Code Playgroud)

希望这有助于为您的问题找到解决方案.

编辑: 您还可以复制并粘贴已经鼠标旋转的图形ViewPoint /. Options[...]