[vtkusers] CellLocator, Octrees and Segfaults...

Radu Bogdan Rusu rusu at cs.tum.edu
Mon Oct 23 03:17:54 EDT 2006


Heya,

Obada Mahdi wrote:
> The problem is that only leaf nodes point to actual instances of
> "vtkIdList".  Inner nodes are marked with an internally defined
> constant (1), causing a segfault when being dereferenced (leaf nodes
> are probably NULL if the corresponding octant is empty, I am not sure
> about that).

I noticed that myself. Is there any other way of actually "iterating" through the octants, 
then ?

I'm thinking something along the lines:
for (int i = 0; i < locator->GetNumberOfBuckets (); i++)
{
   vtkIdList *l = locator->GetCells (i);
   if (l != (vtkIdList*)NULL)
     for (int j = 0; j < l->GetNumberOfIds ();j++)
       // access l->GetId (j)... dataset->GetCell
    ...etc
}

Of course, locator::GetCells (int octantId) looks like
   if (this->Tree[octantId] == (vtkIdList*)1)
     return NULL;
   else
     return this->Tree[octantId];

I'm not sure how healthy that is yet.

Cheers,
Radu.




More information about the vtkusers mailing list