Class b2AABB

Axis aligned bounding box.

Index

Properties

Methods

Properties

public lowerBound: b2Vec2

Lower bound.

public upperBound: b2Vec2

Upper bound.

Methods

public static Combine(aabb1: b2AABB, aabb2: b2AABB): b2AABB

Combines two AABBs into one with max values for upper bound and min values for lower bound.

Parameters

  • aabb1: b2AABB

    First AABB to combine.

  • aabb2: b2AABB

    Second AABB to combine.

Returns

b2AABB

New AABB with max values from aabb1 and aabb2.

public Combine(aabb1: b2AABB, aabb2: b2AABB)

Combines two AABBs into one with max values for upper bound and min values for lower bound. The result is stored in this AABB.

Parameters

  • aabb1: b2AABB

    First AABB to combine.

  • aabb2: b2AABB

    Second AABB to combine.

public Contains(aabb: b2AABB): boolean

Determines if an AABB is contained within this one.

Parameters

  • aabb: b2AABB

    AABB to see if it is contained.

Returns

boolean

True if aabb is contained, otherwise false.

public GetCenter(): b2Vec2

Gets the center of the AABB.

Returns

b2Vec2

Center of this AABB.

public GetExtents(): b2Vec2

Gets the extents of the AABB (half-widths).

Returns

b2Vec2

Extents of this AABB.

public IsValid(): boolean

Verify that the bounds are sorted.

Returns

boolean

True if the bounds are sorted, otherwise false.

public RayCast(output: b2RayCastOutput, input: b2RayCastInput): boolean

Perform a precise raycast against this AABB.

Parameters

Returns

boolean

True if the ray cast hits this AABB, otherwise false.

public TestOverlap(other: b2AABB): boolean

Tests if another AABB overlaps this AABB.

Parameters

  • other: b2AABB

    Other AABB to test for overlap.

Returns

boolean

True if other overlaps this AABB, otherwise false.