Skip to content

Class: AABB

AABB is an Axis-Aligned Bounding-Box, this is a rectangle that has no rotation; it is aligned with the X and Y axis. The AABB is defined by a centre and width and height dimensions, it can be used for faster collision detection as it is a more simple shape, requiring less calculations than a fully defined polygon.

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new AABB(size: Vector, center?: Vector): AABB

Parameters:

Name Type
size Vector
center Vector

Returns: AABB

Properties

center

center: Vector


size

size: Vector

Methods

Center

Center(): Vector

Center calculates/retrieves the center of a shape.

Returns: Vector

Implementation of: IShape


Copy

Copy(): AABB

Creates a copy of the shape and its values, rather than pointing to the same Shape.

Returns: AABB

Implementation of: IShape


FarthestPointInDirection

FarthestPointInDirection(direction: Vector): Vector

FarthestPointInDirection returns the point that is farthest in the direction provided. Used in the GJK algorithm for collision detection.

Parameters:

Name Type
direction Vector

Returns: Vector

Implementation of: IShape


Free

Free(): void

Free releases an object or it's constituent parts back into any available object pools.

Returns: void

Implementation of: IShape


PointInside

PointInside(point: Vector): boolean

PointInside determines if a point provided is within the shape or not.

Parameters:

Name Type
point Vector

Returns: boolean

Implementation of: IShape


Transform

Transform(transform: Transform): IShape

Transform takes a transform and applies it to shape.

Parameters:

Name Type
transform Transform

Returns: IShape

Implementation of: IShape