public bool Touches(GridBoundingBox other) { return((XInterval.Touches(other.XInterval) && (YInterval.Overlaps(other.YInterval) || YInterval.Touches(other.YInterval))) || (YInterval.Touches(other.YInterval) && (XInterval.Overlaps(other.XInterval) || XInterval.Touches(other.XInterval)))); }
public RectangleE Intersect(RectangleE r) { IntervalE xIntersect = XInterval.Intersect(r.XInterval); IntervalE yIntersect = YInterval.Intersect(r.YInterval); return(new RectangleE(xIntersect, yIntersect)); }
public GridBoundingBox Relate( GridBoundingBox other, Relation xRelation, Relation yRelation, int xOffset = 0, int yOffset = 0) { return(new GridBoundingBox( XInterval.Relate(other.XInterval, xRelation, xOffset), YInterval.Relate(other.YInterval, yRelation, yOffset))); }
public RectangleE Union(PointE pt) { if (Contains(pt)) { return(CloneRect()); } IntervalE xInt = XInterval.Union(pt.X); RectangleE ans = new RectangleE(xInt, YInterval.Union(pt.Y)); return(ans); }
public GridBoundingBox SetPosition( int x, int y, IntervalAnchor xAnchor, IntervalAnchor yAnchor, int xOffset = 0, int yOffset = 0) { return(new GridBoundingBox( XInterval.SetPosition(x, xAnchor, xOffset), YInterval.SetPosition(y, yAnchor, yOffset))); }
public RectangleE Union(RectangleE r) { if (r.Height == 0 || r.Width == 0) { return(CloneRect()); } if (Height == 0 || Width == 0) { return(r.CloneRect()); } return(new RectangleE(XInterval.Union(r.XInterval), YInterval.Union(r.YInterval))); }
public GridCoordinatePair NearestPoint(int x, int y) { var xDistance = XInterval.Distance(x); var yDistance = YInterval.Distance(y); if (xDistance == 0 && yDistance == 0) { return(new GridCoordinatePair(x, y)); } if (xDistance == 0) { return(new GridCoordinatePair(x, yDistance < 0 ? MinY : MaxY)); } if (yDistance == 0) { return(new GridCoordinatePair(xDistance < 0 ? MinX : MaxX, y)); } return(new GridCoordinatePair(xDistance < 0 ? MinX : MaxX, yDistance < 0 ? MinY : MaxY)); }
public GridBoundingBox SetMaxY(int value) { return(new GridBoundingBox(XInterval, YInterval.SetMax(value))); }
public GridBoundingBox Translation(int x, int y) { return(new GridBoundingBox(XInterval.Translation(x), YInterval.Translation(y))); }
public bool Overlaps(GridBoundingBox other) { return(XInterval.Overlaps(other.XInterval) && YInterval.Overlaps(other.YInterval)); }
public bool Contains(GridBoundingBox box) { return(XInterval.Contains(box.XInterval) && YInterval.Contains(box.YInterval)); }
public bool Contains(int x, int y) { return(XInterval.Contains(x) && YInterval.Contains(y)); }
public bool IntersectsWith(RectangleE r) { return(XInterval.IntersectsWith(r.XInterval) && YInterval.IntersectsWith(r.YInterval)); }
public bool Contains(RectangleE rect) { return(XInterval.Contains(rect.XInterval) && YInterval.Contains(rect.YInterval)); }
public bool Contains(PointE pt) { return(XInterval.Contains(pt.X) && YInterval.Contains(pt.Y)); }