public ExplicitShape1 Intersection(ExplicitShape1 shape) { var newRect = GridInterval.Intersection(storageBounds, shape.storageBounds); var newShape = ImplicitShape.Intersection(implicitShape, shape.implicitShape); return(new ExplicitShape1(newShape, newRect)); }
public static IExplicitShape <int> Translate(this IExplicitShape <int> shape, int n) { var newBounds = GridInterval.Translate(shape.Bounds, n); var newShape = ImplicitShape.Translate(shape, n).ToExplicit(newBounds); return(newShape); }
public ExplicitShape1 Union(ExplicitShape1 shape) { var newRect = GridInterval.UnionBoundingBox(storageBounds, shape.storageBounds); var newShape = ImplicitShape.Union(implicitShape, shape.implicitShape); return(new ExplicitShape1(newShape, newRect)); }
public ExplicitShape1 Translate(int offset) { var map = Map.Translate(offset); var newRect = GridInterval.Translate(storageBounds, offset); var newShape = ImplicitShape.Transform(implicitShape, map); return(new ExplicitShape1(newShape, newRect)); }
public BitmaskShape1(string shape) { var bounds = new GridInterval(0, shape.Length); grid = new Grid1 <bool>(bounds); foreach (var point in grid.Points) { grid[point] = shape[point] != '0'; } }
/// <summary> /// Creates a 1D Segment Shape given a GridInterval. /// </summary> /// <param name="interval">Interval to transform into a Segment Shape</param> public static IImplicitShape <int> Segment(GridInterval interval) { return(new SegmentShape(interval)); }
public SegmentShape(GridInterval interval) { this.interval = interval; }