Exemplo n.º 1
0
 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));
        }
Exemplo n.º 3
0
 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);
        }
Exemplo n.º 5
0
 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)));
 }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
 public GridBoundingBox SetMaxY(int value)
 {
     return(new GridBoundingBox(XInterval, YInterval.SetMax(value)));
 }
Exemplo n.º 9
0
 public GridBoundingBox Translation(int x, int y)
 {
     return(new GridBoundingBox(XInterval.Translation(x), YInterval.Translation(y)));
 }
Exemplo n.º 10
0
 public bool Overlaps(GridBoundingBox other)
 {
     return(XInterval.Overlaps(other.XInterval) && YInterval.Overlaps(other.YInterval));
 }
Exemplo n.º 11
0
 public bool Contains(GridBoundingBox box)
 {
     return(XInterval.Contains(box.XInterval) && YInterval.Contains(box.YInterval));
 }
Exemplo n.º 12
0
 public bool Contains(int x, int y)
 {
     return(XInterval.Contains(x) && YInterval.Contains(y));
 }
Exemplo n.º 13
0
 public bool IntersectsWith(RectangleE r)
 {
     return(XInterval.IntersectsWith(r.XInterval) && YInterval.IntersectsWith(r.YInterval));
 }
Exemplo n.º 14
0
 public bool Contains(RectangleE rect)
 {
     return(XInterval.Contains(rect.XInterval) && YInterval.Contains(rect.YInterval));
 }
Exemplo n.º 15
0
 public bool Contains(PointE pt)
 {
     return(XInterval.Contains(pt.X) && YInterval.Contains(pt.Y));
 }