Re: [osg-users] Bounding Parallelepiped
Hello Robert, I use your technique based on osg::ComputeBoundsVisitor (starting from the J-S example). osg::ComputeBoundsVisitor cbbv; root-accept(cbbv); osg::BoundingBox bb = cbbv.getBoundingBox(); It works very well for what I want. Matthieu. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Robert Osfield Envoyé : jeudi 2 octobre 2008 18:07 À : OpenSceneGraph Users Objet : Re: [osg-users] Bounding Parallelepiped On Thu, Oct 2, 2008 at 4:13 PM, Matthieu DIRRENBERGER [EMAIL PROTECTED] wrote: Robert J-S thanks for precisions, I have not conscience of all that points. I had understood that osg::BoundingBox can 'store' a Bounding Model with different axis sizes, but I asked the question to understand the best way to 'compute' them ;-) Just to be clear, you did read the bit I wrote about the osg::ComputeBoundsVisitor??? This is exactly what you need to use if you want a tight bound on the subgraph. I believe Gordon's example pre-dates the the existance of ComputeBoundsVisitor and isn't as general purpose as the visitor now in the core OSG. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Bounding Parallelepiped
Hello OSG masters, I have a question about BoundingBox (I checked the mailing archives before). You know that OSG generate BoundingBox, but it is really a box (all faces have the same size). I need the Bounding Parallelepiped of my scene. Not just the bigger radius from the center applied on each side, but the min/max coordinates on Z axis, on X axis and on Y axis individually. I have wasted some time to try myself, but I don't understand how to do that simply? I saw this example: http://www.3drealtimesimulation.com/osg/code/osgcode_bbox1.htm But it is the same problem than with OSG integrated functions. Can you help me? Thanks in advance Matthieu DIRRENBERGER ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
HI Matthieu, An osg::BoundingBox is an axis aligned bounding box, all faces could be the same size as in a cube, but this is certainly not constrained to represent cubes. Secondly the scene graph uses BoundingBox for the Drawable leaves, and BoundingSphere for nodes of the scene graph. This combination provides the best combination of cull performance. Third, the bounding volumes in the scene graph hierarchy enclose all of the subgraph below them. This normally leads to the root bounding sphere being larger than the tightest bounding box you could create for the scene graph. If you wish to compute the tightest bound BounidingBox for your scene you need to use the osg::ComputeBoundsVisitor. Robert. On Thu, Oct 2, 2008 at 3:03 PM, Matthieu DIRRENBERGER [EMAIL PROTECTED] wrote: Hello OSG masters, I have a question about BoundingBox (I checked the mailing archives before). You know that OSG generate BoundingBox, but it is really a box (all faces have the same size). I need the Bounding Parallelepiped of my scene. Not just the bigger radius from the center applied on each side, but the min/max coordinates on Z axis, on X axis and on Y axis individually. I have wasted some time to try myself, but I don't understand how to do that simply? I saw this example: http://www.3drealtimesimulation.com/osg/code/osgcode_bbox1.htm But it is the same problem than with OSG integrated functions. Can you help me? Thanks in advance Matthieu DIRRENBERGER ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Hi Matthieu Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR But you could extend the example on my site http://www.3drealtimesimulation.com/osg/code/osgcode_bbox1.htm to do what you want, you will have to do extra work etc where bbox.expandBy( geode.getDrawable( i )-getBound()); you would to: change this to For every Geode get a pointer to the geoemtry, then get a pointer to the vertex array walk the vertext array extract the values you need and store them in a set of variables This data/parallelpiped you collect will only be of use to you as OSG is designed to use osg::BoundingBox etc. Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthieu DIRRENBERGER Sent: Thursday, October 02, 2008 10:03 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Bounding Parallelepiped Hello OSG masters, I have a question about BoundingBox (I checked the mailing archives before). You know that OSG generate BoundingBox, but it is really a box (all faces have the same size). I need the Bounding Parallelepiped of my scene. Not just the bigger radius from the center applied on each side, but the min/max coordinates on Z axis, on X axis and on Y axis individually. I have wasted some time to try myself, but I don't understand how to do that simply? I saw this example: http://www.3drealtimesimulation.com/osg/code/osgcode_bbox1.htm But it is the same problem than with OSG integrated functions. Can you help me? Thanks in advance Matthieu DIRRENBERGER ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Hi Robert Gordon J-S, Robert J-S thanks for precisions, I have not conscience of all that points. I had understood that osg::BoundingBox can 'store' a Bounding Model with different axis sizes, but I asked the question to understand the best way to 'compute' them ;-) Gordon thanks a lot, it is exactly what I need to continue. I should be able to do that with your code and my own extends ;-) The OSG mailing list is really quick and efficient. Matthieu -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Robert Osfield Envoyé : jeudi 2 octobre 2008 16:23 À : OpenSceneGraph Users Objet : Re: [osg-users] Bounding Parallelepiped HI Matthieu, An osg::BoundingBox is an axis aligned bounding box, all faces could be the same size as in a cube, but this is certainly not constrained to represent cubes. Secondly the scene graph uses BoundingBox for the Drawable leaves, and BoundingSphere for nodes of the scene graph. This combination provides the best combination of cull performance. Third, the bounding volumes in the scene graph hierarchy enclose all of the subgraph below them. This normally leads to the root bounding sphere being larger than the tightest bounding box you could create for the scene graph. If you wish to compute the tightest bound BounidingBox for your scene you need to use the osg::ComputeBoundsVisitor. Robert. On Thu, Oct 2, 2008 at 3:03 PM, Matthieu DIRRENBERGER [EMAIL PROTECTED] wrote: Hello OSG masters, I have a question about BoundingBox (I checked the mailing archives before). You know that OSG generate BoundingBox, but it is really a box (all faces have the same size). I need the Bounding Parallelepiped of my scene. Not just the bigger radius from the center applied on each side, but the min/max coordinates on Z axis, on X axis and on Y axis individually. I have wasted some time to try myself, but I don't understand how to do that simply? I saw this example: http://www.3drealtimesimulation.com/osg/code/osgcode_bbox1.htm But it is the same problem than with OSG integrated functions. Can you help me? Thanks in advance Matthieu DIRRENBERGER ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
On Thu, Oct 2, 2008 at 4:13 PM, Matthieu DIRRENBERGER [EMAIL PROTECTED] wrote: Robert J-S thanks for precisions, I have not conscience of all that points. I had understood that osg::BoundingBox can 'store' a Bounding Model with different axis sizes, but I asked the question to understand the best way to 'compute' them ;-) Just to be clear, you did read the bit I wrote about the osg::ComputeBoundsVisitor??? This is exactly what you need to use if you want a tight bound on the subgraph. I believe Gordon's example pre-dates the the existance of ComputeBoundsVisitor and isn't as general purpose as the visitor now in the core OSG. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Tomlinson, Gordon wrote: I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... But using 8 corner points is reduntant, as OSG uses _axis-aligned_ bounding boxes. Even in case you were using aligned bboxes you would only need 4 vec3's to represent a bounding box under any orientation (one vec3 for one of the corners + 3 * a vec3 for each sizes axis starting at the corner (and even the 3rd axis could be deduced from the other 2, except for its length)). Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
How OSG uses is fine for how it is used But we were not talking about HOW OSG uses but how a someone would like a bounding box that is not necessary axially aligned and to have a box were all six sides can be of difference size thus no real correlation between corners you need the 8 corners provide by opposite sides you cannot derive these if there all different Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Melis Sent: Thursday, October 02, 2008 12:19 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Tomlinson, Gordon wrote: I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... But using 8 corner points is reduntant, as OSG uses _axis-aligned_ bounding boxes. Even in case you were using aligned bboxes you would only need 4 vec3's to represent a bounding box under any orientation (one vec3 for one of the corners + 3 * a vec3 for each sizes axis starting at the corner (and even the 3rd axis could be deduced from the other 2, except for its length)). Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Forgot to add: You also need the center of rotation, but I have assumed that this center point is already being stored as part of the data for the object from which the bounds are computed. If this is a standalone bounding box (for example, encapsulating a series of objects without a 'parent' object), then you would also require an additional 3D vector for the center point. -- Matthew W. Fuesz Software Engineer Asc. Lockheed Martin STS 1210 Massillon Road Akron, OH 44315 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fuesz, Matthew Sent: Thursday, October 02, 2008 12:33 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped For the case of a non-world-aligned bounding box - but still one which is parallel-sided (i.e., a rectangular volume) - you actually do not need all eight corners. You only need the two opposite corners (as osg::BoundingBox uses) plus a rotation. Thus, you require either 5 3D vectors (2 corners + 3x3 rotation matrix) or 2 3D vectors and 1 4D vector (2 corners + rotation quaternion). For a completely arbitrary bounding volume (where no two sides are guaranteed to be the same size), however, all of the corners would be necessary. -- Matthew W. Fuesz Software Engineer Asc. Lockheed Martin STS 1210 Massillon Road Akron, OH 44315 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tomlinson, Gordon Sent: Thursday, October 02, 2008 12:26 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped How OSG uses is fine for how it is used But we were not talking about HOW OSG uses but how a someone would like a bounding box that is not necessary axially aligned and to have a box were all six sides can be of difference size thus no real correlation between corners you need the 8 corners provide by opposite sides you cannot derive these if there all different Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Melis Sent: Thursday, October 02, 2008 12:19 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Tomlinson, Gordon wrote: I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... But using 8 corner points is reduntant, as OSG uses _axis-aligned_ bounding boxes. Even in case you were using aligned bboxes you would only need 4 vec3's to represent a bounding box under any orientation (one vec3 for one of the corners + 3 * a vec3 for each sizes axis starting at the corner (and even the 3rd axis could be deduced from the other 2, except for its length)). Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S
Re: [osg-users] Bounding Parallelepiped
Tomlinson, Gordon wrote: How OSG uses is fine for how it is used But we were not talking about HOW OSG uses but how a someone would like a bounding box that is not necessary axially aligned and to have a box were all six sides can be of difference size thus no real correlation between corners you need the 8 corners provide by opposite sides you cannot derive these if there all different Hmm, this wasn't really clear from the context then... anyways Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Melis Sent: Thursday, October 02, 2008 12:19 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Tomlinson, Gordon wrote: I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... But using 8 corner points is reduntant, as OSG uses _axis-aligned_ bounding boxes. Even in case you were using aligned bboxes you would only need 4 vec3's to represent a bounding box under any orientation (one vec3 for one of the corners + 3 * a vec3 for each sizes axis starting at the corner (and even the 3rd axis could be deduced from the other 2, except for its length)). Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
Hi Gordon, I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... Visibly there's a misunderstanding on terminology here. I'm saying osg::BoundingBox is not restricted to a cube. It's a general AABB, meaning it can have different sizes in all three dimensions, but all aligned to the axes. For example: osg::Vec3 _min(-2, -6, -3); osg::Vec3 _max(1, -2, 64); means a bounding box of size (3, 4, 67). All three dimensions have different sizes. The center is (-0.5, -4, 30.5). I assume you were saying the same thing, and thus we're both arguing the same side of the argument :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
For the case of a non-world-aligned bounding box - but still one which is parallel-sided (i.e., a rectangular volume) - you actually do not need all eight corners. You only need the two opposite corners (as osg::BoundingBox uses) plus a rotation. Thus, you require either 5 3D vectors (2 corners + 3x3 rotation matrix) or 2 3D vectors and 1 4D vector (2 corners + rotation quaternion). For a completely arbitrary bounding volume (where no two sides are guaranteed to be the same size), however, all of the corners would be necessary. -- Matthew W. Fuesz Software Engineer Asc. Lockheed Martin STS 1210 Massillon Road Akron, OH 44315 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tomlinson, Gordon Sent: Thursday, October 02, 2008 12:26 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped How OSG uses is fine for how it is used But we were not talking about HOW OSG uses but how a someone would like a bounding box that is not necessary axially aligned and to have a box were all six sides can be of difference size thus no real correlation between corners you need the 8 corners provide by opposite sides you cannot derive these if there all different Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Melis Sent: Thursday, October 02, 2008 12:19 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Tomlinson, Gordon wrote: I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... But using 8 corner points is reduntant, as OSG uses _axis-aligned_ bounding boxes. Even in case you were using aligned bboxes you would only need 4 vec3's to represent a bounding box under any orientation (one vec3 for one of the corners + 3 * a vec3 for each sizes axis starting at the corner (and even the 3rd axis could be deduced from the other 2, except for its length)). Paul Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 10:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, Unfortunately, OSG does not directly support what you want as osg'S bounding box, is as you have seen is a axially aligned min/max LL/UR That is not true. OSG's bounding box supports separate xmin/xmax, ymin/ymax, zmin/zmax values, so it can represent boxes that have different sizes on all axes. However, as Robert explained, OSG uses BoundingBox on Drawables, but BoundingSpheres on nodes. So if you just take the root node's bounding sphere and put that into a bounding box, of course you will get a bounding *cube*. ComputeBoundsVisitor is what you need. It will compute a minimal axis-aligned bounding box for all *drawables*, not using the bounding spheres. #include osg/ComputeBoundsVisitor osg::ComputeBoundsVisitor cbbv; node-accept(cbbv); osg::BoundingBox bb = cbbv-getBoundingBox(); It doesn't get much simpler than that. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bounding Parallelepiped
:) Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Thursday, October 02, 2008 1:05 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Bounding Parallelepiped Hi Gordon, I disagree :) You need 8 vec3's to do that, you need the 4 corners of any 2 opposite sides of the bounding box in order to have every side a different size The osg::Bounding box only supplies 2 vec3's which effectively gives you 2 corner points and you cannot get the 8 corner points from 2, apart from a parallel rectangle ... Visibly there's a misunderstanding on terminology here. I'm saying osg::BoundingBox is not restricted to a cube. It's a general AABB, meaning it can have different sizes in all three dimensions, but all aligned to the axes. For example: osg::Vec3 _min(-2, -6, -3); osg::Vec3 _max(1, -2, 64); means a bounding box of size (3, 4, 67). All three dimensions have different sizes. The center is (-0.5, -4, 30.5). I assume you were saying the same thing, and thus we're both arguing the same side of the argument :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org