[vtkusers] PointPicker Problem
Chris Hood
Chris.Hood at noaa.gov
Mon May 17 13:39:10 EDT 2004
I am trying to be able to click on certain actors and have the point
where it was clicked returned. I only want the top point (from the current
viewpoint). Sometimes it works and other times I get random points.
When I use the GetPickedPositions command I get several coordinates,
even when the spot is one where there should be only one intersection. I
use the first one and at some angles it is right, but at other angles the z
coordinate is the negative value of what it should be. When I click on
actors not on the pick list or in a some blank spots one or more points are
returned.
Using the GetPickPosition command I get a point that appear to be where
the dataset is first intersected, even though there is no actor there. The
GetPointId returns a point at the same coordinate.
Does anyone know how to get the right coordinates returned? Also does
anyone know how to make it only use the actors I tell it to use?
System info: WinXP, Java 1.4 with VTKPanel
Test Code:
void Test(MouseEvent e) {
int x=e.getX(), y=e.getY();
pointPicker = new vtkPointPicker();
pointPicker.AddPickList(actor3);
pointPicker.AddPickList(actor0);
pointPicker.AddPickList(actor2);
pointPicker.PickFromListOn();
pointPicker.Pick(x,y,0,renPanel.GetRenderer());
int noOfPoints = pointPicker.GetPickedPositions().GetNumberOfPoints();
System.out.println(noOfPoints);
double[] a = pointPicker.GetPickPosition();
System.out.println("PickPosition: " +a[0] + ", " + a[1] + ", "
+ a[2]);
System.out.println(pointPicker.GetPointId());
a = modelData.GetPoint(pointPicker.GetPointId());
System.out.println("Point Coord: " +a[0] + ", " + a[1] + ", " +
a[2]);
for(int i=0;i<noOfPoints;i++){
a = pointPicker.GetPickedPositions().GetPoint(i);
System.out.println("Point " + i +": " +a[0] + ", " + a[1] +
", " + a[2]);
}
System.out.println(" ");System.out.println(" ");
}
____________________________________
Chris Hood
Graduate Student Research Assistant
University of Colorado, Boulder
Space Environment Center - NOAA
More information about the vtkusers
mailing list