X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgeometry%2Fboundingsphere.h;h=b27e3a1bea7813bc3454f919471f8a1b79c09ca3;hb=e56a892c3f505a1969b207654bcca4bb6158e01b;hp=dd20d96b6a4b701206f9e27b56a16cfc1402c158;hpb=8fd64512155d46df671c4c4a30b7a1cf070aa0e3;p=libs%2Fmath.git diff --git a/source/geometry/boundingsphere.h b/source/geometry/boundingsphere.h index dd20d96..b27e3a1 100644 --- a/source/geometry/boundingsphere.h +++ b/source/geometry/boundingsphere.h @@ -83,8 +83,8 @@ BoundingSphere BoundingSphere::from_point_cloud(const Iter &begin, c if(d>sqdist) { d = sqrt(d); - bsphere.center += v*(1-bsphere.radius/d); - bsphere.radius += d/2; + bsphere.center += v*((T(1)-bsphere.radius/d)/T(2)); + bsphere.radius = (bsphere.radius+d)/T(2); sqdist = bsphere.radius*bsphere.radius; } }