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.7989883 ,  0.95002991 , -5.3083067 )

Are you sure that the compute bounds visitor doesn't already compute a
world space bound? You are applying the local to world transform again
to that bbox, which might explain the double Z -5 transform

Reasonably sure, yes. And as you can see the transformed _max.z() is (approximately) correct (i.e. ~ untransformedBB._max.z() + -5).

I'll continue looking into this soon, but it's relatively low priority right now.

Actually, I had another question: how would one transform a bounding sphere? The center is easy: transform the Vec3 the same way as any other. For the radius (if the transforms above contain scales), I'd think something like this would be OK:

osg::Vec3 radiusVec(bs._radius, 0, 0);
radiusVec = osg:Matrixd::transform3x3(radiusVec, localToWorld);
bs._radius = radiusVec.length();

(if there are only rotations, the length will stay the same as before, but if there are scales, it will change)

Does that sound right?

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

Reply via email to