예제 #1
0
        public Rectangle2 Round()
        {
            Rectangle2 result = this;

            result.Start = new Vector2((float)Math.Floor(result.Start.X), (float)Math.Floor(result.Start.Y));
            result.End   = new Vector2((float)Math.Ceiling(result.End.X), (float)Math.Ceiling(result.End.Y));
            return(result);
        }
예제 #2
0
 public bool Intersects(Rectangle2 other) =>
 Start.X <= other.End.X && End.X >= other.Start.X &&
 Start.Y <= other.End.Y && End.Y >= other.Start.Y;
예제 #3
0
 public bool Contains(Rectangle2 other) =>
 Start.X <= other.Start.X && End.X >= other.End.X && Start.Y <= other.Start.Y && End.Y >= other.End.Y;
예제 #4
0
 public Rectangle2 Union(Rectangle2 other) =>
 new Rectangle2(Vector2.Min(Start, other.Start), Vector2.Max(End, other.End));
예제 #5
0
 public Rectangle2 Intersect(Rectangle2 other) =>
 new Rectangle2(Vector2.Max(Start, other.Start), Vector2.Min(End, other.End));
예제 #6
0
 public bool Equals(Rectangle2 other) => this == other;