Package org.jbox2d.collision
Class AABB
java.lang.Object
org.jbox2d.collision.AABB
public class AABB
extends java.lang.Object
An axis-aligned bounding box.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Combines another aabb with this onefinal void
Combine two AABBs into this one.final boolean
Does this aabb contain the provided AABB.final Vec2
Get the center of the AABBfinal void
getCenterToOut
(Vec2 out) final Vec2
Get the extents of the AABB (half-widths).final void
getExtentsToOut
(Vec2 out) final float
Gets the perimeter lengthfinal void
getVertices
(Vec2[] argRay) final boolean
isValid()
Verify that the bounds are sortedfinal boolean
raycast
(RayCastOutput output, RayCastInput input) Deprecated.final boolean
raycast
(RayCastOutput output, RayCastInput input, IWorldPool argPool) From Real-time Collision Detection, p179.final void
Sets this object from the given objectstatic final boolean
testOverlap
(AABB a, AABB b) final java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
lowerBound
Bottom left vertex of bounding box. -
upperBound
Top right vertex of bounding box.
-
-
Constructor Details
-
AABB
public AABB()Creates the default object, with vertices at 0,0 and 0,0. -
AABB
Copies from the given object- Parameters:
copy
- the object to copy from
-
AABB
Creates an AABB object using the given bounding vertices.- Parameters:
lowerVertex
- the bottom left vertex of the bounding boxmaxVertex
- the top right vertex of the bounding box
-
-
Method Details
-
set
Sets this object from the given object- Parameters:
aabb
- the object to copy from
-
isValid
public final boolean isValid()Verify that the bounds are sorted -
getCenter
Get the center of the AABB- Returns:
-
getCenterToOut
-
getExtents
Get the extents of the AABB (half-widths).- Returns:
-
getExtentsToOut
-
getVertices
-
combine
Combine two AABBs into this one.- Parameters:
aabb1
-aab
-
-
getPerimeter
public final float getPerimeter()Gets the perimeter length- Returns:
-
combine
Combines another aabb with this one- Parameters:
aabb
-
-
contains
Does this aabb contain the provided AABB.- Returns:
-
raycast
Deprecated.please useraycast(RayCastOutput, RayCastInput, IWorldPool)
for better performance- Parameters:
output
-input
-- Returns:
-
raycast
From Real-time Collision Detection, p179.- Parameters:
output
-input
-
-
testOverlap
-
toString
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
raycast(RayCastOutput, RayCastInput, IWorldPool)
for better performance