Skip to content

@technobuddha > library > Geometry > Polygon

Function: toClosed()

ts
function toClosed(polygon: Polygon): Polygon;

Defined in: to-closed.ts:12

Ensures that a given polygon is closed by checking if the first and last points are the same. If the polygon is not closed, it appends the first point to the end of the array.

Parameters

ParameterTypeDescription
polygonPolygonThe array of points representing the polygon.

Returns

Polygon

A closed polygon, where the first and last points are identical.