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

Defines a polygonal shape consisting of individual points.

Extends

Constructors

new PointSet()

new PointSet(): PointSet

Returns

PointSet

Overrides

PolyShape.constructor

new PointSet()

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.

WARNING: Inconsistency in data will result to creation of empty point set.

Parameters

points

Float32Array<ArrayBufferLike>

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,...]) format.

colorIndices?

Color indices array.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Returns

PointSet

Overrides

PolyShape.constructor

new PointSet()

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.

WARNING: Inconsistency in data will result to creation of empty point set.

Parameters

points

BaseXYZ[]

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

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

PointSet

Overrides

PolyShape.constructor

Accessors

colors

Get Signature

get colors(): Float32Array<ArrayBufferLike>

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

Returns

Float32Array<ArrayBufferLike>


id

Get Signature

get id(): bigint

Returns object id.

Returns

bigint

Inherited from

PolyShape.id


name

Get Signature

get name(): null | string

Returns name of the Shape. null if the element has no name (by default).

Returns

null | string

Set Signature

set name(name): void

Sets name of the Shape.

Parameters

name

Name of the Shape.

null | string

Returns

void

Inherited from

PolyShape.name


numberOfColors

Get Signature

get numberOfColors(): number

Returns number of unique colors.

Returns

number


numberOfPoints

Get Signature

get numberOfPoints(): number

Returns number of unique points.

Returns

number


vertices

Get Signature

get vertices(): Float32Array<ArrayBufferLike>

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

Returns

Float32Array<ArrayBufferLike>

Methods

addPoint()

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

Adds point and it's attributes to this points set. Returns true if point successfully added. this points set should have the same specified attributes as specified for new added point. Otherwise, point won't be added.

Parameters

point

BaseXYZ

Point.

color?

BaseRGB

Color.

colorIndex?

number

Color index. Should be 0 or one of existed colors in points set, if color is not specified.

Returns

boolean


addPoints()

Call Signature

addPoints(pointSet): boolean

Adds points and attributes from another points set to this points set. Returns true if points successfully added. this points set and added pointSet should have the same specified attributes. Otherwise, points won't be added.

Parameters

pointSet

PointSet

Added point set.

Returns

boolean

Call Signature

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

Adds points and attributes to this points set. Returns true if points successfully added. this points set should have the same specified attributes as specified for new added points. Otherwise, points won't be added.

Parameters

points

Float32Array<ArrayBufferLike>

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,...]) format.

colorIndices?

Color indices array.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Returns

boolean

Call Signature

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

Adds points and attributes to this points set. Returns true if points successfully added. this points set should have the same specified attributes as specified for new added points. Otherwise, points won't be added.

Parameters

points

BaseXYZ[]

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

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean


color()

color(index): Color

Returns 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 true if the triangle set has explicitly defined colors.

Returns

boolean


point()

point(index): Point

Returns 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 point index was not found -1 will be returned.

Parameters

pointIndex

number

Point index.

Returns

number