A user-friendly way of picking lines

I’m looking for a user friendly way to pick lines using the mouse.

Problem with lines is that they are thin, so difficult to hit exactly with the mouse.

I experimented with vtkAreaPicker to pick an area instead of a point. But vtkAreaPicker gives a lot of false positives.

So then I decided to try a vtkPropPicker and let that sample all points in an area. Unfortunately that turned out to be unworkably slow. Interrogating a small area already takes seconds.

Before going into more exotic ideas, is there anyone with a good option on how to solve this? Else my next try would be to go back to areapicker and then find the Prop with the lowest distance to the camera. Or use vtkPropPicker along a line instead of over an area.

Picking directly from the renderer instead of using any of the pickers did the trick:

renderer = self.GetCurrentRenderer()
assemblyPath = renderer.PickProp(self.start_x, self.start_y, self.end_x, self.end_y)
collection = renderer.GetPickResultProps()

renderer.PickProp returns the nearest prop while all picked props are stored in renderer.GetPickResultProps()

2 Likes