def _get_world_to_view_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)))
 cam = scene.camera
 scene_size = tuple(scene.get_size())
 clip_range = cam.clipping_range
 aspect_ratio = (float(scene_size[0]) / scene_size[1])
 vtk_comb_trans_mat = cam.get_composite_projection_transform_matrix(aspect_ratio, clip_range[0], clip_range[1])
 vtk_comb_trans_mat = vtk_comb_trans_mat.to_array()
 return vtk_comb_trans_mat

def _get_world_to_view_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 ) ) ) cam = scene . camera scene_size = tuple ( scene . get_size ( ) ) clip_range = cam . clipping_range aspect_ratio = ( float ( scene_size [ 0 ] ) / scene_size [ 1 ] ) vtk_comb_trans_mat = cam . get_composite_projection_transform_matrix ( aspect_ratio , clip_range [ 0 ] , clip_range [ 1 ] ) vtk_comb_trans_mat = vtk_comb_trans_mat . to_array ( ) return vtk_comb_trans_mat
return the 4x4 matrix to transform xyz space to the current view .