How to access cells from in an octant/bin in a vtkStaticCellLocator?


I want to recover the list/array of cells associated with an octant/bin in a vtkStaticCellLocator, but I don’t see any access methods on the locator to get this info.

What am I missing?

Thanks in advance,


I see that there is a GetCells() method on vtkCellSelector, but it’s not there on the vtkStaticCellLocator and I really need the performance of the static locator.

The class documentation for vtkStaticCellLocator claims that it’s an accelerated version of vtkCellLocator. I’m wondering if removing these methods was a design choice or an oversight? Looking at the implementation it seems like the GetCells() method could be implemented very easily.

Good catch, it looks like an oversight. I agree, it looks like this could be implemented easily.

Do you want to create a MR? If not, I can get to this sometime in the next week or two.

To date, I haven’t made a code contribution to VTK so I thought I might use this as my first opportunity - given that it looks easy enough to do…
To that end, I read the instructions on how to do this last night - so I think I’ll give it a go myself. It’ll likely take me a while even though the code change shoudl be minimal.

Thank you. The software process can definitely be a little confusing at first, but we will help.

@will.schroeder - One of the reasons I’m looking at this method is because I’m struggling to get highly performant rubber band picking working in VTK (vtkUnstrucutrredGrids, vtkPolyData in composite data sets.
Basically, I can’t see any path through the code that takes advantage of both Octree/vtkStaticCellLocator AND SMP for this task. I see that vtkFrustumSelector is now SMPTools enabled, but doesn’t take advantage of the binning that is available in vtkStaticCellLocator.
So I was thinking about extending vtkFrustumSelector to use vtkStaticCellLocator to improve performance - does that make sense?

Thanks Will!!!

Got it. Are you going to modify the vtkFrustumSelector to use the cell locator? If so, you probably want to make its use optional because the cost of upfront building the locator can be quite high, and some use cases won’t tolerate that.

Yes - I was thinking about making it optional. Are there established patterns for this?

I would add a UseCellLocator boolean (Set/Get/Boolean macros in the .h file) so users can enable / disable it.

Makes sense. I can also check if the locator is already present and up to date on the dataset and just use it if it is, even if the flag is False…