[vtkusers] vtkCellLocator: Finding closest cell center

Sebastian Gatzka sebastian.gatzka at stud.tu-darmstadt.de
Fri Mar 19 07:08:08 EDT 2010


Hi.

I have toyed around in this matter and can narrow the problem down.

I'm feeding the cell locator with *cellCenters* in hope these are the 
points the cell locator will look at if a comparison needs to be done:

vtkCellLocator *cellLocator = vtkCellLocator::New();
cellLocator->SetDataSet(this->cellCenters->GetOutput());

The point I'm comparing from is a (dynamic) point which is an *implicit 
plane representations origin*.

double planePoint[3];
planePoint[0] = rep->GetOrigin()[0];
planePoint[1] = rep->GetOrigin()[1];
planePoint[2] = rep->GetOrigin()[2];

Than I pass this point to the FindClosestPoint()-function in hope the 
closest point is written to the closestPoint variable.

double closestPoint[3];
vtkIdType cellId;
int subId;
double dist;
cellLocator->FindClosestPoint(planePoint,closestPoint,cellId,subId,dist);

cout << "closestPoint: " << closestPoint[0] << " " << closestPoint[1] << 
" " << closestPoint[2] << "\n" << endl;

This code crashes at the* if-statement* at line 989 of 
vtkCellLocator.cxx which contains this function:

//  If at this bucket, just place into list
//
if ( level == 0 )
{
if (this->Tree[leafStart + ijk[0] + ijk[1]*this->NumberOfDivisions
+ ijk[2]*numberOfBucketsPerPlane])
{
this->Buckets->InsertNextPoint(ijk);
}
return;
}

So, what may be wrong?


Am 19.03.2010 10:49, schrieb Sebastian Gatzka:
> Hello World.
>
> I'm currently working with the vtkCellLocator to locate the closest 
> cell center from a specific point (which I set).
> I had a look at the example from the documentation, but I'm not sure 
> how to handle the FindClosestPoint function.
>
> Can anyone explain?
>
> Thank you.
> Sebastian
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100319/12f3d1bb/attachment.htm>


More information about the vtkusers mailing list