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

时间:2013-12-03 18:59:29

标签: c# c++ .net vtk

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

这是我的代码如何尝试重置,但不成功:

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();
        }

我该怎么做?非常感谢。

1 个答案:

答案 0 :(得分:1)

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

当然,您需要调整焦点,位置和方向(参见VTK手册中的坐标系),但这基本上就是我将3D渲染对象设置为默认视图后的对象旋转并转移。