An axis aligned bounding box.
Example #1
0
 /// <summary>
 /// Query the world for all fixtures that potentially overlap the
 /// provided AABB.
 /// </summary>
 /// <param name="callback">A user implemented callback class.</param>
 /// <param name="aabb">The aabb query box.</param>
 public void QueryAABB(Func<Fixture, bool> callback, ref AABB aabb)
 {
     _queryAABBCallback = callback;
     ContactManager.BroadPhase.Query(_queryAABBCallbackWrapper, ref aabb);
     _queryAABBCallback = null;
 }
 /// <summary>
 /// Get all intersections between a line segment and an AABB. 
 /// </summary>
 /// <param name="point1">The first point of the line segment to test</param>
 /// <param name="point2">The second point of the line segment to test.</param>
 /// <param name="aabb">The AABB that is used for testing intersection.</param>
 /// <param name="intersectionPoints">An list of intersection points. Any intersection points found will be added to this list.</param>
 public static void LineSegmentAABBIntersect(ref Vector2 point1, ref Vector2 point2, AABB aabb,
     ref List<Vector2> intersectionPoints)
 {
     LineSegmentVerticesIntersect(ref point1, ref point2, aabb.Vertices, ref intersectionPoints);
 }
 /// <summary>
 /// Get the fixture's AABB. This AABB may be enlarge and/or stale.
 /// If you need a more accurate AABB, compute it using the Shape and
 /// the body transform.
 /// </summary>
 /// <param name="aabb">The aabb.</param>
 /// <param name="childIndex">Index of the child.</param>
 public void GetAABB(out AABB aabb, int childIndex)
 {
     Debug.Assert(0 <= childIndex && childIndex < ProxyCount);
     aabb = Proxies[childIndex].AABB;
 }
Example #4
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 AABB aabb)
 {
     bool result = true;
     result = 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;
 }
Example #5
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 AABB aabb1, ref AABB aabb2)
 {
     LowerBound = Vector2.Min(aabb1.LowerBound, aabb2.LowerBound);
     UpperBound = Vector2.Max(aabb1.UpperBound, aabb2.UpperBound);
 }
Example #6
0
 /// <summary>
 /// Combine an AABB into this one.
 /// </summary>
 /// <param name="aabb">The aabb.</param>
 public void Combine(ref AABB aabb)
 {
     LowerBound = Vector2.Min(LowerBound, aabb.LowerBound);
     UpperBound = Vector2.Max(UpperBound, aabb.UpperBound);
 }
Example #7
0
        public static bool TestOverlap(ref AABB a, ref AABB b)
        {
            Vector2 d1 = b.LowerBound - a.UpperBound;
            Vector2 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;
        }