Skip to content

Documentation / @ripl/core / Box

Class: Box ​

Defined in: packages/core/src/math/structs.ts:2

An axis-aligned bounding box defined by its four edges.

Constructors ​

Constructor ​

new Box(top, left, bottom, right): Box

Defined in: packages/core/src/math/structs.ts:4

Parameters ​

ParameterTypeDescription
topnumberThe y-coordinate of the box's top edge.
leftnumberThe x-coordinate of the box's left edge.
bottomnumberThe y-coordinate of the box's bottom edge.
rightnumberThe x-coordinate of the box's right edge.

Returns ​

Box

Properties ​

PropertyModifierTypeDescriptionDefined in
bottompublicnumberThe y-coordinate of the box's bottom edge.packages/core/src/math/structs.ts:10
leftpublicnumberThe x-coordinate of the box's left edge.packages/core/src/math/structs.ts:8
rightpublicnumberThe x-coordinate of the box's right edge.packages/core/src/math/structs.ts:12
toppublicnumberThe y-coordinate of the box's top edge.packages/core/src/math/structs.ts:6

Accessors ​

height ​

Get Signature ​

get height(): number

Defined in: packages/core/src/math/structs.ts:26

The vertical span of the box.

Returns ​

number


width ​

Get Signature ​

get width(): number

Defined in: packages/core/src/math/structs.ts:21

The horizontal span of the box.

Returns ​

number

Methods ​

empty() ​

static empty(): Box

Defined in: packages/core/src/math/structs.ts:16

Creates a zero-sized box at the origin.

Returns ​

Box