Пример #1
0
 /// <summary>
 /// Does this aabb contain the provided AABB.
 /// </summary>
 /// <param name="aabb">The aabb.</param>
 /// <returns>
 /// 	<c>true</c> if it contains the specified aabb; otherwise, <c>false</c>.
 /// </returns>
 public bool Contains(ref AABB2D aabb)
 {
     bool result = LowerBound.X <= aabb.LowerBound.X;
     result = result && LowerBound.Y <= aabb.LowerBound.Y;
     result = result && aabb.UpperBound.X <= UpperBound.X;
     result = result && aabb.UpperBound.Y <= UpperBound.Y;
     return result;
 }
Пример #2
0
 /// <summary>
 /// Combine two AABBs into this one.
 /// </summary>
 /// <param name="aabb1">The aabb1.</param>
 /// <param name="aabb2">The aabb2.</param>
 public void Combine(ref AABB2D aabb1, ref AABB2D aabb2)
 {
     LowerBound = Vector2D.Min(aabb1.LowerBound, aabb2.LowerBound);
     UpperBound = Vector2D.Max(aabb1.UpperBound, aabb2.UpperBound);
 }
Пример #3
0
        public static bool TestOverlap(ref AABB2D a, ref AABB2D b)
        {
            Vector2D d1 = b.LowerBound - a.UpperBound;
            Vector2D d2 = a.LowerBound - b.UpperBound;

            if (d1.X > 0.0f || d1.Y > 0.0f)
                return false;

            if (d2.X > 0.0f || d2.Y > 0.0f)
                return false;

            return true;
        }
Пример #4
0
 /// <summary>
 /// Combine an AABB into this one.
 /// </summary>
 /// <param name="aabb">The aabb.</param>
 public void Combine(ref AABB2D aabb)
 {
     LowerBound = Vector2D.Min(LowerBound, aabb.LowerBound);
     UpperBound = Vector2D.Max(UpperBound, aabb.UpperBound);
 }
Пример #5
0
 public static bool TestOverlap(AABB2D a, AABB2D b)
 {
     return TestOverlap(ref a, ref b);
 }