API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classPolygonShape
A convex polygon defined by ≥3 local-space vertices. Input vertices may be given in either winding; they are canonicalised to counter-clockwise and the outward edge normals are precomputed. Construction throws on any non-convex, degenerate, or under-specified input — there is no silent repair. Vertices and normals are exposed as flat `[x0, y0, x1, y1, …]` arrays to keep the narrow phase allocation-free; both are frozen.
import { PolygonShape } from '@codexo/exojs-physics' A convex polygon defined by ≥3 local-space vertices. Input vertices may be given in either winding; they are canonicalised to counter-clockwise and the outward edge normals are precomputed. Construction throws on any non-convex, degenerate, or under-specified input — there is no silent repair.
Vertices and normals are exposed as flat `[x0, y0, x1, y1, …]` arrays to keep the narrow phase allocation-free; both are frozen.
new(vertices: readonly VectorLike[]): PolygonShape area: number boundingRadius: number centroidX: number centroidY: number count: number normals: readonly number[] type: "polygon" unitInertia: number vertices: readonly number[]