« Return to Thread: displayobject boundary box?

Re: displayobject boundary box?

by J-roen :: Rate this Message:

Reply to Author | View in Thread

Hello Quinrou,

It is indeed class of Vertices3D, I used it in my extruder to measure
the size.
At that time I was creating a Vertice3D object, not a DisplayObject3D
If you are creating a primitive I doubt you would need to know the
boundingbox since you need width and height to create the primitive with.
Anyways you can access the AxisAlignedBoundingBox, like so:

pyramid.geometry.aabb.minX;

(provided you have created a primitive called pyramid, that you have
added to the scene)

http://www.flashbookmarks.com/PV3D-GreatWhite-DOC/org/papervision3d/core/math/AxisAlignedBoundingBox.html

J-roen
Andy Zupko schreef:

> most do3d extend vertices3d - so the function is available.  If it
> doesn't extend vertices3d (its not a mesh) - then what are you trying
> to measure?
> On Jul 9, 2008, at 7:45 AM, quinrou . wrote:
>
>> Actually that method is built in Vertices3D... Is there anyway to
>> access it from DisplayObject3D?
>>
>> On Sat, Jul 5, 2008 at 6:57 PM, J-roen <me@...
>> <mailto:me@...>> wrote:
>>
>>     Hello Seb,
>>
>>     There is actually a method built into papervision that does
>>     exactly that:
>>     It is in DisplayObject3D.
>>     So you can do something like:
>>
>>     bbox = this.boundingBox();
>>
>>     and then get properties like:
>>     bbox.min.x / y / z
>>     bbox.size.x / y / z
>>
>>     documentation is here:
>>     http://www.flashbookmarks.com/PV3D-GreatWhite-DOC/org/papervision3d/core/geom/Vertices3D.html#boundingBox()
>>     <http://www.flashbookmarks.com/PV3D-GreatWhite-DOC/org/papervision3d/core/geom/Vertices3D.html#boundingBox%28%29>
>>
>>     J-roen
>>
>>     quinrou . schreef:
>>     > Niceone Michael, thanks a lot for that.
>>     > seb
>>     >
>>     > On Wed, Jul 2, 2008 at 7:32 PM, T. Michael Pardon
>>     > <codejockey1@... <mailto:codejockey1@...>
>>     <mailto:codejockey1@... <mailto:codejockey1@...>>> wrote:
>>     >
>>     >     I found this utility class a while back when I was trying to do
>>     >     the same thing.  I don't remember who posted it originally,
>>     but if
>>     >     I find the original post I will update this thread.
>>     >
>>     >     package
>>     >     {
>>     >             import
>>     org.papervision3d.core.geom.renderables.Vertex3D;
>>     >             import org.papervision3d.objects.DisplayObject3D;
>>     >
>>     >             public class BoundingBox
>>     >             {
>>     >                     public var maxX :Number = 0;
>>     >                     public var minX :Number = 0;
>>     >                     public var maxY :Number = 0;
>>     >                     public var minY :Number = 0;
>>     >                     public var maxZ :Number = 0;
>>     >                     public var minZ :Number = 0;
>>     >
>>     >                     public var sizeX :Number = 0;
>>     >                     public var sizeY :Number = 0;
>>     >                     public var sizeZ :Number = 0;
>>     >
>>     >                     public function BoundingBox(
>>     object:DisplayObject3D )
>>     >                     {
>>     >                             parseMesh( object );
>>     >
>>     >                             sizeX = maxX - minX;
>>     >                             sizeY = maxY - minY;
>>     >                             sizeZ = maxZ - minZ;
>>     >                     }
>>     >
>>     >                     private function
>>     >     parseMesh(object:DisplayObject3D):void
>>     >                     {
>>     >                             if (object.children)
>>     >                                     for each(var
>>     child:DisplayObject3D
>>     >     in object.children)
>>     >                                             parseMesh(child);
>>     >
>>     >                             if ( !object.geometry)
>>     >                                     return;
>>     >
>>     >                             for each(var vertex:Vertex3D in
>>     >     object.geometry.vertices)
>>     >                             {
>>     >                                     maxX = Math.max(maxX,
>>     vertex.x);
>>     >                                     minX = Math.min(minX,
>>     vertex.x);
>>     >                                     maxY = Math.max(maxY,
>>     vertex.y);
>>     >                                     minY = Math.min(minY,
>>     vertex.y);
>>     >                                     maxZ = Math.max(maxZ,
>>     vertex.z);
>>     >                                     minZ = Math.min(minZ,
>>     vertex.z);
>>     >                             }
>>     >                     }
>>     >             }
>>     >     }
>>     >
>>     >     _______________________________________________
>>     >     Papervision3D mailing list
>>     >     Papervision3D@...
>>     <mailto:Papervision3D@...>
>>     <mailto:Papervision3D@... <mailto:Papervision3D@...>>
>>     >     http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>     >
>>     >
>>
>>
>>
>>     _______________________________________________
>>     Papervision3D mailing list
>>     Papervision3D@... <mailto:Papervision3D@...>
>>     http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@... <mailto:Papervision3D@...>
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: displayobject boundary box?