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.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IPointsInitialValues | No | (default: {}) |
findPoint
Convenient method to search a point in the array. This is a naïve search. Consider using a "locator" instead.
| Argument | Type | Required | Description |
|---|---|---|---|
pointToSearch | Array<Number> or TypedArray | Yes | |
precision | Number | Yes | (1e-6 by default) |
Returns
| Type | Description |
|---|---|
| Number | the 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.
| Argument | Type | Required | Description |
|---|---|---|---|
idx | Number | Yes | The index of point. |
tupleToFill | Array[Number] or TypedArray | No | (default []) |
Returns
| Type | Description |
|---|---|
| Array[Number] or TypedArray |
insertNextPoint
Insert the (x,y,z) coordinates of a point at the next available slot.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x coordinate. |
y | Number | Yes | The y coordinate. |
z | Number | Yes | The z coordinate. |
Returns
| Type | Description |
|---|---|
| Number | Index of the inserted point. |
insertPoint
Insert the [x,y,z] coordinates of a point at the given index.
| Argument | Type | Required | Description |
|---|---|---|---|
ptId | Number | Yes | The index of point. |
point | Array[Number] | Yes | The [x, y, z] coordinates of the point. |
Returns
| Type | Description |
|---|---|
| Number | The index of the inserted point. |
newInstance
Method used to create a new instance of vtkPoints
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IPointsInitialValues | No | for pre-setting some of its content |
setNumberOfPoints
Set the number of points for this object to hold.
points.getData()[0] = x;
points.getData()[1] = y;
points.getData()[2] = z;| Argument | Type | Required | Description |
|---|---|---|---|
nbPoints | Number | Yes | |
dimension | Number | No |
setPoint
Set the (x,y,z) coordinates of a point based on its index.
| Argument | Type | Required | Description |
|---|---|---|---|
idx | Number | Yes | The index of point. |
x | Number | Yes | The x coordinate. |
y | Number | Yes | The y coordinate. |
z | Number | Yes | The z coordinate. |