3D投影信息
我有一个由许多 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
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 theTransformBounds
methodThis returns a 2D axis aligned box (
Rect
) from the 3D bounding box supplied. Pass the bounding box of yourModel3D
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.