plotly 中的相机位置如何工作

How cameraposition in plotly works

我正在尝试使用 plotly 绘制 3D 图形,需要调整摄像头位置。我发现有两种方法可以做到这一点:使用 Scene 对象的 camera 属性,或者使用 cameraposition 属性。我对这两个问题都有疑问,但这个问题与 cameraposition 有关:我不明白这是什么意思。

docs 说:

 |      cameraposition [required=False] (value=camera position list or 1d numpy
 |      array):
 |          Sets the camera position with respect to the scene. The first entry
 |          (a list or 1d numpy array of length 4) sets the angular position of
 |          the camera. The second entry (a list or 1d numpy array of length 3)
 |          sets the (x,y,z) translation of the camera. The third entry (a
 |          scalar) sets zoom of the camera.
 |
 |          Examples:
 |              [[0.2, 0.5, 0.1, 0.2], [0.1, 0, -0.1], 3]

摄像机的angular位置的4个数字是什么意思?它们是角吗?在弧度?哪个角度?

以下是对 3d 绘图的 Plotly 相机控制的解释:

http://nbviewer.jupyter.org/github/etpinard/plotly-misc-nbs/blob/master/3d-camera-controls.ipynb

为了完整起见,这里有一个简短的总结:

可以使用 camera 代替 cameraposition 因为它似乎有更简单的解释。

相机位置由三个向量确定:upcentereye

向上矢量确定页面的向上方向。默认为(x=0, y=0, z=1),即z轴指向上方

中心矢量确定场景中心的平移。默认情况下,没有翻译:中心向量是 (x=0, y=0, z=0).

眼睛矢量确定关于原点的相机视点。默认为 (x=1.25, y=1.25, z=1.25).

也可以通过减小眼向量的范数来放大。

name = 'eye = (x:0.1, y:0.1, z:1)'
camera = dict(
    up=dict(x=0, y=0, z=1),
    center=dict(x=0, y=0, z=0),
    eye=dict(x=0.1, y=0.1, z=1)
)
fig = make_fig(camera, name)
py.iplot(fig, validate=False, filename=name)