Пример #1
0
 public TSRect(TSRect source)
 {
     this.mXMin   = source.mXMin;
     this.mYMin   = source.mYMin;
     this.mWidth  = source.mWidth;
     this.mHeight = source.mHeight;
 }
Пример #2
0
        public override bool Equals(object other)
        {
            if (!(other is TSRect))
            {
                return(false);
            }
            TSRect vRect = (TSRect)other;

            return(this.x.Equals(vRect.x) && this.y.Equals(vRect.y) && this.width.Equals(vRect.width) && this.height.Equals(vRect.height));
        }
Пример #3
0
        public bool Overlaps(TSRect other, bool allowInverse)
        {
            TSRect rect = this;

            if (allowInverse)
            {
                rect  = TSRect.OrderMinMax(rect);
                other = TSRect.OrderMinMax(other);
            }
            return(rect.Overlaps(other));
        }
Пример #4
0
 private static TSRect OrderMinMax(TSRect rect)
 {
     if (rect.xMin > rect.xMax)
     {
         FP xMin = rect.xMin;
         rect.xMin = rect.xMax;
         rect.xMax = xMin;
     }
     if (rect.yMin > rect.yMax)
     {
         FP yMin = rect.yMin;
         rect.yMin = rect.yMax;
         rect.yMax = yMin;
     }
     return(rect);
 }
Пример #5
0
 public bool Overlaps(TSRect other)
 {
     return(other.xMax > this.xMin && other.xMin < this.xMax && other.yMax > this.yMin && other.yMin < this.yMax);
 }