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)); }
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)); }
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)); }
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)); }
public static AbstractBounds<int> Erode(AbstractBounds<int> rect) { var point = rect.Point + 1; var size = rect.Size - 2 * 1; return new GridInterval(point, size); }
public static AbstractBounds<int> Dilate(AbstractBounds<int> rect) { var point = rect.Point - 1; var size = rect.Size + 2 * 1; return new GridInterval(point, size); }
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)); }
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); }
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)); }
public static AbstractBounds <GridPoint3> Translate(AbstractBounds <GridPoint3> bounds, GridPoint3 offset) { return(new GridBounds(bounds.Point + offset, bounds.Size)); }
public static AbstractBounds <GridPoint3> Translate(AbstractBounds <GridPoint3> rect, GridPoint3 offset) { return(new GridBounds(rect.Point + offset, rect.Size)); }
public static AbstractBounds<int> Translate(AbstractBounds<int> rect, int offset) { return new GridInterval(rect.Point + offset, rect.Size); }
public ExplicitShape1(IImplicitShape <int> implicitShape, AbstractBounds <int> storageBounds) { this.implicitShape = implicitShape; this.storageBounds = storageBounds; }
public static IExplicitShape <GridPoint3> ToExplicit(this IImplicitShape <GridPoint3> shape, AbstractBounds <GridPoint3> bounds) { return(new ExplicitShape3(shape, bounds)); }
public static IExplicitShape <int> ToExplicit(this IImplicitShape <int> shape, AbstractBounds <int> bounds) { return(new ExplicitShape1(shape, bounds)); }
public ExplicitShape3(IImplicitShape <GridPoint3> implicitShape, AbstractBounds <GridPoint3> storageBounds) { this.implicitShape = implicitShape; this.storageBounds = storageBounds; }