Skip to content

Function: ConvexDecompose() ​

ts
function ConvexDecompose(input): number[][];

Counter-clockwise polygon (flat x, y) → convex pieces of ≤ PHYSICS2D_MAX_POLYGON_VERTICES points: ear-clipping into triangles, then Hertel–Mehlhorn merging across shared edges while the union stays convex and small enough. A self-crossing outline gives whatever ears it has.

Parameters ​

ParameterType
inputreadonly number[]

Returns ​

number[][]

© 2026 PlayAdGentic