Esempio n. 1
0
        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))));
        }
Esempio n. 2
0
        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))));
        }
Esempio n. 3
0
        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))));
        }
Esempio n. 4
0
 public bool Contains(GridPoint2 point)
 {
     return(shape.Contains(point));
 }
Esempio n. 5
0
 public override bool Contains(GridPoint3 point)
 {
     return(shape.Contains(point));
 }
Esempio n. 6
0
 /// <inheritdoc/>
 public override bool Contains(int point)
 {
     return(shape.Contains(point));
 }
Esempio n. 7
0
 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));
 }
Esempio n. 8
0
 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));
 }