[vtkusers] vtkPointSpriteMapper picking

Paul Harris harris.pc at gmail.com
Mon Apr 20 13:49:03 EDT 2009


Hi to all,

I would like to be able to pick the points drawn by vtkPointSpriteMapper.

I can currently use the vtkCellPicker, with tolerance, but ideally I would
like the picker to take into account the "radius" of each point, and the
distance scaling (which may be off).  Note that there may be several
vtkPointSpriteMappers that all need to be considered during the pick.

I have been hacking through the code, looking for ways to make this happen.
So far I have subclassed vtkPolyData to add the radius to the edge of the
bounds after ComputerBounds() (which seems to work well),

but the next step seems more difficult.  The key point seems to be the line
in vtkCellPicker.cxx:89
    if ( this->Cell->IntersectWithLine(p1, p2, tol, t, x, pcoords, subId)

The 'Cell' is a vtkGenericCell, created by the picker.

The options I see are:
a - Hack/subclass vtkCellPicker so that it will call
Cell->IntersectWithLine() with an adjusted tolerance.
b - Hack/subclass vtkCellPicker so that it will use MyHackedGenericCell
which can deal with the radius within IntersectWithLine()
c - Write my own vtkPointSpritePicker.

a and b have extra problems because I need to somehow transfer the radius
and distance scaling from the dataset into the Cell for computation.

c is an good option (I think?), but then I see the problem that if I want to
consider not just PointSprite data, but also normal cell data (eg polygons
etc), then I may be in trouble.

Maybe I could figure out the best pointsprite candidate, and then run a
CellPicker pick to check whether it was 'beaten' by another cell+data... but
I don't think CellPicker will give me details on how "good" (or close, or
how close to the ray) its pick was...

its a bit late so i'm not sure if the above makes sense... i'd really
appreciate some pointers, I'm still new to VTK.

thanks
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090421/a9f587e1/attachment.htm>


More information about the vtkusers mailing list