[vtk-developers] KdTree FindPointsWithinRadius
David Doria
daviddoria+vtk at gmail.com
Thu Aug 26 08:14:21 EDT 2010
>
> vtkKdTreePointLocator is a leaf class that implements the
> vtkAbstractPointLocator interface. It would be best if new interface
> methods were be added at the abstract layer and then implemented in each
> leaf class.
>
>
Good point. Even better than that, the abstract class can provide the
implementation because all it does is setup the parameters to call a pure
virtual function. This means that the logic of changing parameters is done
at the abstract level, then the appropriate "inner function" is called
depending on the subclass.
I have added this type of convenience function
for FindClosestPoint, FindClosestNPoints, and FindPointsWithinRadius.
The code is here:
repo: git at github.com:daviddoria/daviddoria-vtk.git
branch: VTK-KdTree
I added tests for all of the subclasses to exercise the new (and old)
functions:
Filter/Testing/Cxx/TestKdTreePointLocator.cxx
Filter/Testing/Cxx/TestOctreePointLocator.cxx
Filter/Testing/Cxx/TestIncrementalOctreePointLocator.cxx
Filter/Testing/Cxx/TestPointLocator.cxx
A potential problem with your proposed implementation is that it assumes the
> vtkDataSet is a vtkPointSet, which may not be true.
>
> It looks like vtkDataSet also implements a GetPoint(vtkIdType, double*)
function, so I changed it to cast to a vtkDataSet instead of a vtkPointSet.
> I definitely agree that the proposed api is convenient, but it doesn't add
> new power to the class.
>
>
Yes, they are indeed convenience functions! I'm all for making things more
convenient :)
Please let me know what you think.
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100826/79d70ff7/attachment.html>
More information about the vtk-developers
mailing list