AxisAlignedBounds

class AxisAlignedBounds

Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.

Constructor


new AxisAlignedBounds(x: number, y: number, width: number, height: number) → {}
Parameters:
Name Type Attributes Default Description
x number

<optional>

0

The X coordinate of the upper-left corner of the rectangle

y number

<optional>

0

The Y coordinate of the upper-left corner of the rectangle

width number

<optional>

0

The overall width of this rectangle

height number

<optional>

0

The overall height of this rectangle

Summary


Properties from AxisAlignedBounds

number
bottom

returns the bottom edge of the rectangle

number
left

returns the left edge of the rectangle

number
right

returns the right edge of the rectangle

number
top

returns the top edge of the rectangle

Methods from AxisAlignedBounds

this
ceil(resolution: number, eps: number)

Enlarges rectangle that way its corners lie on grid

AxisAlignedBounds
clone()

Creates a clone of this Rectangle

boolean
contains(x: number, y: number)

Checks whether the x and y coordinates given are contained within this Rectangle

AxisAlignedBounds
copyFrom(rectangle: AxisAlignedBounds)

Copies another rectangle to this one.

AxisAlignedBounds
copyTo(rectangle: AxisAlignedBounds)

Copies this rectangle to another one.

this
enlarge(rectangle: AxisAlignedBounds)

Enlarges this rectangle to include the passed rectangle.

boolean
equals(bounds: AxisAlignedBounds)

Checks whether the given bounds are equal to this.

this
fit(rectangle: AxisAlignedBounds)

Fits this rectangle around the passed one.

this
pad(paddingX: number, paddingY)

Public Properties


bottom AxisAlignedBounds.ts:154
bottom: number

returns the bottom edge of the rectangle

left AxisAlignedBounds.ts:128
left: number

returns the left edge of the rectangle

top AxisAlignedBounds.ts:146
top: number

returns the top edge of the rectangle

Public Methods


ceil AxisAlignedBounds.ts:284
ceil(resolution: number, eps: number) → {this}

Enlarges rectangle that way its corners lie on grid

Parameters:
Name Type Attributes Default Description
resolution number

<optional>

1

resolution

eps number

<optional>

0.001

precision

Returns:
Type Description
this

Returns itself.

clone AxisAlignedBounds.ts:162
clone() → {AxisAlignedBounds}

Creates a clone of this Rectangle

Returns:
Type Description
AxisAlignedBounds

A copy of this AxisAlignedBounds.

contains AxisAlignedBounds.ts:204
contains(x: number, y: number) → {boolean}

Checks whether the x and y coordinates given are contained within this Rectangle

Parameters:
Name Type Description
x number

The X coordinate of the point to test

y number

The Y coordinate of the point to test

Returns:
Type Description
boolean

Whether the x/y coordinates are within this Rectangle

copyFrom AxisAlignedBounds.ts:172
copyFrom(rectangle: AxisAlignedBounds) → {AxisAlignedBounds}

Copies another rectangle to this one.

Parameters:
Name Type Description
rectangle AxisAlignedBounds

The rectangle to copy from.

Returns:
Type Description
AxisAlignedBounds

Returns itself.

copyTo AxisAlignedBounds.ts:188
copyTo(rectangle: AxisAlignedBounds) → {AxisAlignedBounds}

Copies this rectangle to another one.

Parameters:
Name Type Description
rectangle AxisAlignedBounds

The rectangle to copy to.

Returns:
Type Description
AxisAlignedBounds

Returns given parameter.

enlarge AxisAlignedBounds.ts:305
enlarge(rectangle: AxisAlignedBounds) → {this}

Enlarges this rectangle to include the passed rectangle.

Parameters:
Name Type Description
rectangle AxisAlignedBounds

The rectangle to include.

Returns:
Type Description
this

Returns itself.

equals AxisAlignedBounds.ts:229
equals(bounds: AxisAlignedBounds) → {boolean}

Checks whether the given bounds are equal to this.

Parameters:
Name Type Description
bounds AxisAlignedBounds
Returns:
Type Description
boolean
fit AxisAlignedBounds.ts:263
fit(rectangle: AxisAlignedBounds) → {this}

Fits this rectangle around the passed one.

Parameters:
Name Type Description
rectangle AxisAlignedBounds

The rectangle to fit.

Returns:
Type Description
this

Returns itself.

pad AxisAlignedBounds.ts:244
pad(paddingX: number, paddingY) → {this}

Pads the rectangle making it grow in all directions. If paddingY is omitted, both paddingX and paddingY will be set to paddingX.

Parameters:
Name Type Attributes Default Description
paddingX number

<optional>

0

The horizontal padding amount.

paddingY

<optional>

0

The vertical padding amount.

Returns:
Type Description
this

Returns itself.


Powered by webdoc!