public static IExplicitShape <GridPoint3> ReflectZInBounds(this IExplicitShape <GridPoint3> shape) { var bounds = shape.Bounds; var func = new Func <GridPoint3, GridPoint3>(p => new GridPoint3(p.X, p.Y, bounds.Extreme.Z - p.Z + bounds.Point.Z - 1)); return(bounds.Where(p => shape.Contains(func(p)))); }
public static IExplicitShape <GridPoint2> ReflectYInBounds(this IExplicitShape <GridPoint2> shape) { var bounds = shape.Bounds; var func = new Func <GridPoint2, GridPoint2>(p => new GridPoint2(p.X, bounds.Extreme.Y - p.Y + bounds.Point.Y - 1)); return(bounds.Where(p => shape.Contains(func(p)))); }
public static IExplicitShape <int> ReflectXInBounds(this IExplicitShape <int> shape) { var bounds = shape.Bounds; var func = new Func <int, int>(p => bounds.Extreme - p + bounds.Point - 1); return(bounds.Where(p => shape.Contains(func(p)))); }
public bool Contains(GridPoint2 point) { return(shape.Contains(point)); }
public override bool Contains(GridPoint3 point) { return(shape.Contains(point)); }
/// <inheritdoc/> public override bool Contains(int point) { return(shape.Contains(point)); }
public static IExplicitShape <GridPoint3> Select(this IExplicitShape <GridPoint3> shape, Func <GridPoint3, bool> predicate) { return(ImplicitShape .Func <GridPoint3>(x => shape.Contains(x) && predicate(x)) .ToExplicit(shape.Bounds)); }
public static IExplicitShape <int> Where(this IExplicitShape <int> shape, Func <int, bool> predicate) { return(ImplicitShape .Func <int>(x => shape.Contains(x) && predicate(x)) .ToExplicit(shape.Bounds)); }