Exemple #1
0
 public static CollidableRectangle sect(CollidableRectangle first, CollidableRectangle second)
 {
     var checkable1 = first.checkable;
     var checkable2 = second.checkable;
     if (!checkable1.Intersects(checkable2))
         return CollidableRectangle.Zero;
     var rectangle = Rectangle.Intersect(checkable1, checkable2);
     return new CollidableRectangle
     {
         Width = rectangle.Width,
         Height = rectangle.Height,
         pos = new Vector2(rectangle.Location.X, rectangle.Location.Y)
     };
 }
Exemple #2
0
        public static CollidableRectangle sect(CollidableRectangle first, CollidableRectangle second)
        {
            var checkable1 = first.checkable;
            var checkable2 = second.checkable;

            if (!checkable1.Intersects(checkable2))
            {
                return(CollidableRectangle.Zero);
            }
            var rectangle = Rectangle.Intersect(checkable1, checkable2);

            return(new CollidableRectangle
            {
                Width = rectangle.Width,
                Height = rectangle.Height,
                pos = new Vector2(rectangle.Location.X, rectangle.Location.Y)
            });
        }
Exemple #3
0
 public static bool rectEquals(CollidableRectangle rec1, CollidableRectangle rec2)
 {
     return(Math.Abs(rec1.pos.X - rec2.pos.X) < 1.0 / 1000.0 && Math.Abs(rec1.pos.X - rec2.pos.X) < 1.0 / 1000.0 &&
            (Math.Abs(rec1.Width - rec2.Width) < 1.0 / 1000.0 && Math.Abs(rec1.Height - rec2.Height) < 1.0 / 1000.0));
 }
Exemple #4
0
 public static bool compareRects(CollidableRectangle first, CollidableRectangle second)
 {
     return(first.pos.Equals(second.pos) && first.Width == (double)second.Width &&
            first.Height == (double)second.Height);
 }
Exemple #5
0
 public static bool rectEquals(CollidableRectangle rec1, CollidableRectangle rec2)
 {
     return Math.Abs(rec1.pos.X - rec2.pos.X) < 1.0/1000.0 && Math.Abs(rec1.pos.X - rec2.pos.X) < 1.0/1000.0 &&
            (Math.Abs(rec1.Width - rec2.Width) < 1.0/1000.0 && Math.Abs(rec1.Height - rec2.Height) < 1.0/1000.0);
 }
Exemple #6
0
 public static bool compareRects(CollidableRectangle first, CollidableRectangle second)
 {
     return first.pos.Equals(second.pos) && first.Width == (double) second.Width &&
            first.Height == (double) second.Height;
 }