如何通过透视投影获取 DisplayObject 的可见大小
下面完全是一道数学题。
众所周知,PerspectiveProjection
根据以下公式提供由 fieldOfView
和 focalLength
相互依赖的值表示的 3D 透视变换:
focalLength = stageWidth/2 * (cos(fieldOfView/2) / sin(fieldOfView/2)
(来源:bgstaal.net)
DisplayObject(上面链接图像上的立方体)的可见屏幕尺寸?
问:如何获取已应用 PerspectiveProjection的 ActionScript 3 中的问题缺乏功能对于 DisplayObject 的可见边界。
The following is entirely a math question.
As we know, PerspectiveProjection
delivers perspective transformations in 3D represented by the interdependent values of fieldOfView
and focalLength
according to the following formula:
focalLength = stageWidth/2 * (cos(fieldOfView/2) / sin(fieldOfView/2)
(source: bgstaal.net)
Q: How to get the visible on-screen size of the DisplayObject (Cube on the above-linked image) to which PerspectiveProjection has been applied?
A more thorough description and illustrative code on the issue in ActionScript 3 lacks functionality for visible bounds of DisplayObject.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我没有抓住要点。
我在ide中做了一个简单的测试,将3个剪辑放在一起,如下所示:
宽度和高度报告可见 3d 区域的大小,
正如您在财产检查员中也可以看到的那样。
您可以像在运行时一样简单地访问
,或者使用一些 jsfl:
在 IDE 中访问创作时选定的剪辑。
我用一些动作脚本做了类似的测试:
这是来自编程动作脚本3.0的修改示例,
像素边界在这里工作得很好,但它是一个简单的平面。 PixelBounds 在前面的示例中不起作用,但 getBounds() 似乎工作正常。
I think I'm missing the point.
I did a simple test in the ide, put 3 clips together like so:
The width and height report the size of the visible 3d area,
as you can see in the property inspector as well.
You can access just as simple as
at runtime or with a bit of jsfl:
for one selected clip at authortime, within the IDE.
I did a similar test with a bit of actionscript:
Here is a modified sample from Programming Actionscript 3.0
pixelBounds work well here, but it's a simple plane. pixelBounds wouldn't work in the previous example, but getBounds() seems to work fine.