             }
         }
         if (ritterRadius < naiveRadius) {
-            result.center = ritterCenter
-            result.radius = ritterRadius
+            center = ritterCenter
+            radius = ritterRadius
         } else {
-            result.center = naiveCenter
-            result.radius = naiveRadius
-        }
-        return result
+            center = naiveCenter
+            radius = naiveRadius
+        }
     }
    
     /**

    * @param {BoundingSphere} [result] The object onto which to store the result.
    * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
    */
    static func fromRectangleWithHeights2D(
        rectangle: Rectangle?,
        projection: MapProjection = GeographicProjection(),
        minimumHeight: Double = 0.0,
        maximumHeight: Double = 0.0) -> BoundingSphere {

            if rectangle == nil {
                return BoundingSphere()
            }
            
            var fromRectangle2DSouthwest = rectangle!.southwest()

            let height = upperRight.y - lowerLeft.y
            let elevation = upperRight.z - lowerLeft.z
            
            
            center = Cartesian3(x: lowerLeft.x + width * 0.5, y: lowerLeft.y + height * 0.5, z: lowerLeft.z + elevation * 0.5)
            radius = sqrt(width * width + height * height + elevation * elevation) * 0.5
    }
    
    /**
    * Computes a bounding sphere from an rectangle in 3D. The bounding sphere is created using a subsample of points
    * on the ellipsoid and contained in the rectangle. It may not be accurate for all rectangles on all types of ellipsoids.
    *
    * @param {Rectangle} rectangle The valid rectangle used to create a bounding sphere.
    * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the rectangle.
    * @param {Number} [surfaceHeight=0.0] The height above the surface of the ellipsoid.
    * @param {BoundingSphere} [result] The object onto which to store the result.
    * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
    */
    init (fromRectangle3D rectangle: Rectangle, ellipsoid: Ellipsoid = Ellipsoid.wgs84(), surfaceHeight: Double = 0) {
        let positions: [Cartesian3]
        positions = rectangle.subsample(ellipsoid, surfaceHeight: surfaceHeight)
        self.init(fromPoints: positions)
    }

    /**
    * Computes a tight-fitting bounding sphere enclosing a list of 3D points, where the points are
    * stored in a flat array in X, Y, Z, order.  The bounding sphere is computed by running two
