Defines a polygonal shape consisting of individual points.
new PointSet():
PointSet
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.
If the provided data is inconsistent, an empty point set is created.
Float32Array
Array of points in {x,y,z} format [x,y,z,x,y,z,...].
Float32Array<ArrayBufferLike>
Array of colors in RGB ([r,g,b,r,g,b,...]) or RGBA ([r,g,b,a,r,g,b,a,...]) formats.
Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>
Color indices array.
PointSet
MeshShape.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.
BaseXYZ[]
Array of points in [{x,y,z},{x,y,z},...] format.
Array of colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.
number[]
Color indices array.
PointSet
MeshShape.constructor
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.
Float32Array
get id():
bigint
Returns the unique identifier of the object.
bigint
get name():
string|null
Name of the mesh shape.
The default value is null.
string | null
set name(
name):void
Sets the name of the mesh shape.
string | null
Mesh shape name.
void
get numberOfColors():
number
Number of unique colors.
number
get numberOfPoints():
number
Number of unique points.
number
get vertices():
Float32Array
Unique points in {x,y,z} format [x,y,z,x,y,z,...].
Float32Array
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.
Point.
Color.
number
Color index. Should be 0 or one of the existing colors in the point set if color is not specified.
boolean
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.
PointSet
Point set to add.
boolean
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.
Float32Array
Array of points in {x,y,z} format [x,y,z,x,y,z,...].
Float32Array<ArrayBufferLike>
Array of colors in RGB ([r,g,b,r,g,b,...]) or RGBA ([r,g,b,a,r,g,b,a,...]) formats.
Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>
Color indices array.
boolean
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.
BaseXYZ[]
Array of points in [{x,y,z},{x,y,z},...] format.
Array of colors in RGB and / or RGBA [{r,g,b},{r,g,b,a},...] format.
number[]
Color indices array.
boolean
color(
index):Color
Returns a color.
index must be in the range [0, numberOfColors() - 1]. Otherwise the result is undefined.
number
Color index.
hasColors():
boolean
Returns whether the point set has explicitly defined colors.
boolean
point(
index):Point
Returns a point.
index must be in the range [0, numberOfPoints() - 1]. Otherwise the result is undefined.
number
Point index.
pointColor(
pointIndex):Color
Returns a color at point.
pointIndex must be in the range [0, numberOfPoints() - 1]. Otherwise the result is undefined.
number
Point index.
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.
number
Point index.
number