transformBoundingSphere optimization

c++11
scrawl 10 years ago
parent a98dc78cc5
commit 15bdb7db01

@ -20,17 +20,18 @@ void transformBoundingSphere (const osg::Matrix& matrix, osg::BoundingSphere& bs
bsphere._center = bsphere._center*matrix;
xdash -= bsphere._center;
osg::BoundingSphere::value_type len_xdash = xdash.length();
osg::BoundingSphere::value_type sqrlen_xdash = xdash.length2();
ydash -= bsphere._center;
osg::BoundingSphere::value_type len_ydash = ydash.length();
osg::BoundingSphere::value_type sqrlen_ydash = ydash.length2();
zdash -= bsphere._center;
osg::BoundingSphere::value_type len_zdash = zdash.length();
osg::BoundingSphere::value_type sqrlen_zdash = zdash.length2();
bsphere._radius = len_xdash;
if (bsphere._radius<len_ydash) bsphere._radius = len_ydash;
if (bsphere._radius<len_zdash) bsphere._radius = len_zdash;
bsphere._radius = sqrlen_xdash;
if (bsphere._radius<sqrlen_ydash) bsphere._radius = sqrlen_ydash;
if (bsphere._radius<sqrlen_zdash) bsphere._radius = sqrlen_zdash;
bsphere._radius = sqrtf(bsphere._radius);
}
osg::Vec4f colourFromRGB(unsigned int clr)

Loading…
Cancel
Save