跳到主要内容

KdTreeFLANN

https://pointclouds.org/documentation/classpcl_1_1_kd_tree_f_l_a_n_n.html

KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.

The class is making use of the FLANN (Fast Library for Approximate Nearest Neighbor) project.

Constructor

new PCL.KdTreeFLANN(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'

const pcl = await PCL.init();

const point = new PCL.PointXYZ(1, 2, 3);
const k = 5
const kdtree = new PCL.KdTreeFLANN(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:

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.

警告

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