Ejemplo n.º 1
0
        public static AbstractBounds <GridPoint3> Erode(AbstractBounds <GridPoint3> bounds)
        {
            var point = bounds.Point + GridPoint3.One;
            var size  = bounds.Size - 2 * GridPoint3.One;

            return(new GridBounds(point, size));
        }
Ejemplo n.º 2
0
        public static AbstractBounds <GridPoint2> Dilate(AbstractBounds <GridPoint2> rect)
        {
            var point = rect.Point - GridPoint2.One;
            var size  = rect.Size + 2 * GridPoint2.One;

            return(new GridRect(point, size));
        }
Ejemplo n.º 3
0
        public static AbstractBounds <GridPoint3> Dilate(AbstractBounds <GridPoint3> bounds)
        {
            var point = bounds.Point - GridPoint3.One;
            var size  = bounds.Size + 2 * GridPoint3.One;

            return(new GridBounds(point, size));
        }
Ejemplo n.º 4
0
        public static AbstractBounds <GridPoint2> Erode(AbstractBounds <GridPoint2> rect)
        {
            var point = rect.Point + GridPoint2.One;
            var size  = rect.Size - 2 * GridPoint2.One;

            return(new GridRect(point, size));
        }
Ejemplo n.º 5
0
        public static AbstractBounds<int> Erode(AbstractBounds<int> rect)
        {
            var point = rect.Point + 1;
            var size = rect.Size - 2 * 1;

            return new GridInterval(point, size);
        }
Ejemplo n.º 6
0
        public static AbstractBounds<int> Dilate(AbstractBounds<int> rect)
        {
            var point = rect.Point - 1;
            var size = rect.Size + 2 * 1;

            return new GridInterval(point, size);
        }
Ejemplo n.º 7
0
        public static GridRect UnionBoundingBox(AbstractBounds <GridPoint2> rect1, AbstractBounds <GridPoint2> rect2)
        {
            var bottomLeft = GridPoint2.Min(rect1.Point, rect2.Point);
            var topRight   = GridPoint2.Max(rect1.Extreme, rect2.Extreme);
            var dimensions = topRight - bottomLeft;

            return(new GridRect(bottomLeft, dimensions));
        }
Ejemplo n.º 8
0
        public static AbstractBounds<int> UnionBoundingBox(AbstractBounds<int> rect1, AbstractBounds<int> rect2)
        {
            var bottomLeft = Mathf.Min(rect1.Point, rect2.Point);
            var topRight = Mathf.Max(rect1.Extreme, rect2.Extreme);
            var dimensions = topRight - bottomLeft;

            return new GridInterval(bottomLeft, dimensions);
        }
Ejemplo n.º 9
0
        public static GridBounds Intersection(AbstractBounds <GridPoint3> bounds1, AbstractBounds <GridPoint3> bounds2)
        {
            var bottomLeft = GridPoint3.Max(bounds1.Point, bounds2.Point);
            var topRight   = GridPoint3.Min(bounds1.Extreme, bounds2.Extreme);

            var dimensions = topRight - bottomLeft;

            return(new GridBounds(bottomLeft, dimensions));
        }
Ejemplo n.º 10
0
 public static AbstractBounds <GridPoint3> Translate(AbstractBounds <GridPoint3> bounds, GridPoint3 offset)
 {
     return(new GridBounds(bounds.Point + offset, bounds.Size));
 }
Ejemplo n.º 11
0
 public static AbstractBounds <GridPoint3> Translate(AbstractBounds <GridPoint3> rect, GridPoint3 offset)
 {
     return(new GridBounds(rect.Point + offset, rect.Size));
 }
Ejemplo n.º 12
0
 public static AbstractBounds<int> Translate(AbstractBounds<int> rect, int offset)
 {
     return new GridInterval(rect.Point + offset, rect.Size);
 }
Ejemplo n.º 13
0
 public ExplicitShape1(IImplicitShape <int> implicitShape, AbstractBounds <int> storageBounds)
 {
     this.implicitShape = implicitShape;
     this.storageBounds = storageBounds;
 }
Ejemplo n.º 14
0
 public static IExplicitShape <GridPoint3> ToExplicit(this IImplicitShape <GridPoint3> shape, AbstractBounds <GridPoint3> bounds)
 {
     return(new ExplicitShape3(shape, bounds));
 }
Ejemplo n.º 15
0
 public static IExplicitShape <int> ToExplicit(this IImplicitShape <int> shape, AbstractBounds <int> bounds)
 {
     return(new ExplicitShape1(shape, bounds));
 }
Ejemplo n.º 16
0
 public ExplicitShape3(IImplicitShape <GridPoint3> implicitShape, AbstractBounds <GridPoint3> storageBounds)
 {
     this.implicitShape = implicitShape;
     this.storageBounds = storageBounds;
 }