From 7b826228bbb506469f91215c01b375ad4965fe91 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 28 Sep 2004 07:15:01 +0000 Subject: [PATCH] From Brad Christiansen, fix expandBy(const BoundingSphere&) method to properly handle the instance of when the two bounding sphere's have a coincident center. --- src/osg/BoundingSphere.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osg/BoundingSphere.cpp b/src/osg/BoundingSphere.cpp index d54a676a4..dbb2da779 100644 --- a/src/osg/BoundingSphere.cpp +++ b/src/osg/BoundingSphere.cpp @@ -60,7 +60,11 @@ void BoundingSphere::expandBy(const BoundingSphere& sh) { Vec3 dv = sh._center-_center; float dv_len = dv.length(); - if (dv_len+sh._radius>_radius) + + if(dv_len == 0 && sh._radius>_radius) { + _radius = sh._radius; + } + else if (dv_len+sh._radius>_radius) { Vec3 e1 = _center-(dv*(_radius/dv_len)); Vec3 e2 = sh._center+(dv*(sh._radius/dv_len));