Class: AABB

Grape2D. AABB

new AABB(options)

AABB (standing for Axis Align Bounding Box), represents rectangular shapes.
Parameters:
Name Type Description
options Object Setup options. See Grape2D.Shape
Properties
Name Type Argument Description
position Grape2D.Vector <nullable>
The position of the polygon.
width number Width of the AABB.
height number Height of the AABB.
Source:

Extends

Members

<private, static> TYPE :string

Type of the shape.
Type:
  • string
Source:

<private> max :Grape2D.Vector

Maximum coordinates of the AABB. This is the same as the bottom right corner.
Type:
Source:

<private> min :Grape2D.Vector

Minimum coordinates of the AABB. This is the same as the top left corner.
Type:
Source:

<protected> position :Grape2D.Vector

Shape's position.
Type:
Inherited From:
Source:

Methods

createBV()

Source:

getHalfHeight() → {number}

Gets the half height (height/2) of the AABB.
Source:
Returns:
Half height of the AABB.
Type
number

getHalfWidth() → {number}

Gets the half width (width/2) of the AABB.
Source:
Returns:
Half width of the AABB.
Type
number

getHeight() → {number}

Gets the height of the AABB.
Source:
Returns:
The height of the AABB.
Type
number

getMax() → {Grape2D.Vector}

Gets the bottom right corner coordinates of the AABB.
Source:
Returns:
Bottom right corner.
Type
Grape2D.Vector

getMaxX() → {number}

Gets the maximum x coordinate of the AABB.
Source:
Returns:
Maximum x coordinate.
Type
number

getMaxY() → {number}

Gets the maximum y coordinate of the AABB.
Source:
Returns:
Maximum y coordinate.
Type
number

getMin() → {Grape2D.Vector}

Gets the top left corner coordinates of the AABB.
Source:
Returns:
Top left corner.
Type
Grape2D.Vector

getMinX() → {number}

Gets the minimum x coordinate of the AABB.
Source:
Returns:
Minimum x coordinate.
Type
number

getMinY() → {number}

Gets the minimum y coordinate of the AABB.
Source:
Returns:
Minimum y coordinate.
Type
number

getPosition() → {Grape2D.Vector}

Gets the position of the object.
Inherited From:
Source:
Returns:
The center position of the shape.
Type
Grape2D.Vector

getStaticType()

Source:

getWidth() → {number}

Gets the width of the AABB.
Source:
Returns:
The width of the AABB.
Type
number

render()

Source:

setHeight(height)

Sets the height of the AABB.
Parameters:
Name Type Description
height number The height of the AABB.
Source:

setPosition()

Source:

setWidth(width)

Sets the width of the AABB.
Parameters:
Name Type Description
width number The width of the AABB.
Source: