Пример #1
0
 /// <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)));
 }
Пример #2
0
        /// <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));
        }
Пример #3
0
 public bool Overlaps(Recti r)
 {
     return(max > r.min && min < r.max);
 }
Пример #4
0
 public bool Contains(Recti r)
 {
     return(min <= r.min && max >= r.max);
 }
Пример #5
0
 public Recti(Recti other)
 {
     _pos = other._pos; _size = other._size;
 }
Пример #6
0
 public Vec2i NextVec2i(Recti rect)
 {
     return(new Vec2i(
                rect.left + NextIntRange(rect.width),
                rect.bottom + NextIntRange(rect.height)));
 }
Пример #7
0
 public Grid(int w, int h)
 {
     Size        = new Vec2i(w, h);
     LocalRegion = new Recti(0, 0, w, h);
     TotalCells  = w * h;
 }