/// <summary> Get the unioned region with the specified rectangle. </summary> public Recti Union(Recti ot) { return(MinMaxRecti( Math.Min(xMin, ot.xMin), Math.Min(yMin, ot.yMin), Math.Max(xMax, ot.xMax), Math.Max(yMax, ot.yMax))); }
/// <summary> /// Determines if any one of the edges of the given rectangle overlaps one of the edges. /// </summary> /// <param name="other"></param> /// <returns></returns> public bool OverlapsEdge(Recti other) { Segment1i h = new Segment1i(other.left, other.right), v = new Segment1i(other.bottom, other.top); return(OverlapsEdge(h, other.bottom, false) || OverlapsEdge(v, other.left, true) || OverlapsEdge(h, other.top - 1, false) || OverlapsEdge(v, other.right - 1, true)); }
public bool Overlaps(Recti r) { return(max > r.min && min < r.max); }
public bool Contains(Recti r) { return(min <= r.min && max >= r.max); }
public Recti(Recti other) { _pos = other._pos; _size = other._size; }
public Vec2i NextVec2i(Recti rect) { return(new Vec2i( rect.left + NextIntRange(rect.width), rect.bottom + NextIntRange(rect.height))); }
public Grid(int w, int h) { Size = new Vec2i(w, h); LocalRegion = new Recti(0, 0, w, h); TotalCells = w * h; }