Class Bounds

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(topLeft: Point, bottomRight: Point): Bounds

Creates a Bounds object from two coordinates (usually top-left and bottom-right corners).

Parameters

Returns

Bounds

constructor(points: Point[]): Bounds

Creates a Bounds object defined by the points it contains.

Parameters

Returns

Bounds

Properties

public max: Point

The bottom right corner of the rectangle.

public min: Point

The top left corner of the rectangle.

Methods

public contains(otherBounds: Bounds): boolean

Returns true if the rectangle contains the given one.

Parameters

Returns

boolean

public contains(point: Point): boolean

Returns true if the rectangle contains the given point.

Parameters

Returns

boolean

public extend(point: Point)

Extends the bounds to contain the given point.

Parameters

public getCenter(): Point

Returns the center point of the bounds.

Returns

Point

public getSize(): Point

Returns the size of the given bounds.

Returns

Point

public intersects(otherBounds: Bounds): boolean

Returns true if the rectangle intersects the given bounds.

Parameters

Returns

boolean

public isValid(): boolean

Returns true if the bounds are properly initialized.

Returns

boolean