摄影位置在情节中是如何工作的

2024-09-27 00:19:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用绘图绘制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]

相机的角位置的4个数字是什么意思?他们是天使吗?以弧度表示?哪个角度?在


Tags: orofthenumpy绘图属性setsposition
1条回答
网友
1楼 · 发布于 2024-09-27 00:19:26

以下是Plotly用于3d打印的相机控件的说明:

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)

相关问题 更多 >

    热门问题