vtkPropPicker not working in Java wrapper after upgrade to 8.2.0


I use the VTK library through the Java wrapper. After upgrading to 8.2.0 my code using the vtkPropPicker does not work any more (in 8.1.1 was ok).

The renderer where I do the picking contains a vtkAssembly containing several vtkActors representing vtkPolyData. For picking I use the following code:

public vtkAssemblyPath pickPath(final double x, final double y) {
    if(this.picker.Pick(x, y, 0.0, this.renderer) == 0)
        return null;
    return this.picker.GetPath();

For (x,y) where no actor is present the Pick() method returns corretly 0. But in case that Pick()!=0 the GetPath() returns always path pointing to the same vtkActor regardless which one is under the provided location (x,y).

What could be the problem in this case? Is the vtkPropPicker supported in Java wrapper?


Hello again,

even nobody responded I would like to share with you what did I learned about the issue so far.

After some investigation I realized that the problem is the vtkAssemblyProp containing the vtkActors I want to pick. In case that renderer in which I do the picking contains the actors directly (not nested under any vtkPropAssembly) everything is fine.

To demonstrate the issue and eliminate any Java related problems I took the original HighlightPickedActor example and modified it slightly:

This example enables you to pick by the left mouse click any of several sphere actors added directly into the renderer. I added the same number of cube actors that are nested within single vtkPropAssembly that is added into the same renderer as the spheres. Left click on any sphere works fine. But left click on cube highlights always the same cube.

In the previous version(s) 8.1.x vtkPropPicker::GetPath returned correctly the path to the actor (prop) under the coordinates provided to the vtkPropPicker::Pick method. In the 8.2.0 this behavior is gone. Is it a bug? Or do I use the picking API wrong way?

The good news is that I have found a workaround: When the following method is used

int vtkPropPicker::PickProp(double selectionX, double selectionY, vtkRenderer *renderer, vtkPropCollection *pickfrom)

and actors nested in the vtkPropAssembly are passed as the pickfrom collection one can pick nested actors again. Uncomment the line 188 in the provided example HighlightPickedActor.cxx to see it in action. But of course spheres cannot picked now.

I will really appreciate a lot any comments on my usage of the picking API to realize whether it is right or wrong.