Ejemplo n.º 1
0
 public static Bounds2 <T> Intersect(Bounds2 <T> b1, Bounds2 <T> b2)
 {
     return(new Bounds2 <T>(
                new Point2 <T>(
                    Math.Max((dynamic)b1.Min.X, (dynamic)b2.Min.X),
                    Math.Max((dynamic)b1.Min.Y, (dynamic)b2.Min.Y)),
                new Point2 <T>(
                    Math.Min((dynamic)b1.Max.X, (dynamic)b2.Max.X),
                    Math.Min((dynamic)b1.Max.Y, (dynamic)b2.Max.Y))));
 }
Ejemplo n.º 2
0
 public static Bounds2 <T> Union(Bounds2 <T> b, Vector2 <T> p)
 {
     return(new Bounds2 <T>(
                new Point2 <T>(
                    Math.Min((dynamic)b.Min.X, (dynamic)p.X),
                    Math.Min((dynamic)b.Min.Y, (dynamic)p.Y)),
                new Point2 <T>(
                    Math.Max((dynamic)b.Max.X, (dynamic)p.X),
                    Math.Max((dynamic)b.Max.Y, (dynamic)p.Y))));
 }
Ejemplo n.º 3
0
 public static Bounds2 <T> Expand(Bounds2 <T> b, float delta)
 {
     return(new Bounds2 <T>(b.Min - (dynamic)delta * Vector2 <T> .One, b.Max + (dynamic)delta * Vector2 <T> .One));
 }
Ejemplo n.º 4
0
 public static bool Overlaps(Bounds2 <T> b1, Bounds2 <T> b2)
 {
     return
         ((dynamic)b1.Max.X >= b2.Min.X && (dynamic)b1.Min.X <= b2.Max.X &&
          (dynamic)b1.Max.Y >= b2.Min.Y && (dynamic)b1.Min.Y <= b2.Max.Y);
 }