In my program(python based), a point need to be converted from world coordinate([x,y,z]) to view coordinate([j,k,t],j and k are between -1 and 1,t is the depth) in VTK. I find the vtkCoordinate
class with SetCoordinateSystemToView()
method. But it does not work .
coordinate = vtk.vtkCoordinate()
coordinate.SetCoordinateSystemToWorld()
coordinate.SetValue(x,y,z)
coordinate.SetCoordinateSystemToDisplay()
viewCoord=coordinate.GetComputedValue(renderer)
The result is very odd and definitely wrong. There are some methods like GetComputedDisplayValue()
or GetComputedViewportValue()
that can get the corresponding result from a coordinate system to display or viewport coordinate system, but there is no method like GetComputedViewValue()
. Very confused, need help,
thank you.