c# - 如何在WPF Viewport3d中自动调整相机LookDirection?

标签 c# wpf helix-3d-toolkit viewport3d

我使用 HelixToolKit 的 ModelImporter 函数向 Viewport3d 添加模型(STL 文件),但首先没有显示任何内容。要查看添加的 3D 模型,我必须缩小。我的问题是,有什么方法可以动态/以编程方式缩小或旋转相机到新添加的模型或立即显示它所需的任何内容。

我在该项目中使用 Helix 工具包和 C# WPF。

最佳答案

更新:有一种名为 ZoomExtents 的方法可用于此目的。问题解决了。 更新#2:感谢@sideshowbarker 的警告;

//in this case currModel= Model3D and mainViewport=HelixViewport3D    
ModelVisual3D device3D = new ModelVisual3D();
device3D.Content = currModel;
mainViewport.Children.Add(device3D);
mainViewport.ZoomExtents();
//after loading 3D-Model into viewport you can just call the ZoomExtents() method in namespace of HelixToolkit.Wpf
//Then your 3D Models will automatically fits into viewport frame.

关于c# - 如何在WPF Viewport3d中自动调整相机LookDirection?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33768106/

相关文章:

c# - 在 Helix 3D Toolkit 中将模型/内容添加到 HelixViewport3D

c# - Volatile.Read/Volatile.Write 是否为 "double"原子?

c# - FindName 在 TabItem 上失败

c# - 球体的透明度不适用于我的立方体的所有侧面 - Helixtoolkit

c# - 由于某种原因,我的递归函数跳过了调用自身

c# - WPF:如何通过代码隐藏找到控件

c# - Helix 工具包动画

c# - 如何忽略 McAfee 扫描引起的异常

c# - 应用程序 Dispose 调用阻止

c# - 判断两个不同的 PropertyInfo 是否来自同一个接口(interface)?