[vtkusers] Inconsistant Picking & possible Bug invtkWorldPointPicker
Sarah Macumber
S.Macumber at QuestReliability.com
Thu Aug 7 17:58:10 EDT 2008
Hi Dave,
What seems to be going on is that the Z buffer value is 0.0 which causes the point to be returned as the center of the frustum.
double z1 = GraphicsWindowRenderer.GetPickedZ(); // value is 0
double z2 = GraphicsWindowRenderer.GetZ(pos[0], pos[1]); // value is 0
if I forcibly set the value to something like 0.9999 then picking is correct.
Since you have the start and end position of the rubber band interactor I think it would be best to expose them.
Thanks in advance,
Sarah
________________________________
From: David E DeMarle [mailto:dave.demarle at kitware.com]
Sent: Thu 8/7/2008 4:40 PM
To: Sarah Macumber
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Inconsistant Picking & possible Bug invtkWorldPointPicker
Howdy,
This is dimly ringing a very rusty bell in my head.
Before AreaPicker and InterarctorStyleRBPick were added, all picking was done on a single pixel. Thus the comment in the AreaPicker doxygen about the GetPickPoint being ill-defined. As I recall I made it so that when you ask for that you get the center of the frustum.
You may try getting a Frustum out or, we can add and accessor to the InteractorStyle to get screen start and end pick coordinates.
cheers,
Dave
On Thu, Aug 7, 2008 at 4:38 PM, Sarah Macumber <S.Macumber at questreliability.com> wrote:
I have tried a few alternative methods for getting the world coordinate point but they are also failing and returning the center point ...
Sarah
vtkInteractorStyleRubberBand2D style = vtkInteractorStyleRubberBand2D.SafeDownCast(sender);
int[] pos = style.GetInteractor().GetEventPosition();
GraphicsWindowRenderer.SetDisplayPoint(pos[0], pos[1], 0);
GraphicsWindowRenderer.DisplayToWorld();
_startPickPosition = GraphicsWindowRenderer.GetWorldPoint();
________________________________
From: vtkusers-bounces at vtk.org on behalf of Sarah Macumber
Sent: Thu 8/7/2008 11:42 AM
To: vtkusers at vtk.org
Subject: [vtkusers] Inconsistant Picking & possible Bug invtkWorldPointPicker
Hello Hello,
I have a question about vtkWorldPointPicker acting rather buggy & inconsistant. I am using a
vtkInteractorStyleRubberBand2D along with a vtkWorldPointPicker to select the start and end point of the
rubber band since the Start and End point of all of the rubber band classes is a protected attribute.
The behavior is such that sometimes the code returns the correct end point but sometimes it fails for no
reason and returns the center of the data set. Often times it seems to be accesing bad memory when it
fails.
Any thoughts & thanks in advance!
Sarah
private void GraphicsWindowPickingStyle_StartInteractionEvt(vtkObject sender, vtkObjectEventArgs e)
{
vtkInteractorStyleRubberBand2D style = vtkInteractorStyleRubberBand2D.SafeDownCast(sender);
int[] pos = style.GetInteractor().GetEventPosition();
style.GetInteractor().GetPicker().Pick(pos[0], pos[1], 0, style.GetCurrentRenderer());
_startPickPosition = style.GetInteractor().GetPicker().GetPickPosition();
}
private void GraphicsWindowPickingStyle_EndInteractionEvt(vtkObject sender, vtkObjectEventArgs e)
{
vtkInteractorStyleRubberBand2D style = vtkInteractorStyleRubberBand2D.SafeDownCast(sender);
int[] pos = style.GetInteractor().GetEventPosition();
int returnValue = style.GetInteractor().GetPicker().Pick(pos[0], pos[1], 0, style.GetCurrentRenderer());
_endPickPosition = style.GetInteractor().GetPicker().GetPickPosition();
OnGridSelection(new GridSelectionEventArgs(_startPickPosition, _endPickPosition));
}
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list