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.

6
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.

Constructors1
new(vertices: readonly Readonly<PointLikeStructural type for any object with a 2D `x`/`y` position.>[]): PolygonShape
Properties6
boundingRadius: number
Radius of the smallest circle about the local origin enclosing the shape.
count: number
normals: readonly number[]
Outward unit edge normals (edge i spans vertex i → i+1), flattened.
type: "polygon"
vertices: readonly number[]
Local-space vertices, CCW, flattened.
Source