API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classPolygon
Mutable convex polygon defined by a world-space offset `(x, y)` and an array of local-space vertex Vectors. Implements ShapeLike with full SAT collision response. Edge vectors are recomputed whenever `setPoints` is called; normals are cached lazily and invalidated on any positional or point mutation. `Polygon.temp` is a shared scratch instance.
import { Polygon } from '@codexo/exojs' Mutable convex polygon defined by a world-space offset `(x, y)` and an array of local-space vertex Vectors. Implements ShapeLike with full SAT collision response.
Edge vectors are recomputed whenever `setPoints` is called; normals are cached lazily and invalidated on any positional or point mutation.
`Polygon.temp` is a shared scratch instance.
new(points: Vector[], x: number, y: number): Polygon clone(): this collidesWith(target: Collidable): CollisionResponse | null contains(x: number, y: number): boolean copy(polygon: Polygon): this destroy(): void equals(__namedParameters: Partial<Polygon>): boolean getBounds(): Rectangle getNormals(): Vector[] intersectsWith(target: Collidable): boolean project(axis: Vector, result: Interval): Interval set(x: number, y: number, points: Vector[]): this setPoints(newPoints: Vector[]): this setPosition(x: number, y: number): this collisionType: CollisionType edges: Vector[] points: Vector[] position: Vector x: number y: number temp: Polygon