KdTree
https://pointclouds.org/documentation/classpcl_1_1search_1_1_kd_tree.html
search.KdTree
is a wrapper class which inherits the pcl::KdTree class for performing search functions using KdTree structure.
Constructor
new PCL.SearchKdTree(pointType, sorted);
Parameters:
Name | Type | Default | Description |
---|---|---|---|
pointType | PointType | PointXYZ | The point cloud type. |
sorted | boolean | true | Set to true if the application that the tree will be used for requires sorted nearest neighbor indices (default). |
Methods
setSortedResults()
setSortedResults(sorted);
Parameters:
Name | Type | Default | Description |
---|---|---|---|
sorted | boolean | Set to true if the application that the tree will be used for requires sorted nearest neighbor indices. |
setEpsilon()
setEpsilon(eps);
Set the search epsilon precision (error bound) for nearest neighbors searches.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
eps | number | Precision (error bound) for nearest neighbors searches |
nearestKSearch()
nearestKSearch(point, k);
Search for k-nearest neighbors for the given query point.
For Exmaple:
import * as PCL from 'pcl.js'
await PCL.init();
const point = new PCL.PointXYZ(1, 2, 3);
const k = 5
const kdtree = new PCL.SearchKdTree(pointType, sorted);
kdtree.nearestKSearch(point, k);
This method does not do any bounds checking for the input index (i.e., index >= cloud.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
point | PointType | A given valid (i.e., finite) query point | |
k | number | The number of neighbors to search for |
Returns:
Name | Type |
---|---|
result | { indices: Vector<number>; distances: Vector<number> } |
radiusSearch()
radiusSearch(point, radius);
Search for all the nearest neighbors of the query point in a given radius.
This method does not do any bounds checking for the input index (i.e., index >= cloud.size () || index < 0), and assumes valid (i.e., finite) data.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
point | PointType | A given valid (i.e., finite) query point | |
radius | number | The radius of the sphere bounding all of p_q's neighbors |
Returns:
Name | Type |
---|---|
result | { indices: Vector<number>; distances: Vector<number> } |