Hide menu
Loading...
Searching...
No Matches
PolylineSet

Defines a polygonal shape consisting of polylines.

Extends

Constructors

Constructor

new PolylineSet(): PolylineSet

Creates an empty polyline set.

Returns

PolylineSet

Overrides

MeshShape.constructor

Constructor

new PolylineSet(points, polylinePointsCounts, colors?, colorIndices?): PolylineSet

Creates a polyline set from point coordinates and point counts per polyline.

If colorIndices is omitted, colors must define one color per point in the input polylines. If colorIndices is specified, it must contain one entry per point.

If the provided data is inconsistent, an empty polyline set is created.

Parameters

points

Float32Array

Array of points in {x,y,z} format [x,y,z,x,y,z,...].

polylinePointsCounts

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Number of points per polyline.

colors?

Float32Array<ArrayBufferLike>

Array of colors in RGB ([r,g,b,r,g,b,...]) or RGBA ([r,g,b,a,r,g,b,a,...]) format.

colorIndices?

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Color indices array.

Returns

PolylineSet

Overrides

MeshShape.constructor

Constructor

new PolylineSet(points, polylinePointsCounts, colors?, colorIndices?): PolylineSet

Creates a polyline set from points and point counts per polyline.

If colorIndices is omitted, colors must define one color per point in the input polylines. If colorIndices is specified, it must contain one entry per point.

If the provided data is inconsistent, an empty polyline set is created.

Parameters

points

BaseXYZ[]

Array of points in [{x,y,z},{x,y,z},...] format.

polylinePointsCounts

number[]

Number of points per polyline.

colors?

(BaseRGBA | BaseRGB)[]

Array of colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.

colorIndices?

number[]

Color indices array.

Returns

PolylineSet

Overrides

MeshShape.constructor

Constructor

new PolylineSet(polylines, colors?, colorIndices?): PolylineSet

Creates a polyline set from polylines.

If colorIndices is omitted, colors must define one color per point across all polylines. If colorIndices is specified, it must contain one entry per point.

If the provided data is inconsistent, an empty polyline set is created.

Parameters

polylines

Polyline[]

Array of polylines.

colors?

(BaseRGBA | BaseRGB)[]

Array of colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.

colorIndices?

number[]

Color indices array.

Returns

PolylineSet

Overrides

MeshShape.constructor

Accessors

colors

Get Signature

get colors(): Float32Array

Returns array with colors in RGBA ([r,g,b,a,r,g,b,a,...]) format for each vertex (i.e. taking into account colors indices), if specified. Otherwise, returns empty array.

Returns

Float32Array


id

Get Signature

get id(): bigint

Returns the unique identifier of the object.

Returns

bigint

Inherited from

MeshShape.id


name

Get Signature

get name(): string | null

Name of the mesh shape.

The default value is null.

Returns

string | null

Set Signature

set name(name): void

Sets the name of the mesh shape.

Parameters

name

string | null

Mesh shape name.

Returns

void

Inherited from

MeshShape.name


numberOfColors

Get Signature

get numberOfColors(): number

Number of unique colors.

Returns

number


numberOfPolylines

Get Signature

get numberOfPolylines(): number

Number of polylines in the polyline set.

Returns

number


vertices

Get Signature

get vertices(): Float32Array

Polyline vertices in {x,y,z} format [x,y,z,x,y,z,...].

Returns

Float32Array

Methods

addPolyline()

addPolyline(polyline, colors?, colorIndices?): boolean

Adds a polyline and its attributes to this polyline set.

Returns true if the polyline was added successfully. This polyline set must already define the same kinds of attributes as the polyline being added. Otherwise, the polyline is not added.

Parameters

polyline

Polyline

Polyline.

colors?

(BaseRGBA | BaseRGB)[]

Array of point colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean


addPolylines()

Call Signature

addPolylines(polylineSet): boolean

Adds polylines and attributes from another polyline set to this polyline set.

Returns true if the polylines were added successfully. This polyline set and polylineSet must define the same kinds of attributes. Otherwise, polylines are not added.

Parameters

polylineSet

PolylineSet

Polyline set to add.

Returns

boolean

Call Signature

addPolylines(points, polylinePointsCounts, colors?, colorIndices?): boolean

Adds polylines and attributes to this polyline set.

Returns true if the polylines were added successfully. This polyline set must already define the same kinds of attributes as the polylines being added. Otherwise, polylines are not added.

Parameters

points

Float32Array

Array of points in {x,y,z} format [x,y,z,x,y,z,...].

polylinePointsCounts

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Number of points per polyline.

colors?

Float32Array<ArrayBufferLike>

Array of point colors in RGB ([r,g,b,r,g,b,...]) or RGBA ([r,g,b,a,r,g,b,a,...]) format.

colorIndices?

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Color indices array.

Returns

boolean

Call Signature

addPolylines(points, polylinePointsCounts, colors?, colorIndices?): boolean

Adds polylines and attributes to this polyline set.

Returns true if the polylines were added successfully. This polyline set must already define the same kinds of attributes as the polylines being added. Otherwise, polylines are not added.

Parameters

points

BaseXYZ[]

Array of points in [{x,y,z},{x,y,z},...] format.

polylinePointsCounts

number[]

Number of points per polyline.

colors?

(BaseRGBA | BaseRGB)[]

Array of point colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean

Call Signature

addPolylines(polylines, colors?, colorIndices?): boolean

Adds polylines and attributes to this polyline set.

Returns true if the polylines were added successfully. This polyline set must already define the same kinds of attributes as the polylines being added. Otherwise, polylines are not added.

Parameters

polylines

Polyline[]

Array of polylines.

colors?

(BaseRGBA | BaseRGB)[]

Array of point colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean


color()

color(index): Color

Returns a color.

index must be in the range [0, numberOfColors() - 1]. Otherwise the result is undefined.

Parameters

index

number

Color index.

Returns

Color


hasColors()

hasColors(): boolean

Returns whether the polyline set has explicitly defined colors.

Returns

boolean


pointColor()

pointColor(polylineIndex, pointIndex): Color

Returns a color at point.

polylineIndex must be in the range [0, numberOfPolylines() - 1]. pointIndex must be a valid point index in the polyline. Otherwise the result is undefined.

Parameters

polylineIndex

number

Polyline index.

pointIndex

number

Point index in polyline.

Returns

Color


pointColorIndex()

pointColorIndex(polylineIndex, pointIndex): number

Returns a color index for point.

polylineIndex must be in the range [0, numberOfPolylines() - 1]. pointIndex must be a valid point index in the polyline. If no color index is found, -1 is returned.

Parameters

polylineIndex

number

Polyline index.

pointIndex

number

Point index in polyline.

Returns

number


polyline()

polyline(index): Polyline

Returns a polyline.

index must be in the range [0, numberOfPolylines() - 1]. Otherwise the result is undefined.

Parameters

index

number

Polyline index.

Returns

Polyline