[vtkusers] Coordinate Conversion - Display to World

zarko.milosevic zarko at kg.ac.rs
Thu May 18 08:51:00 EDT 2017


I have problem with coordinate conversion:

I do following:

vtkRenderWindowInteractor *interactor =
_renderer->GetRenderWindow()->GetInteractor();
dCurrPos[2] = { interactor->GetEventPosition()[0],
interactor->GetEventPosition()[1] };

double worldPt[4];
vtkInteractorObserver::ComputeDisplayToWorld(	_renderer,
									dCurrPos[X],
									dCurrPos[Y],
									0.0,
									worldPt);

worldPt always have same coordinates around 0.405. 

On the scene i have loaded DICOM image in vtkImageActor. 
When i perform picking i get good coordinates.

I have tried also with 

_renderer->SetDisplayPoint(dCurrPos[X], dCurrPos[X], 0.0);
_renderer->DisplayToWorld();
_renderer->GetWorldPoint(worldPt);

and using vtkCoordinate

vtkSmartPointer<vtkCoordinate> coordinate =
vtkSmartPointer<vtkCoordinate>::New();
coordinate->SetCoordinateSystemToDisplay();
coordinate->SetValue(x,y,0);
 
double* world = coordinate->GetComputedWorldValue(_renderer);

and i`m getting same results.

How can i handle this problem and am i doing something wrong ?
      



--
View this message in context: http://vtk.1045678.n5.nabble.com/Coordinate-Conversion-Display-to-World-tp5743308.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list