API reference

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

C

classPolygonShape

@codexo/exojs-physics / physics / stable

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.

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

Constructors 1
new(vertices: readonly VectorLike[]): PolygonShape
Properties 9
area: number
boundingRadius: number
centroidX: number
centroidY: number
count: number
normals: readonly number[]
type: "polygon"
unitInertia: number
vertices: readonly number[]
Source