Re: [osg-users] World-space bounds of a node

2008-10-30 Thread Jean-Sébastien Guay
Hi Paul, PS Interestingly, Microsoft has a patent on cheaply computing bounding sphere radii in a scene graph. See US patent 6,664,975 in case you're interested Well, then forget I ever said anything about this. :-) J-S -- __ Jean-Sebastien

Re: [osg-users] World-space bounds of a node

2008-10-30 Thread Paul Melis
Jean-Sébastien Guay wrote: osg::Vec3 radiusVec(bs._radius, 0, 0); radiusVec = osg:Matrixd::transform3x3(radiusVec, localToWorld); bs._radius = radiusVec.length(); Or as Vincent noted: radius *= localToWorld.getScale().x(); But that would only be correct if the scale is uniform. If not, the

Re: [osg-users] World-space bounds of a node

2008-10-30 Thread Jean-Sébastien Guay
Hi, osg::Vec3 radiusVec(bs._radius, 0, 0); radiusVec = osg:Matrixd::transform3x3(radiusVec, localToWorld); bs._radius = radiusVec.length(); Or as Vincent noted: radius *= localToWorld.getScale().x(); But that would only be correct if the scale is uniform. If not, the bounding sphere is a bo

Re: [osg-users] World-space bounds of a node

2008-10-30 Thread Jean-Sébastien Guay
Hi Paul, (just keeping the results here so it's easy to see what we're talking about, sorry for the 5 levels of quoting :-) ) _min = ( -1.4047172 , -0.94869113 , -1.9402435 ) _max = ( 2.7989883 , 0.95002991 , 0.33612174 ) ... _min = ( -1.4047172 , -0.94869113 , -11.940244 ) _max = ( 2

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Paul Melis
Jean-Sébastien Guay wrote: > Hi Paul, > _min = ( -1.4047172 , -0.94869113 , -1.9402435 ) _max = ( 2.7989883 , 0.95002991 , 0.33612174 ) > > ... > _min = ( -1.4047172 , -0.94869113 , -11.940244 ) _max = ( 2.7989883 , 0.95002991 , -5.3083067 ) >> >> Interestingly enough min

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Jean-Sébastien Guay
Hi Paul, _min = ( -1.4047172 , -0.94869113 , -1.9402435 ) _max = ( 2.7989883 , 0.95002991 , 0.33612174 ) ... _min = ( -1.4047172 , -0.94869113 , -11.940244 ) _max = ( 2.7989883 , 0.95002991 , -5.3083067 ) Interestingly enough min xseems to have been decremented by twice -5... won't h

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Paul Melis
Jean-Sébastien Guay wrote: > Hi all, > >> Any ideas? > > Anyone? > > J-S > > (previous message below in case you don't know what I'm talking about) > > Jean-Sébastien Guay wrote: >> Hi Paul, >> >>> Hi J-S -- I recently wrote my own visitor to flatten transforms. To >>> do this, >>> I use osg::compu

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Paul Melis
Jean-Sébastien Guay wrote: > Hi all, > >> Any ideas? > > Anyone? I can only give you a tip: try to render the bbox with the scene to see what's going on... Paul > > J-S > > (previous message below in case you don't know what I'm talking about) > > Jean-Sébastien Guay wrote: >> Hi Paul, >> >>> Hi J

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Jean-Sébastien Guay
Hi all, Any ideas? Anyone? J-S (previous message below in case you don't know what I'm talking about) Jean-Sébastien Guay wrote: Hi Paul, Hi J-S -- I recently wrote my own visitor to flatten transforms. To do this, I use osg::computeLocalToWorld(osg::NodePath&) to get the local-to-world

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Jean-Sébastien Guay
Hi Paul, Hi J-S -- I recently wrote my own visitor to flatten transforms. To do this, I use osg::computeLocalToWorld(osg::NodePath&) to get the local-to-world matrix, and transform all vertices by that matrix. Yes, I've done that in the past too, and after fiddling for a while with the order

Re: [osg-users] World-space bounds of a node

2008-10-29 Thread Ralph Kern
Hi Jean-Sebastien, a correct way for a world coordinate bounding box ist to set up the 8 corner vertices of the local bounding box using _min and _max. Transform the 8 corners and make their min/max-bounding box. regards Ralph Jean-Sébastien Guay schrieb: > Hi all, > > I was wondering, what's t

Re: [osg-users] World-space bounds of a node

2008-10-28 Thread Paul Martz
Hi J-S -- I recently wrote my own visitor to flatten transforms. To do this, I use osg::computeLocalToWorld(osg::NodePath&) to get the local-to-world matrix, and transform all vertices by that matrix. This works great for me, and what you are doing sounds like an equivalent operation, so I'm not su

[osg-users] World-space bounds of a node

2008-10-28 Thread Jean-Sébastien Guay
Hi all, I was wondering, what's the correct way to get the world space bounds of a node? I can do the following: osg::ComputeBoundsVisitor cbbv; node->accept(cbbv); osg::BoundingBox bb = cbbv.getBoundingBox(); I also have the localToWorld matrix of the node. But just transforming