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

Jim Peterson jimcp at cox.net
Sat Nov 27 17:36:27 EST 2010


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

Ambar C wrote:
> I didn't know of that class. How would the two methods be different?
>
> On Sat, Nov 27, 2010 at 2:01 PM, Jim Peterson <jimcp at cox.net> wrote:
>   
>> Ambar,
>> I guess I am confused too. Why not use vtkPointLocator.FindClosestPoint()
>> with point data?
>>
>> Jim
>>
>> Ambar C wrote:
>>     
>>> Hello,
>>>
>>> I have two meshes A and B. For each point on A, I need to find the
>>> point on B that is closest to it. I looked up
>>> vtkCellLocator::FindClosestPoint, and have a few questions about it.
>>>
>>> 1. In the function prototype
>>>
>>> virtual void vtkCellLocator::FindClosestPoint   (       double  x[3],
>>> double
>>>        closestPoint[3], vtkGenericCell *       cell, vtkIdType &
>>> cellId, int &
>>>        subId, double &         dist2   )
>>>
>>> - What is the subId field? I understand that it is populated if and
>>> when a closest point is found, but am not sure as to what information
>>> it ends up holding.
>>> - dist2 equals the distance of the closest point from the point x?
>>> - Which cell's ID does vtkCellId end up holding?
>>>
>>>
>>> In general, I'm confused about the usage of this function. Suggestions?
>>>
>>> Best,
>>> Ambar
>>>
>>>       
>>     
>
>   




More information about the vtkusers mailing list