[vtk-developers] VtkLineWidget2 InteractionEvent distance
carlinhos
carlinhosmp87 at gmail.com
Thu Jul 17 04:13:09 EDT 2014
Hi all!
Finally, i solved it using a vtkCellPicker explicit to get the world point
where the mouse is, in case I use the picker returned by the interactor the
coordinates seem wrong many times. This is the new code:
*vtkSmartPointer<vtkCellPicker> picker =
vtkSmartPointer<vtkCellPicker>::New();
int* clickPos = m_rwi->GetEventPosition();
if ( state == vtkLineRepresentation::OnP1 ) {
if (picker->Pick(clickPos[0], clickPos[1], clickPos[2], m_renderer)) {
double picked[3];
picker->GetPickPosition(picked);
lineRepresentation->SetPoint1WorldPosition(picked);
PrintPointsPosition(oldLineRepresentation);
}
}else if ( state == vtkLineRepresentation::OnP2 ) {
if (picker->Pick(clickPos[0], clickPos[1], clickPos[2], m_renderer)) {
double picked[3];
picker->GetPickPosition(picked);
lineRepresentation->SetPoint2WorldPosition(picked);
PrintPointsPosition(oldLineRepresentation);
}
}*
Thanks to everyone!!! :)
--
View this message in context: http://vtk.1045678.n5.nabble.com/VtkLineWidget2-InteractionEvent-distance-tp5727880p5727886.html
Sent from the VTK - Dev mailing list archive at Nabble.com.
More information about the vtk-developers
mailing list