region2.toJSON
The region as plain JSON: each part’s outline and holes as flat rings.
Usage
region.toJSON(): { parts: { outer: number[]; holes: number[][] }[] }Returns
{ parts } with every ring as a plain [x0, y0, …] array, wound as stored; { parts: [] } for Region2.empty.
Example
JSON.stringify(Region2.of(Polygon2.rectangle(2, 2).value)) // → '{"parts":[{"outer":[-1,-1,1,-1,1,1,-1,1],"holes":[]}]}'