Quantcast

Coordinate Conversion - Display to World

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Coordinate Conversion - Display to World

zarko.milosevic
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 ?
     
Loading...