Skip to main content

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:

NameTypeDefaultDescription
pointTypePointTypePointXYZThe point cloud type.
sortedbooleantrueSet to true if the application that the tree will be used for requires sorted nearest neighbor indices (default).

Methods

setSortedResults()

setSortedResults(sorted);

Parameters:

NameTypeDefaultDescription
sortedbooleanSet 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:

NameTypeDefaultDescription
epsnumberPrecision (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);
caution

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:

NameTypeDefaultDescription
pointPointTypeA given valid (i.e., finite) query point
knumberThe number of neighbors to search for

Returns:

NameType
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.

caution

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:

NameTypeDefaultDescription
pointPointTypeA given valid (i.e., finite) query point
radiusnumberThe radius of the sphere bounding all of p_q's neighbors

Returns:

NameType
result{ indices: Vector<number>; distances: Vector<number> }

setInputCloud

See PassThrough.setInputCloud

getInputCloud

See PassThrough.getInputCloud