def _get_view_to_display_matrix(scene):
 from mayavi.core.ui.mayavi_scene import MayaviScene
 from tvtk.pyface.tvtk_scene import TVTKScene
 if (not isinstance(scene, (MayaviScene, TVTKScene))):
  raise TypeError(('scene must be an instance of TVTKScene/MayaviScene, found type %s' % type(scene)))
 (x, y) = tuple(scene.get_size())
 view_to_disp_mat = np.array([[(x / 2.0), 0.0, 0.0, (x / 2.0)], [0.0, ((- y) / 2.0), 0.0, (y / 2.0)], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])
 return view_to_disp_mat

def _get_view_to_display_matrix ( scene ) : from mayavi . core . ui . mayavi_scene import MayaviScene from tvtk . pyface . tvtk_scene import TVTKScene if ( not isinstance ( scene , ( MayaviScene , TVTKScene ) ) ) : raise TypeError ( ( 'scene must be an instance of TVTKScene/MayaviScene, found type %s' % type ( scene ) ) ) ( x , y ) = tuple ( scene . get_size ( ) ) view_to_disp_mat = np . array ( [ [ ( x / 2.0 ) , 0.0 , 0.0 , ( x / 2.0 ) ] , [ 0.0 , ( ( - y ) / 2.0 ) , 0.0 , ( y / 2.0 ) ] , [ 0.0 , 0.0 , 1.0 , 0.0 ] , [ 0.0 , 0.0 , 0.0 , 1.0 ] ] ) return view_to_disp_mat
return the 4x4 matrix to convert view coordinates to display coordinates .