TerrainDemo.CDLOD.Node.GetBoundingSphere C# (CSharp) Method

GetBoundingSphere() private method

private GetBoundingSphere ( Vector3 &terrainOffset, float patchScale, float heightScale, BoundingSphere &sphere ) : void
terrainOffset Vector3
patchScale float
heightScale float
sphere BoundingSphere
return void
        void GetBoundingSphere(ref Vector3 terrainOffset, float patchScale, float heightScale, out BoundingSphere sphere)
        {
            var min = new Vector3
            {
                X = x * patchScale + terrainOffset.X,
                Y = minHeight * heightScale + terrainOffset.Y,
                Z = y * patchScale + terrainOffset.Z
            };
            var max = new Vector3
            {
                X = (x + size) * patchScale + terrainOffset.X,
                Y = maxHeight * heightScale + terrainOffset.Y,
                Z = (y + size) * patchScale + terrainOffset.Z
            };
            var center = max - min;
            var radius = center.Length() * 0.5f;
            sphere = new BoundingSphere(center, radius);
        }