/// <summary>
        /// Return order: (1,0) (0,1) (-1,0) (0,-1)
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <IVoxel> Get4Connected(this IVoxel center)
        {
            var ret = new IVoxel[4];

            ret[0] = center.GetRelative(new Point2(1, 0));
            ret[1] = center.GetRelative(new Point2(0, 1));
            ret[2] = center.GetRelative(new Point2(-1, 0));
            ret[3] = center.GetRelative(new Point2(0, -1));
            return(ret);
            //MHG>: removed this, this will cause problems in any case when using the return order
            //      return ret.Where(s => s != null);
        }
        public static IEnumerable <IVoxel> GetRange(this IVoxel center, int radius)
        {
            for (int x = -radius; x <= +radius; x++)
            {
                for (int y = -radius; y <= +radius; y++)
                {
                    var v = center.GetRelative(new Point2(x, y));

                    if (v != null)
                    {
                        yield return(v);
                    }
                }
            }
        }
        public static IEnumerable <IVoxel> Get8Connected(this IVoxel v)
        {
            yield return(v.GetRelative(new Point2(+1, +1)));

            yield return(v.GetRelative(new Point2(+1, +0)));

            yield return(v.GetRelative(new Point2(+1, -1)));

            yield return(v.GetRelative(new Point2(+0, +1)));

            //yield return v.GetRelative(new Point2( + 0,  + 0));
            yield return(v.GetRelative(new Point2(+0, -1)));

            yield return(v.GetRelative(new Point2(-1, +1)));

            yield return(v.GetRelative(new Point2(-1, +0)));

            yield return(v.GetRelative(new Point2(-1, -1)));
        }
        public IMesh GetMesh(IVoxel gameVoxel)
        {
            var baseMesh = provider.GetMesh(gameVoxel);
            var town     = townCenterService.GetTownForVoxel(gameVoxel);

            if (town == null)
            {
                return(baseMesh);
            }

            var builder = new MeshBuilder();

            builder.AddMesh(baseMesh, Matrix.Identity);
            builder.AddMesh(this.builder.CreateMesh(p => town == townCenterService.GetTownForVoxel(gameVoxel.GetRelative(p))), Matrix.Identity);
            return(builder.CreateMesh());
        }
 IVoxelHandle IVoxelHandle.GetRelative(Point2 p)
 {
     return((IVoxelHandle)currentVoxel.GetRelative(p));
 }