Skip to content

editor / isValidRegularPolygon

Function: isValidRegularPolygon() ​

isValidRegularPolygon(polygon): boolean

Defined in: model/is-valid-regular-polygon.ts:23

Whether a regular polygon can enter the model: an integer number of corners from 3 to 12 (Q19), width and height integers ≥ 0, one corner radius per corner, integer ≥ 0 (ADR-0029), an anchor of min, mid or max on each axis (F07), a stretched boolean (ADR-0037), an angle from 0 to 359 and a finite position (ADR-0035).

A size of 0 gives a degenerate polygon, allowed (Q15); a negative or fractional value is rejected (ADR-0003). A radius larger than the polygon is valid: it is clamped (ADR-0007).

Parameters ​

polygon ​

RegularPolygon

number of corners, width, height, radii and anchor to check

Returns ​

boolean

true when every value is allowed

Kind ​

domain

See ​

docs/domain/shapes.md#regular-polygon