示例#1
0
            public ExplicitShape1 Intersection(ExplicitShape1 shape)
            {
                var newRect  = GridInterval.Intersection(storageBounds, shape.storageBounds);
                var newShape = ImplicitShape.Intersection(implicitShape, shape.implicitShape);

                return(new ExplicitShape1(newShape, newRect));
            }
示例#2
0
        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);
        }
示例#3
0
            public ExplicitShape1 Union(ExplicitShape1 shape)
            {
                var newRect  = GridInterval.UnionBoundingBox(storageBounds, shape.storageBounds);
                var newShape = ImplicitShape.Union(implicitShape, shape.implicitShape);

                return(new ExplicitShape1(newShape, newRect));
            }
示例#4
0
            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));
            }
示例#5
0
            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';
                }
            }
示例#6
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));
 }
示例#7
0
 public SegmentShape(GridInterval interval)
 {
     this.interval = interval;
 }