PointLocator
Introduction
vtkPointLocator is a spatial search object to quickly locate points in 3D.
vtkPointLocator works by dividing a specified region of space into a regular array of "rectangular" buckets, and then keeping a list of points that lie in each bucket. Typical operation involves giving a position in 3D and finding the closest point.
vtkPointLocator has two distinct methods of interaction. In the first method, you supply it with a dataset, and it operates on the points in the dataset. In the second method, you supply it with an array of points, and the object operates on the array.
Methods
extend
Method use to decorate a given object (publicAPI+model) with vtkPointLocator 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 | object | No | (default: {}) |
findClosestInsertedPoint
Find the closest inserted point to the given coordinates.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The query point |
Returns
| Type | Description |
|---|---|
| Number | The id of the closest inserted point or -1 if not found |
findClosestPoint
Find the closest point to a given point.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point coordinates |
Returns
| Type | Description |
|---|---|
| The id of the closest point or -1 if not found |
findClosestPointWithinRadius
Find the closest point within a specified radius.
| Argument | Type | Required | Description |
|---|---|---|---|
radius | Number | Yes | The search radius |
x | Vector3 | Yes | The point coordinates |
inputDataLength | Number | Yes | The length of the input data |
Returns
| Type | Description |
|---|---|
| IFindClosestPointResult | The closest point result |
freeSearchStructure
Free the search structure and reset the locator.
generateRepresentation
Generate a polydata representation of the point locator.
| Argument | Type | Required | Description |
|---|---|---|---|
polydata | vtkPolyData | Yes | The polydata to generate representation for |
Returns
| Type | Description |
|---|---|
getNumberOfPointsPerBucket
Get the number of points per bucket.
Returns
| Type | Description |
|---|---|
| Number | The number of points per bucket. |
getPoints
Get the points stored in the point locator.
Returns
| Type | Description |
|---|---|
| Nullable<vtkPoints> | The vtkPoints object containing the points. |
getPointsInBucket
Get the points in the specified bucket.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point coordinates |
Returns
| Type | Description |
|---|---|
| Array[Number] | The points in the bucket |
initPointInsertion
Initialize point insertion.
| Argument | Type | Required | Description |
|---|---|---|---|
points | vtkPoints | Yes | The points to insert |
bounds | Bounds | Yes | The bounds for the points |
estNumPts | Number | Yes | Estimated number of points for insertion |
insertNextPoint
Insert a point into the point locator. If the point is already present, it returns the existing ID. Otherwise, it inserts the point and returns a new ID.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point to insert. |
Returns
| Type | Description |
|---|---|
| IInsertPointResult | An object indicating if the point was inserted and its ID. |
insertPoint
Insert a point into the point locator. If the point is already present, it returns the existing ID. Otherwise, it inserts the point and returns a new ID.
| Argument | Type | Required | Description |
|---|---|---|---|
ptId | Number | Yes | The index of the point to insert. |
x | Vector3 | Yes | The point to insert. |
Returns
| Type | Description |
|---|---|
| IInsertPointResult | An object indicating if the point was inserted and its ID. |
insertUniquePoint
Insert a point into the point locator. If the point is already present, it returns the existing ID. Otherwise, it inserts the point and returns a new ID.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point to insert. |
Returns
| Type | Description |
|---|---|
| IInsertPointResult | An object indicating if the point was inserted and its ID. |
isInsertedPoint
Check if a point is already inserted in the point locator.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point to check. |
Returns
| Type | Description |
|---|---|
| Number | The ID of the point if it exists, otherwise -1. |
newInstance
Method use to create a new instance of vtkPointLocator
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IPointLocatorInitialValues | No | for pre-setting some of its content |
setDivisions
Set the divisions of the point locator.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The number of divisions in the x dimension. |
y | Number | Yes | The number of divisions in the y dimension. |
z | Number | Yes | The number of divisions in the z dimension. |
Returns
| Type | Description |
|---|---|
| Boolean | True if the divisions were set successfully, false otherwise. |
setDivisions
Set the divisions of the point locator.
| Argument | Type | Required | Description |
|---|---|---|---|
divisions | Vector3 | Yes | The number of divisions in each dimension. |
Returns
| Type | Description |
|---|---|
| Boolean | True if the divisions were set successfully, false otherwise. |
setNumberOfPointsPerBucket
Set the number of points per bucket.
| Argument | Type | Required | Description |
|---|---|---|---|
numberOfPointsPerBucket | Number | Yes | The number of points per bucket. |
setPoints
Set the points for this point locator. This is typically used to initialize the locator with a set of points.
| Argument | Type | Required | Description |
|---|---|---|---|
points | vtkPoints | Yes | The vtkPoints object containing the points. |