API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classRectangle

@codexo/exojs / math / stable

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.

12
props
15
methods
0
events
Import
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.

Constructors 1
new(x: number, y: number, width: number, height: number): Rectangle
Methods 15
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
Properties 12
collisionType: CollisionType
bottom: number
height: number
left: number
position: Vector
right: number
size: Size
top: number
width: number
x: number
y: number
temp: Rectangle
Source