[vtkusers] Coordinates on a surface
Dean Inglis
dean.inglis at camris.ca
Tue Aug 19 15:29:02 EDT 2003
Hi James,
I actually created a widget that I call vtkPropTracerWidget
that does essentially what you want. It uses an internal vtkPropPicker:
<snip - initialize>
this->Prop = NULL;
this->PropPicker = vtkPropPicker::New();
this->PropPicker->PickFromListOn();
<snip>
in your case, you would set this->Prop to your mesh and add the prop to
the picker:
<snip>
this->PropPicker->InitializePickList();
this->PropPicker->AddPickList(this->Prop);
<snip>
> also try to do it dynamically as the mouse moves across the window using a
>tkCellPicker that I instantiate as part of my vtkMFCView derived CView:
this is probably the way to go. Your problem with the y-coord can be easily
resolved be getting the display window height in pixels, say DWH, and
setting
wx = float(LOWORD(lParam));
wy = DWH - float(HIWORD(lParam)) + 1.0f;
/* now add in some more vtk stuff... */
if( !this->PropPicker->PickProp(wx,wy,Renderer) ){ return; }
if( this->Prop != this->PropPicker->GetProp() ){ return; }
float pos[3];
this->PropPicker->GetPickPosition(pos);
/* use pos to query the data however you see fit ... */
Dean
More information about the vtkusers
mailing list