public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { IPooledEnumerable i = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (TEntity e in i.OfType <TEntity>().Where(o => r.Contains(o))) { yield return(e); } i.Free(); }
public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { if (m == null || m == Map.Internal) { yield break; } IPooledEnumerable i = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (TEntity e in i.OfType <TEntity>().Where(o => o != null && o.Map == m && r.Contains(o))) { yield return(e); } i.Free(); }
public static IEnumerable <T> FindObjects <T>(this Rectangle3D r, Map m) { if (m == null || m == Map.Internal) { yield break; } var o = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (var e in o.OfType <T>()) { yield return(e); } o.Free(); }
public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { if (m == null || m == Map.Internal) { yield break; } var o = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (var e in o.OfType <TEntity>().Where(e => e != null && e.Map == m && r.Contains(e))) { yield return(e); } o.Free(); }
public static Block3D[] GetBorder(this Rectangle3D rect) { var list = new List <Block3D>(); int z = Math.Min(rect.Start.Z, rect.End.Z); int h = Math.Max(rect.Start.Z, rect.End.Z) - z; rect.ToRectangle2D().ForEach( p => { if (p.X == rect.Start.X || p.X == rect.End.X - 1 || p.Y == rect.Start.Y || p.Y == rect.End.Y - 1) { list.Add(new Block3D(p.X, p.Y, z, h)); } }); return(list.ToArray()); }