Skip to content

Points ​

Introduction ​

vtkPoints represents 3D points. The data model for vtkPoints is an array of vx-vy-vz triplets accessible by (point or cell) id.

Methods ​

computeBounds ​

Trigger the computation of bounds

extend ​

Method used to decorate a given object (publicAPI+model) with vtkPoints characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIPointsInitialValuesNo(default: {})

findPoint ​

Convenient method to search a point in the array. This is a naïve search. Consider using a "locator" instead.

ArgumentTypeRequiredDescription
pointToSearchArray<Number> or TypedArrayYes
precisionNumberYes(1e-6 by default)

Returns ​

TypeDescription
Numberthe index of the point if found, -1 otherwise.

getBounds ​

Get a copy of the bounds of the array. Bounds are [xmin, xmax, ymin, ymax,zmin, zmax]. Will recompute the bounds if necessary.

getBoundsByReference ​

Get a reference to the model bounds of the array. Bounds are [xmin, xmax, ymin, ymax,zmin, zmax]. Will recompute the bounds if necessary.

getNumberOfPoints ​

Get the number of points for this object can hold.

getPoint ​

Get the coordinate of a point.

ArgumentTypeRequiredDescription
idxNumberYesThe index of point.
tupleToFillArray[Number] or TypedArrayNo(default [])

Returns ​

TypeDescription
Array[Number] or TypedArray

insertNextPoint ​

Insert the (x,y,z) coordinates of a point at the next available slot.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

Returns ​

TypeDescription
NumberIndex of the inserted point.

insertPoint ​

Insert the [x,y,z] coordinates of a point at the given index.

ArgumentTypeRequiredDescription
ptIdNumberYesThe index of point.
pointArray[Number]YesThe [x, y, z] coordinates of the point.

Returns ​

TypeDescription
NumberThe index of the inserted point.

newInstance ​

Method used to create a new instance of vtkPoints

ArgumentTypeRequiredDescription
initialValuesIPointsInitialValuesNofor pre-setting some of its content

setNumberOfPoints ​

Set the number of points for this object to hold.

js
points.getData()[0] = x;
points.getData()[1] = y;
points.getData()[2] = z;
ArgumentTypeRequiredDescription
nbPointsNumberYes
dimensionNumberNo

setPoint ​

Set the (x,y,z) coordinates of a point based on its index.

ArgumentTypeRequiredDescription
idxNumberYesThe index of point.
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.