API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classRectangle
Mutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements ShapeLike with full SAT collision response for rectangles and polygons, and specialised algorithms for circle and ellipse intersections. `Rectangle.temp` is a shared scratch instance. Edge normals are lazily computed and cached; they are invalidated when position or size mutates.
import { Rectangle } from '@codexo/exojs' Mutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements ShapeLike with full SAT collision response for rectangles and polygons, and specialised algorithms for circle and ellipse intersections.
`Rectangle.temp` is a shared scratch instance. Edge normals are lazily computed and cached; they are invalidated when position or size mutates.
new(x: number, y: number, width: number, height: number): Rectangle clone(): this collidesWith(target: Collidable): CollisionResponse | null contains(x: number, y: number): boolean containsRect(rect: Rectangle): boolean copy(rectangle: Rectangle): this destroy(): void equals(__namedParameters: Partial<Rectangle>): boolean getBounds(): Rectangle getNormals(): Vector[] intersectsWith(target: Collidable): boolean project(axis: Vector, result: Interval): Interval set(x: number, y: number, width: number, height: number): this setPosition(x: number, y: number): this setSize(width: number, height: number): this transform(matrix: Matrix, result: Rectangle): Rectangle collisionType: CollisionType bottom: number height: number left: number position: Vector right: number size: Size top: number width: number x: number y: number temp: Rectangle