Hide menu
Loading...
Searching...
No Matches
PointSet

Defines a polygonal shape consisting of individual points.

Extends

Constructors

Constructor

new PointSet(): PointSet

Returns

PointSet

Overrides

MeshShape.constructor

Constructor

new PointSet(points, colors?, colorIndices?): PointSet

Number of points attributes (colors) should be the same as points. Otherwise, the appropriate attributes indices array should be specified. If specified, attribute indices array should have the same length as points array.

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

Parameters

points

Float32Array

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

colors?

Float32Array<ArrayBufferLike>

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

colorIndices?

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Color indices array.

Returns

PointSet

Overrides

MeshShape.constructor

Constructor

new PointSet(points, colors?, colorIndices?): PointSet

Number of points attributes (colors) should be the same as points. Otherwise, the appropriate attributes indices array should be specified. If specified, attribute indices array should have the same length as points array.

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

Parameters

points

BaseXYZ[]

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

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

PointSet

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


numberOfPoints

Get Signature

get numberOfPoints(): number

Number of unique points.

Returns

number


vertices

Get Signature

get vertices(): Float32Array

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

Returns

Float32Array

Methods

addPoint()

addPoint(point, color?, colorIndex?): boolean

Adds a point and its attributes to this point set.

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

Parameters

point

BaseXYZ

Point.

color?

BaseRGBA | BaseRGB

Color.

colorIndex?

number

Color index. Should be 0 or one of the existing colors in the point set if color is not specified.

Returns

boolean


addPoints()

Call Signature

addPoints(pointSet): boolean

Adds points and attributes from another point set to this point set.

Returns true if the points were added successfully. This point set and pointSet must define the same kinds of attributes. Otherwise, points are not added.

Parameters

pointSet

PointSet

Point set to add.

Returns

boolean

Call Signature

addPoints(points, colors?, colorIndices?): boolean

Adds points and attributes to this point set.

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

Parameters

points

Float32Array

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

colors?

Float32Array<ArrayBufferLike>

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

colorIndices?

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Color indices array.

Returns

boolean

Call Signature

addPoints(points, colors?, colorIndices?): boolean

Adds points and attributes to this point set.

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

Parameters

points

BaseXYZ[]

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

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

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 point set has explicitly defined colors.

Returns

boolean


point()

point(index): Point

Returns a point.

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

Parameters

index

number

Point index.

Returns

Point


pointColor()

pointColor(pointIndex): Color

Returns a color at point.

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

Parameters

pointIndex

number

Point index.

Returns

Color


pointColorIndex()

pointColorIndex(pointIndex): number

Returns a color index for point.

pointIndex must be in the range [0, numberOfPoints() - 1]. If the color index was not found, -1 is returned.

Parameters

pointIndex

number

Point index.

Returns

number