[vtkusers] vtkLocator. Please help!!!

brizzi at deis.unibo.it brizzi at deis.unibo.it
Wed Aug 23 10:10:42 EDT 2006


Dear vtk users,

I need to calculate the distance of 2 surfaces. To do this I want to calculate
the distance between every point of the first surface and the closest point on
the second surface. I'm trying to use vtkLocator to find the closest point, but
when I execute the program, it crashes in the following point:
pointLocator1->BuildLocator() in my code

if ( this->NumberOfIds >= this->Size ) in vtkIdList::InsertNexdId(const int)

bucket->InsertNextId(i); in vtkPointLocator::BuildLocator;

I can't understand where's the error. With other surfaces the program run
correctly.

Please help!!!!

Barbara



my related code:

int numberOfPoints1 = ( connfilt1->GetOutput() )->GetNumberOfPoints();
int numberOfPoints2 = ( connfilt2->GetOutput() )->GetNumberOfPoints();

vtkPointLocator *pointLocator1 = vtkPointLocator::New();
     pointLocator1->SetDataSet( ( connfilt1->GetOutput() ) );
     pointLocator1->BuildLocator();

vtkPointLocator *pointLocator2 = vtkPointLocator::New();
     pointLocator2->SetDataSet( ( connfilt2->GetOutput() ) );
     pointLocator2->BuildLocator();

   int m;
   int pointId;
   double sum1 = 0.0;
   double mean1;
   double point[3];
   double closestPoint[3];
   double difference[3];
   double distance;
   double dist2;

   for ( m = 0; m < numberOfPoints1; m++ )
   {   ( connfilt1->GetOutput() )->GetPoint( m, point );
       pointId = pointLocator2->FindClosestPoint( point );
	   ( connfilt2->GetOutput() )->GetPoint( pointId, closestPoint );
       difference[0] = point[0] - closestPoint[0];
       difference[1] = point[1] - closestPoint[1];
       difference[2] = point[2] - closestPoint[2];








----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the vtkusers mailing list