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 Collidable 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 Collidable 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: VectorConcrete mutable 2D vector with full AbstractVector arithmetic and Collidable collision support (treated as a point collider). `Vector.temp` provides a shared…[], x: number, y: number): Polygonclone(): thiscollidesWith(target: CollidableContract for objects that participate in collision detection. Implemented by all concrete shape classes as well as `SceneNode`.): CollisionResponseResult of a successful Collidable.collidesWith call. Contains the two participating shapes, the penetration depth, containment flags, and the minimum-translati… | nullcontains(x: number, y: number): booleancopy(polygon: Polygon): thisdestroy(): voidequals(__namedParameters: Partial<Polygon>): booleangetBounds(out: RectangleMutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements Collidable with full SAT collision response f…): RectangleMutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements Collidable with full SAT collision response f…project(axis: VectorConcrete mutable 2D vector with full AbstractVector arithmetic and Collidable collision support (treated as a point collider). `Vector.temp` provides a shared…, result: IntervalA closed scalar interval `[min, max]` used by the SAT collision solver to represent the projection of a shape onto a separating axis. `Interval.temp` provides…): IntervalA closed scalar interval `[min, max]` used by the SAT collision solver to represent the projection of a shape onto a separating axis. `Interval.temp` provides…set(x: number, y: number, points: VectorConcrete mutable 2D vector with full AbstractVector arithmetic and Collidable collision support (treated as a point collider). `Vector.temp` provides a shared…[]): thissetPosition(x: number, y: number): thisx: numbery: number