@decorator
def arg_to_vec4(func, self_, arg, *args, **kwargs):
 if isinstance(arg, (tuple, list, np.ndarray)):
  arg = np.array(arg)
  flatten = (arg.ndim == 1)
  arg = as_vec4(arg)
  ret = func(self_, arg, *args, **kwargs)
  if (flatten and (ret is not None)):
   return ret.flatten()
  return ret
 elif hasattr(arg, '_transform_in'):
  arr = arg._transform_in()
  ret = func(self_, arr, *args, **kwargs)
  return arg._transform_out(ret)
 else:
  raise TypeError(('Cannot convert argument to 4D vector: %s' % arg))

@ decorator def arg_to_vec4 ( func , self_ , arg , * args , ** kwargs ) : if isinstance ( arg , ( tuple , list , np . ndarray ) ) : arg = np . array ( arg ) flatten = ( arg . ndim == 1 ) arg = as_vec4 ( arg ) ret = func ( self_ , arg , * args , ** kwargs ) if ( flatten and ( ret is not None ) ) : return ret . flatten ( ) return ret elif hasattr ( arg , '_transform_in' ) : arr = arg . _transform_in ( ) ret = func ( self_ , arr , * args , ** kwargs ) return arg . _transform_out ( ret ) else : raise TypeError ( ( 'Cannot convert argument to 4D vector: %s' % arg ) )
decorator for converting argument to vec4 format suitable for 4x4 matrix multiplication .