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)
Illustration by Bjørn Gunnar Staal http://bgstaal.net/blog/wp-content/uploads/2009/06/figure11.jpg
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.
I think I'm missing the point.
I did a simple test in the ide, put 3 clips together like so:![3d size](https://i984.photobucket.com/albums/ae330/orgicus/Picture7.png)
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.