3D投影信息 [英] 3D Projection information
问题描述
我有很多的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.
您可以使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.generaltransform3dto2d.aspx"相对=nofollow> GeneralTransform3DTo2D
类具体的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.generaltransform3dto2d.transformbounds.aspx"相对=nofollow> 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投影信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!