interface Geometry · Shapes

Shape

interface Shape extends Sequence<Vector>

A shape stored as its points: the base of polygons, polylines, segments, circles and the other shape types.

A shape is a Sequence of point objects. Computations in Polygons, Polylines, Segments, Circles and the other namespaces read these points; the shape types (Polygon, Segment, …) only tell TypeScript which computations accept the shape.

The points a factory gets are stored, not copied: a point passed to shapes.polygon(…) or visuals.polygon(…) is a vertex of the shape, and the shape moves with it. [x, y] becomes a new point of the shape. A reactive point must belong to the same group as the shape, or the creation throws.

After creation, setAt and set copy coordinates into the existing points; the shape keeps its point objects. set with more points adds new ones at the end, with fewer it removes the last ones.

Writes into a vertex point are drawn only if the point is reactive: for a visual that follows its vertices, create them with values.point(…) of the same group. Actions in Reactive.do with the shape among their senders run after setAt and set; to run them when a vertex point moves, call Reactive.linkVertices on the shape.

Inherited

From ReadOnlyCollection count

From Sequence at, elements, set, setAt

From Iterable [iterator]