我有很多的Model3D元素构成的三维场景。 我需要建立在顶部的二维层,我想用的Model3D元素2D元素相关联。 我如何计算2D投影的Model3D元素的界限?
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?
在的Model3D
不具有信息作为投影视图/视口的属性。
The Model3D
doesn't have that information as the projection is a property of the view/viewport.
您可以使用 GeneralTransform3DTo2D
类具体的 TransformBounds
方法
You can use the GeneralTransform3DTo2D
Class and specifically the TransformBounds
method
这会返回一个二维轴对准盒(矩形
)从所提供的3D边框。通过你的的Model3D
的边界框到这一点,它会返回预期范围。
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.
这样你就可以得到这个转型的一次,并在场景中使用它的每个的Model3D
合适。
So you can get this transformation the once and use it for each Model3D
in your scene as appropriate.
下一篇:什么是3D插值一些好的库?插值