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 Modifier and Type Field Description Vec2
lowerBound
Bottom left vertex of bounding box.Vec2
upperBound
Top right vertex of bounding box.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
combine(AABB aabb)
Combines another aabb with this onevoid
combine(AABB aabb1, AABB aab)
Combine two AABBs into this one.boolean
contains(AABB aabb)
Does this aabb contain the provided AABB.Vec2
getCenter()
Get the center of the AABBvoid
getCenterToOut(Vec2 out)
Vec2
getExtents()
Get the extents of the AABB (half-widths).void
getExtentsToOut(Vec2 out)
float
getPerimeter()
Gets the perimeter lengthvoid
getVertices(Vec2[] argRay)
boolean
isValid()
Verify that the bounds are sortedboolean
raycast(RayCastOutput output, RayCastInput input)
Deprecated.please useraycast(RayCastOutput, RayCastInput, IWorldPool)
for better performanceboolean
raycast(RayCastOutput output, RayCastInput input, IWorldPool argPool)
From Real-time Collision Detection, p179.void
set(AABB aabb)
Sets this object from the given objectstatic boolean
testOverlap(AABB a, AABB b)
java.lang.String
toString()
-
-
-
Constructor Detail
-
AABB
public AABB()
Creates the default object, with vertices at 0,0 and 0,0.
-
AABB
public AABB(AABB copy)
Copies from the given object- Parameters:
copy
- the object to copy from
-
-
Method Detail
-
set
public final void set(AABB aabb)
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
public final Vec2 getCenter()
Get the center of the AABB- Returns:
-
getCenterToOut
public final void getCenterToOut(Vec2 out)
-
getExtents
public final Vec2 getExtents()
Get the extents of the AABB (half-widths).- Returns:
-
getExtentsToOut
public final void getExtentsToOut(Vec2 out)
-
getVertices
public final void getVertices(Vec2[] argRay)
-
combine
public final void combine(AABB aabb1, AABB aab)
Combine two AABBs into this one.- Parameters:
aabb1
-aab
-
-
getPerimeter
public final float getPerimeter()
Gets the perimeter length- Returns:
-
combine
public final void combine(AABB aabb)
Combines another aabb with this one- Parameters:
aabb
-
-
contains
public final boolean contains(AABB aabb)
Does this aabb contain the provided AABB.- Returns:
-
raycast
public final boolean raycast(RayCastOutput output, RayCastInput input)
Deprecated.please useraycast(RayCastOutput, RayCastInput, IWorldPool)
for better performance- Parameters:
output
-input
-- Returns:
-
raycast
public final boolean raycast(RayCastOutput output, RayCastInput input, IWorldPool argPool)
From Real-time Collision Detection, p179.- Parameters:
output
-input
-
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-