[vtkusers] How to transform world coordinate to normalized viewport coordinate

Liu_tj tjlp at netease.com
Wed May 4 12:36:47 EDT 2016


Hi,


Here I get a problem about transform world coordinate to normalized viewport coordinate. I use vtkBorderWidget to select an area. When the selection is finished, I use below code to get the normalized viewport coordinate of the select point and transform to world coordinate.
 vtkBorderRepresentation borderrep = vtkBorderRepresentation.SafeDownCast(m_areaSegment.GetRepresentation());
            vtkCoordinate lowerleftCorr = borderrep.GetPositionCoordinate(); //normalized view port coordinate
            double[] lowerleft = lowerleftCorr.GetComputedWorldValue(m_renderer);//World coordinate
            vtkCoordinate upperRightCorr = borderrep.GetPosition2Coordinate();
            double[] upperright = upperRightCorr.GetComputedWorldValue(m_renderer);


Now, given a world coordinate, How can I transform to normalized viewport coordinate and then I can set the lower left and upper right corner of vtkBorderWidget by vtkBorderRepresentation.SetPostion() and SetPosition2()?


I try http://stackoverflow.com/questions/30124534/convert-world-to-normalized-viewport but it doesn't work.


Thanks
Liu Peng 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160505/e3710841/attachment.html>


More information about the vtkusers mailing list