3D 投影信息 [英] 3D Projection information

查看:28
本文介绍了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?

推荐答案

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 边界框返回一个 2D 轴对齐框 (Rect).将 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆