VTK ActiViz将对象重置为原始视图



我正试图在交互后将3D对象重置为其原始视图(比如说正交视图)。

以下是我如何尝试重置的代码,但没有成功:

private vtkAxesActor axes;
private vtkOrientationMarkerWidget widget;
public void ResetView()
        {
          //  axes.InitPathTraversal();
            if (axes != null)
            {
                if (axes.GetUserMatrix() != null)
                    axes.GetUserMatrix().Identity();
                axes.GetMatrix().Identity();
                axes.SetOrigin(0,0,0);
                axes.SetOrientation(0, 0, 0);
                axes.SetScale(1, 1, 1);
                axes.SetPosition(0, 0, 0);
            }
            if (widget != null)
            {
                widget.SetOrientationMarker(axes);
            }

            ForceWindowToRender();
        }

我该怎么做?非常感谢。

private vtkCamera camera;    
camera.SetPosition(DoubleArrayToIntPtr(defaultCamPos));
camera.SetViewUp(DoubleArrayToIntPtr(defaultCamViewup));
camera.SetFocalPoint(DoubleArrayToIntPtr(defaultCamFocus));

当然,您需要根据自己的场景调整焦点、位置和方向(坐标系请参阅VTK手册),但这基本上是我在旋转和移动对象后将3D渲染对象设置为默认视图的方式。

最新更新