A simple axis-aligned bounding box (AABB) data structure used to define rectangular boundaries. Provides a clearer alternative to array-based bounds representation [minX, minY, maxX, maxY].
// Create bounds dataconst bounds: BoundsData = { minX: 0, minY: 0, maxX: 100, maxY: 100};// Calculate dimensionsconst width = bounds.maxX - bounds.minX;const height = bounds.maxY - bounds.minY;// Check if point is insideconst isInside = (x: number, y: number) => x >= bounds.minX && x <= bounds.maxX && y >= bounds.minY && y <= bounds.maxY; Copy
// Create bounds dataconst bounds: BoundsData = { minX: 0, minY: 0, maxX: 100, maxY: 100};// Calculate dimensionsconst width = bounds.maxX - bounds.minX;const height = bounds.maxY - bounds.minY;// Check if point is insideconst isInside = (x: number, y: number) => x >= bounds.minX && x <= bounds.maxX && y >= bounds.minY && y <= bounds.maxY;
The maximum X coordinate of the bounds
The maximum Y coordinate of the bounds
The minimum X coordinate of the bounds
The minimum Y coordinate of the bounds
A simple axis-aligned bounding box (AABB) data structure used to define rectangular boundaries. Provides a clearer alternative to array-based bounds representation [minX, minY, maxX, maxY].
Example
See