c# - VTK ActiViz 将对象重置为原始 View

标签 c# c++ .net vtk

我试图在交互后将 3D 对象重置为其原始 View (例如正交的、矢状的)。

这是我尝试重置的代码,但没有成功:

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 渲染对象设置为其默认 View 的方式旋转和移动。

关于c# - VTK ActiViz 将对象重置为原始 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20359412/

相关文章:

c# - 在 WCF 客户端/服务器应用程序中计算 UTC/本地日期时间转换的最佳方法

c# - 使用 DataTable 和 List<T> 加入和分组

c# - CsvHelper 将映射器一个属性写入多列

c# - 以编程方式使单元格自动适应宽度和高度

c# - 带有新属性的 LINQ 继承 "Down-Cast"

c# - 如何在 Property.Settings.Default 中存储图像?

c# - 如何在 asp.net C# 4.0 中调用异步方法?

C++ 专有定义 'unique_bool' 和 'unique_ulong' ,类型转换回 'bool' 和 'ulong'

C++基础异常题

c++ - vector < vector > : verify that all have equal sizes