public class AABB

  1. Object
  2. AABB
An axis-aligned bounding box.

Fields

public final Vec2 lowerBoundBottom left vertex of bounding box.
public final Vec2 upperBoundTop right vertex of bounding box.

Constructors

public AABB()Creates the default object, with vertices at 0,0 and 0,0.
public AABB(AABB copy)Copies from the given object
public AABB(Vec2 lowerVertex, Vec2 upperVertex)Creates an AABB object using the given bounding vertices.

Methods

public final void set(AABB aabb)Sets this object from the given object
public final boolean isValid()Verify that the bounds are sorted
public final Vec2 getCenter()Get the center of the AABB
public final void getCenterToOut(Vec2 out)
public final Vec2 getExtents()Get the extents of the AABB (half-widths).
public final void getExtentsToOut(Vec2 out)
public final void getVertices(Vec2[] argRay)
public final void combine(AABB aabb1, AABB aab)Combine two AABBs into this one.
public final float getPerimeter()Gets the perimeter length
public final void combine(AABB aabb)Combines another aabb with this one
public final boolean contains(AABB aabb)Does this aabb contain the provided AABB.
public final boolean raycast(RayCastOutput output, RayCastInput input)Deprecated
public final boolean raycast(RayCastOutput output, RayCastInput input, IWorldPool argPool)From Real-time Collision Detection, p179.
public static final boolean testOverlap(AABB a, AABB b)
public final String toString()Returns a string representation of the object.

Inherited methods

Field details

lowerBound

public final Vec2 lowerBound
Bottom left vertex of bounding box.

upperBound

public final Vec2 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

public AABB(AABB copy)
Copies from the given object

Parameters

copy AABB
the object to copy from

AABB

public AABB(Vec2 lowerVertex, Vec2 upperVertex)
Creates an AABB object using the given bounding vertices.

Parameters

lowerVertex Vec2
the bottom left vertex of the bounding box
upperVertex Vec2
Not documented.

Method details

set

public final void set(AABB aabb)
Sets this object from the given object

Parameters

aabb 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

getCenterToOut

public final void getCenterToOut(Vec2 out)

getExtents

public final Vec2 getExtents()
Get the extents of the AABB (half-widths).

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.

getPerimeter

public final float getPerimeter()
Gets the perimeter length

combine

public final void combine(AABB aabb)
Combines another aabb with this one

contains

public final boolean contains(AABB aabb)
Does this aabb contain the provided AABB.

raycast

public final boolean raycast(RayCastOutput output, RayCastInput input)
Deprecated. please use raycast(RayCastOutput, RayCastInput, IWorldPool) for better performance

raycast

public final boolean raycast(RayCastOutput output, RayCastInput input, IWorldPool argPool)
From Real-time Collision Detection, p179.

testOverlap

public static final boolean testOverlap(AABB a, AABB b)

toString

public final String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())