[vtkusers] Find closest point on Mesh B from a point on Mesh A.

David Doria daviddoria at gmail.com
Sat Nov 27 18:31:02 EST 2010


On Sat, Nov 27, 2010 at 5:36 PM, Jim Peterson <jimcp at cox.net> wrote:
> A point is a point, a cell is a cell, vtkPointLocator locates points,
> vtkCellLocator  locates cells. Your original problem was to locate points.
> When using the doc if you start from vtkCellLocator for instance
> (http://www.vtk.org/doc/release/5.6/html/a00273.html) you can see that
> descends from the vtkLocator parent class, click that and you will see there
> is a branch for cells and a branch for points. You also have the source code
> with the distribution I assume, that is frequently the final reference.
>
> FWIW, I am not precisely sure what subid is in the cell locator, I have
> assumed it is the id of the point in the cell that fit the closest test.
>
> Hope that helps,
> Jim
>
> Hope that helps,
> Jim

Hi Ambar,

As Jim said, you should use vtkPointLocator. The FindClosestPoint
function has simple paramters, simply double x[3] (the query point)
and it returns the id of the point that is the closest.
http://www.vtk.org/doc/nightly/html/classvtkPointLocator.html

Jim, according to my notes here:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/CellLocator


  int subId; //this is rarely used (in triangle strips only, I believe)

If someone can elaborate/make this more accurate that would be great.

David



More information about the vtkusers mailing list