3D投影信息

发布于 2024-12-27 13:13:00 字数 114 浏览 2 评论 0原文

我有一个由许多 Model3D 元素构建的 3D 场景。
我需要在顶部创建一个 2D 图层,以便将 2D 元素与 Model3D 元素关联起来。
如何计算 Model3D 元素的 2D 投影边界?

I have a 3D scene constructed of many Model3D elements.

I need to create a 2D layer on top where I want to associate 2D elements with Model3D elements.
How can I calculate the 2D projected bounds of Model3D elements?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我一直都在从未离去 2025-01-03 13:13:00

Model3D 没有该信息,因为投影是视图/视口的属性。

您可以使用 GeneralTransform3DTo2D,特别是TransformBounds 方法

这会从提供的 3D 边界框返回一个 2D 轴对齐框 (Rect)。将 Model3D 的边界框传递到其中,它将返回投影边界。

因此,您可以一次性获得此转换,并根据需要将其用于场景中的每个 Model3D

The Model3D doesn't have that information as the projection is a property of the view/viewport.

You can use the GeneralTransform3DTo2D Class and specifically the TransformBounds method

This returns a 2D axis aligned box (Rect) from the 3D bounding box supplied. Pass the bounding box of your Model3D into this and it will return the projected bounds.

So you can get this transformation the once and use it for each Model3D in your scene as appropriate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文