Exemplo n.º 1
0
 public void Set(FixRect other)
 {
     _center = other._center;
     _max    = other._max;
     _min    = other._min;
     _size   = other._size;
 }
Exemplo n.º 2
0
        public static FixVec2 NormalizedToPoint(FixRect rectangle, FixVec2 normalizedRectCoordinates)
        {
            Fix x = FixMath.Min(FixMath.Max(Fix.Zero, normalizedRectCoordinates.X), Fix.One);
            Fix y = FixMath.Min(FixMath.Max(Fix.Zero, normalizedRectCoordinates.Y), Fix.One);

            return(new FixVec2(rectangle.xMin + (rectangle.xMax - rectangle.xMin) * x,
                               rectangle.yMin + (rectangle.yMax - rectangle.yMin) * y));
        }
Exemplo n.º 3
0
        public bool Overlaps(FixRect other)
        {
            if ((other.xMax < xMin) ||
                (other.xMin > xMax) ||
                (other.yMax < xMin) ||
                (other.yMin > yMax))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        public bool Contains(FixRect other)
        {
            if ((other.xMax <= xMax) &&
                (other.xMin >= xMin) &&
                (other.yMax <= yMax) &&
                (other.yMin >= yMin))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
 public static FixVec2 PointToNormalized(FixRect rectangle, FixVec2 point)
 {
     return(new FixVec2(FixMath.Min(FixMath.Max(Fix.Zero, (point.X - rectangle.xMin) / (rectangle.xMax - rectangle.xMin)), Fix.One),
                        FixMath.Min(FixMath.Max(Fix.Zero, (point.Y - rectangle.yMin) / (rectangle.yMax - rectangle.yMin)), Fix.One)));
 }