PointCloudLibrary/pcl — pull request #359 by taketwo (2014-01-15 16:48:18+00:00)
Title: Possible bug in `pcl::getApproximateIndices()`

There are two utility functions in '[kdtree/io.h](https://github.com/PointCloudLibrary/pcl/blob/master/kdtree/include/pcl/kdtree/io.h)' that were added by @rbrusu some two years ago:

```c++
template void
getApproximateIndices (const typename pcl::PointCloud::Ptr &cloud_in,
const typename pcl::PointCloud::Ptr &cloud_ref,
std::vector &indices);
```

and

```c++
template void
getApproximateIndices (const typename pcl::PointCloud::Ptr &cloud_in,
const typename pcl::PointCloud::Ptr &cloud_ref,
std::vector &indices);
```

I am not sure how the second one is supposed to work. Internally, it creates an instance of `pcl::KdTreeFLANN` with `Point2T` as a template parameter, but later calls `nearestKSearch()`, passing in the first cloud, which contains points of type `Point1T`. The signature of `pcl::KdTree::nearestKSearch()` is as follows:

```c++
virtual int
nearestKSearch (const pcl::PointCloud &cloud, int index, int k,
std::vector &k_indices, std::vector &k_sqr_distances) const
```

where `PointT` the template parameter of the tree (`Point2T` in our case). So obviously, it does not compile unless `Point1T == Point2T`. Do I miss something here?