FreeMat

- Main Page
- Related Pages

vtkPointLocator

Section: Visualization Toolkit Filtering Classes

# Usage

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.

To create an instance of class vtkPointLocator, simply invoke its constructor as follows

      obj = vtkPointLocator

# Methods

The class vtkPointLocator has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkPointLocator class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkPointLocator = obj.NewInstance ()`
- `vtkPointLocator = obj.SafeDownCast (vtkObject o)`
- `obj.SetDivisions (int , int , int )` - Set the number of divisions in x-y-z directions.
- `obj.SetDivisions (int a[3])` - Set the number of divisions in x-y-z directions.
- `int = obj. GetDivisions ()` - Set the number of divisions in x-y-z directions.
- `obj.SetNumberOfPointsPerBucket (int )` - Specify the average number of points in each bucket.
- `int = obj.GetNumberOfPointsPerBucketMinValue ()` - Specify the average number of points in each bucket.
- `int = obj.GetNumberOfPointsPerBucketMaxValue ()` - Specify the average number of points in each bucket.
- `int = obj.GetNumberOfPointsPerBucket ()` - Specify the average number of points in each bucket.
- `vtkIdType = obj.FindClosestPoint (double x[3])` - Given a position x, return the id of the point closest to it. Alternative method requires separate x-y-z values. These methods are thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `int = obj.InitPointInsertion (vtkPoints newPts, double bounds[6])` - Initialize the point insertion process. The newPts is an object representing point coordinates into which incremental insertion methods place their data. Bounds are the box that the points lie in. Not thread safe.
- `int = obj.InitPointInsertion (vtkPoints newPts, double bounds[6], vtkIdType estSize)` - Initialize the point insertion process. The newPts is an object representing point coordinates into which incremental insertion methods place their data. Bounds are the box that the points lie in. Not thread safe.
- `obj.InsertPoint (vtkIdType ptId, double x[3])` - Incrementally insert a point into search structure with a particular index value. You should use the method IsInsertedPoint() to see whether this point has already been inserted (that is, if you desire to prevent duplicate points). Before using this method you must make sure that newPts have been supplied, the bounds has been set properly, and that divs are properly set. (See InitPointInsertion().) Not thread safe.
- `vtkIdType = obj.InsertNextPoint (double x[3])` - Incrementally insert a point into search structure. The method returns the insertion location (i.e., point id). You should use the method IsInsertedPoint() to see whether this point has already been inserted (that is, if you desire to prevent duplicate points). Before using this method you must make sure that newPts have been supplied, the bounds has been set properly, and that divs are properly set. (See InitPointInsertion().) Not thread safe.
- `vtkIdType = obj.IsInsertedPoint (double x, double y, double z)` - Determine whether point given by x[3] has been inserted into points list. Return id of previously inserted point if this is true, otherwise return -1. This method is thread safe.
- `vtkIdType = obj.IsInsertedPoint (double x[3])` - Determine whether point given by x[3] has been inserted into points list. Return id of previously inserted point if this is true, otherwise return -1. This method is thread safe.
- `vtkIdType = obj.FindClosestInsertedPoint (double x[3])` - Given a position x, return the id of the point closest to it. This method is used when performing incremental point insertion. Note that -1 indicates that no point was found. This method is thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `obj.FindClosestNPoints (int N, double x[3], vtkIdList result)` - Find the closest N points to a position. This returns the closest N points to a position. A faster method could be created that returned N close points to a position, but necessarily the exact N closest. The returned points are sorted from closest to farthest. These methods are thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `obj.FindDistributedPoints (int N, double x[3], vtkIdList result, int M)` - Find the closest points to a position such that each octant of space around the position contains at least N points. Loosely limit the search to a maximum number of points evaluated, M. These methods are thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `obj.FindDistributedPoints (int N, double x, double y, double z, vtkIdList result, int M)` - Find the closest points to a position such that each octant of space around the position contains at least N points. Loosely limit the search to a maximum number of points evaluated, M. These methods are thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `obj.FindPointsWithinRadius (double R, double x[3], vtkIdList result)` - Find all points within a specified radius R of position x. The result is not sorted in any specific manner. These methods are thread safe if BuildLocator() is directly or indirectly called from a single thread first.
- `vtkIdList = obj.GetPointsInBucket (double x[3], int ijk[3])` - Given a position x, return the list of points in the bucket that contains the point. It is possible that NULL is returned. The user provides an ijk array that is the indices into the locator. This method is thread safe.
- `vtkPoints = obj.GetPoints ()` - Provide an accessor to the points.
- `obj.Initialize ()` - See vtkLocator interface documentation. These methods are not thread safe.
- `obj.FreeSearchStructure ()` - See vtkLocator interface documentation. These methods are not thread safe.
- `obj.BuildLocator ()` - See vtkLocator interface documentation. These methods are not thread safe.
- `obj.GenerateRepresentation (int level, vtkPolyData pd)` - See vtkLocator interface documentation. These methods are not thread safe.