Defines a polygonal shape consisting of individual points.
new 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.
WARNING: Inconsistency in data will result to creation of empty point set.
Float32Array
<ArrayBufferLike
>
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,...]) format.
Color indices array.
Uint16Array
<ArrayBufferLike
> | Uint32Array
<ArrayBufferLike
>
PolyShape.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.
WARNING: Inconsistency in data will result to creation of empty point set.
BaseXYZ
[]
Array of points in [{x,y,z},{x,y,z},...] format.
BaseRGB
[]
Array of colors in [{r,g,b},{r,g,b},...] format.
number
[]
Color indices array.
PolyShape.constructor
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.
Float32Array
<ArrayBufferLike
>
get id():
bigint
Returns object id.
bigint
get name():
null
|string
Returns name of the Shape. null
if the element has no name (by default).
null
| string
set name(
name
):void
Sets name of the Shape.
Name of the Shape.
null
| string
void
get numberOfColors():
number
Returns number of unique colors.
number
get numberOfPoints():
number
Returns number of unique points.
number
get vertices():
Float32Array
<ArrayBufferLike
>
Returns unique vertices in {x,y,z} format [x,y,z,x,y,z,...]..
Float32Array
<ArrayBufferLike
>
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.
Point.
Color.
number
Color index. Should be 0
or one of existed colors in points set, if color
is not specified.
boolean
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.
Added point set.
boolean
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.
Float32Array
<ArrayBufferLike
>
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,...]) format.
Color indices array.
Uint16Array
<ArrayBufferLike
> | Uint32Array
<ArrayBufferLike
>
boolean
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.
BaseXYZ
[]
Array of points in [{x,y,z},{x,y,z},...] format.
BaseRGB
[]
Array of colors in [{r,g,b},{r,g,b},...] format.
number
[]
Color indices array.
boolean
color(
index
):Color
Returns color. index
must be in the range [0, numberOfColors()-1]
. Otherwise the result is undefined.
number
Color index.
hasColors():
boolean
Returns true
if the triangle set has explicitly defined colors.
boolean
point(
index
):Point
Returns 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 point index was not found -1
will be returned.
number
Point index.
number