fCraft.FloatingIslandMapGenState.MakeIslandHemisphere C# (CSharp) Method

MakeIslandHemisphere() public method

public MakeIslandHemisphere ( Vector3I offset, Sphere sphere ) : void
offset Vector3I
sphere Sphere
return void
        void MakeIslandHemisphere( Vector3I offset, Sphere sphere ) {
            Vector3I origin = new Vector3I( (int)Math.Floor( sphere.Origin.X - sphere.Radius ),
                                            (int)Math.Floor( sphere.Origin.Y - sphere.Radius ),
                                            (int)Math.Floor( sphere.Origin.Z - sphere.Radius ) );
            BoundingBox box = new BoundingBox( origin,
                                               (int)Math.Ceiling( sphere.Radius )*2,
                                               (int)Math.Ceiling( sphere.Radius )*2,
                                               (int)Math.Ceiling( sphere.Radius ) );
            for( int x = box.XMin; x <= box.XMax; x++ ) {
                for( int y = box.YMin; y <= box.YMax; y++ ) {
                    for( int z = box.ZMin; z <= box.ZMax; z++ ) {
                        Vector3I coord = new Vector3I( x, y, z );
                        if( sphere.DistanceTo( coord ) < sphere.Radius ) {
                            map.SetBlock( coord + offset, Block.Stone );
                        }
                    }
                }
            }
        }