Bounding Box Types
BBox and BBoxish are representations of bounding boxes in a 2D space.
BBox
The BBox type represents a bounding box in a 2D graph space.
It is an object that contains two properties, horizontal and vertical, each of which is a Vec2 instance.
- typescript
export type BBox = { horizontal: Vec2; vertical: Vec2; };
horizontalrepresents the horizontal range of the bounding box, wherexis the left boundary andyis the right boundary.verticalrepresents the vertical range of the bounding box, wherex is the lower boundary andy` is the upper boundary.
BBoxish
The BBoxish type is a flexible representation of a bounding box.
- typescript
export type BBoxish = | { horizontal: Vec2ish; vertical: Vec2ish; } | { x: Vec2ish; y: Vec2ish; } | [number, number, number, number];
- An
objectwith horizontal and vertical properties, each of which is aVec2ishtype, providing flexibility in defining the ranges. - An
objectwithxandyproperties, wherexrepresents the horizontal range andythe vertical range. Each property is aVec2ishtype. - A tuple of four numbers, where the numbers represent
[left, bottom, right, top]boundaries of the bounding box. This is similar to the format used in many graphics and layout systems.