VTK Python 将相机的鼠标控制更改为轨迹球(类似于 Blender、Meshlab、CloudCompare)
VTK Python change camera's mouse controls to trackball (à la Blender, Meshlab, CloudCompare)
如果您查看 VTK's wiki you'll see that most (all?) viewers have mouse controls that may feel strange. For instance in the Cylinder Hello world 中提供的 Python 示例,对象移动的方向取决于您在 window 中单击的位置(无论对象位于何处是)。旋转功能类似地以与 window 中心的距离成正比的速度。
是否可以将相机控制样式更改为"trackball"?即更接近于 Blender、Meshlab 或 CloudCompare 的行为...
我花了很长时间才找到解决方案:
renderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
其中 renderWindowInteractor
由 vtk.vtkRenderWindowInteractor()
返回(有时在示例中称为 iren
)。
如果您查看 VTK's wiki you'll see that most (all?) viewers have mouse controls that may feel strange. For instance in the Cylinder Hello world 中提供的 Python 示例,对象移动的方向取决于您在 window 中单击的位置(无论对象位于何处是)。旋转功能类似地以与 window 中心的距离成正比的速度。
是否可以将相机控制样式更改为"trackball"?即更接近于 Blender、Meshlab 或 CloudCompare 的行为...
我花了很长时间才找到解决方案:
renderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
其中 renderWindowInteractor
由 vtk.vtkRenderWindowInteractor()
返回(有时在示例中称为 iren
)。