Hide menu
Loading...
Searching...
No Matches
Polyline2d

Defines a connected sequence of line segments created as a single object.

A polyline is a line consisting of one or more line segments joined end to end. Polylines, unlike polygons, are not necessarily closed.

Extends

Constructors

Constructor

new Polyline2d(points?): Polyline2d

Creates a polyline from points.

Copies of the provided points are stored in the polyline.

Parameters

points?

Point2d[] = []

Polyline points.

Returns

Polyline2d

Overrides

Geometry.constructor

Properties

points

readonly points: Point2d[]

Points composing the polyline.

Accessors

id

Get Signature

get id(): bigint

Returns the unique identifier of the object.

Returns

bigint

Inherited from

Geometry.id


numberOfPoints

Get Signature

get numberOfPoints(): number

Returns the number of points in the polyline.

Deprecated

Use Polyline2d.points and points.length instead.

Returns

number

Methods

addPoint()

addPoint(point): void

Adds a copy of the point to the end of the polyline.

Parameters

point

Point2d

Point to copy and add.

Returns

void

Deprecated

Use Polyline2d.points and points.push(point.clone()) instead.


addPoints()

addPoints(points): void

Adds copies of the points to the end of the polyline.

Parameters

points

Point2d[]

Points to copy and add.

Returns

void

Deprecated

Use Polyline2d.points and points.push(...addedPoints.map((point) => point.clone())) instead.


point()

point(index): Point2d

Returns the point at position index in the polyline.

Throws a RangeError if index is not in the range [0, numberOfPoints - 1].

Parameters

index

number

Point index.

Returns

Point2d

Deprecated

Use Polyline2d.points and points[index] instead.