[vtkusers] CellLocator, Octrees and Segfaults...

Radu Bogdan Rusu rusu at cs.tum.edu
Tue Oct 24 13:19:16 EDT 2006


Yeah, what I don't understand is why:

this->MarkParents((void*)VTK_CELL_INSIDE,i,j,k,ndivs,this->Level);

...in: void vtkCellLocator::BuildLocator()
...where: #define VTK_CELL_INSIDE 1
...because: void vtkCellLocator::MarkParents(void* a, int i, int j, int k, int ndivs, int 
level)
...contains: this->Tree[parentIdx] = (vtkIdList *)a;

I would really appreciate if someone could shed some light on the matter. :-/ Thanks!

Cheers,
Radu.

Philipp Kemmeter wrote:
> Heya!
> 
> Thanks, Mahdi for your help. This is quite intersting and good to know :)
> 
> @Radu: Got the same question here: Is it possible to iterate through
> the flattened octree directly? And how to access the points after
> getting the the idlist ?
> 
> Phil
> 
> 2006/10/23, Radu Bogdan Rusu <rusu at cs.tum.edu>:
>> 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