[vtkusers] vtkKdTreePointLocator sometimes gives wrong answer
Dominik Szczerba
dominik at itis.ethz.ch
Fri Nov 7 03:07:57 EST 2008
I recall from memory that somewhere there was a thing called number of
points per bucket, make sure it is 1 and that you omit Z partitioninig
for a 2D object.
Dominik
Mengda Wu wrote:
> Hi all,
>
> I am trying to use vtkKdTreePointLocator to find the nearest point in
> a Polydata to a given point.
> The code I am using is as follows:
>
> vtkKdTreePointLocator *kdt = vtkKdTreePointLocator::New();
> kdt->SetDataSet( a_polydata );
>
> vtkIdType id= kdt->FindClosestPoint(given_point_coordinate);
> a_polydat->GetPoint(id, nearest_point_coordinate);
>
> But I found "nearest_point_coordinate" is not always the right answer.
> Sometimes, the result is
> very far from the right answer. Am I missing something? Shouldn't the
> returned variable "id"
> be always the index of the nearest point?
>
> Thanks,
> Mengda
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Dominik Szczerba, PhD
Computational Physics Group
IT'IS Foundation for Research
http://www.itis.ethz.ch
More information about the vtkusers
mailing list