Esempio n. 1
0
 /// <summary>
 /// Determines if the specified bounds intersects with this Bounds2 structure.
 /// </summary>
 /// <param name="bounds"></param>
 /// <returns></returns>
 public bool Intersects(Bounds2 bounds) => Intersects(ref this, ref bounds);
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bounds"></param>
 /// <param name="vector"></param>
 /// <returns></returns>
 public static bool Contains(ref Bounds2 bounds, ref Vector2 vector)
 {
     return
         ((vector.X >= bounds.Minimum.X && vector.X <= bounds.Maximum.X) &&
          (vector.Y >= bounds.Minimum.Y && vector.Y <= bounds.Maximum.Y));
 }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static bool Intersects(ref Bounds2 left, ref Bounds2 right)
 {
     return
         (((left.Minimum.X <= right.Minimum.X && right.Minimum.X <= left.Maximum.X) || (right.Minimum.X <= left.Minimum.X && left.Minimum.X <= right.Maximum.X)) &&
          ((left.Minimum.Y <= right.Minimum.Y && right.Minimum.Y <= left.Maximum.Y) || (right.Minimum.Y <= left.Minimum.Y && left.Minimum.Y <= right.Maximum.Y)));
 }
Esempio n. 4
0
 /// <summary>
 /// Normalizes the bounds and ensures that the maximum values and minimum values are in the right place.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static Bounds2 Normalize(Bounds2 value)
 {
     return(new Bounds2(
                Math.Min(value.Minimum.X, value.Maximum.X), Math.Max(value.Minimum.X, value.Maximum.X),
                Math.Min(value.Minimum.Y, value.Maximum.Y), Math.Max(value.Minimum.Y, value.Maximum.Y)));
 }