示例#1
0
        public static Vector2 IntersectionDepth(Box2D a, Box2D b)
        {
            float xDepth = DepthOnAxis(a.Min.X, a.Max.X, b.Min.X, b.Max.X);
            float yDepth = DepthOnAxis(a.Min.Y, a.Max.Y, b.Min.Y, b.Max.Y);

            return(new Vector2(xDepth, yDepth));
        }
示例#2
0
 public static bool Intersect(Box2D a, Box2D b)
 {
     return
         (!(a.Min.X >= b.Max.X || a.Max.X <= b.Min.X ||
            a.Min.Y >= b.Max.Y || a.Max.Y <= b.Min.Y));
 }
示例#3
0
 public static bool Contains(Box2D a, Vector2 pos)
 {
     return
         (a.Min.X <= pos.X && a.Max.X >= pos.X &&
          a.Min.Y <= pos.Y && a.Max.Y >= pos.Y);
 }