[vtkusers] CellLocator, Octrees and Segfaults...

Philipp Kemmeter gildedfalcon at googlemail.com
Mon Oct 23 03:37:27 EDT 2006


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.
>
> _______________________________________________
> 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
>


-- 
www.project-virus.de - das einzigarte Browsergame



More information about the vtkusers mailing list