ffi/vector.py
def _update(self, *args, **kwargs): # {{{1
    "Assign a value to the vector"
    if len(args) == 0 and len(kwargs) == 0:
      self.x = 0
      self.y = 0
      self.z = 0
    elif len(args) == 1:
      if isinstance(args[0], np.ndarray):
        self._update(*args[0])
      elif isinstance(args[0], Vec):
        self._update(*tuple(args[0]))
      elif hasattr(args[0], "__len__") and len(args[0]) in (3, 4):
        self._update(*args[0])
      else:
        self.m128 = args[0]
    elif len(args) in (3, 4):
      self.x = args[0]
      self.y = args[1]
      self.z = args[2]
      if len(args) == 4:
        self.w = args[3]
    elif "m128" in kwargs:
      self.m128 = kwargs["m128"]
    elif all(k in kwargs for k in ("x", "y", "z")):
      self.x = kwargs["x"]
      self.y = kwargs["y"]
      self.z = kwargs["z"]
      if "w" in kwargs:
        self.w = kwargs["w"]
    else:
      raise TypeError("Invalid arguments (*{}, **{})".format(args, kwargs))
Assign a value to the vector
Assign a value to the vector
Assign a value to the vector
def _update(self, *args, **kwargs): 
    if len(args) == 0 and len(kwargs) == 0:
      self.x = 0
      self.y = 0
      self.z = 0
    elif len(args) == 1:
      if isinstance(args[0], np.ndarray):
        self._update(*args[0])
      elif isinstance(args[0], Vec):
        self._update(*tuple(args[0]))
      elif hasattr(args[0], "__len__") and len(args[0]) in (3, 4):
        self._update(*args[0])
      else:
        self.m128 = args[0]
    elif len(args) in (3, 4):
      self.x = args[0]
      self.y = args[1]
      self.z = args[2]
      if len(args) == 4:
        self.w = args[3]
    elif "m128" in kwargs:
      self.m128 = kwargs["m128"]
    elif all(k in kwargs for k in ("x", "y", "z")):
      self.x = kwargs["x"]
      self.y = kwargs["y"]
      self.z = kwargs["z"]
      if "w" in kwargs:
        self.w = kwargs["w"]
    else:
      raise TypeError("Invalid arguments (*{}, **{})".format(args, kwargs))
def _update ( self , * args , ** kwargs ) : if len ( args ) == 0 and len ( kwargs ) == 0 : self . x = 0 self . y = 0 self . z = 0 elif len ( args ) == 1 : if isinstance ( args [ 0 ] , np . ndarray ) : self . _update ( * args [ 0 ] ) elif isinstance ( args [ 0 ] , Vec ) : self . _update ( * tuple ( args [ 0 ] ) ) elif hasattr ( args [ 0 ] , "__len__" ) and len ( args [ 0 ] ) in ( 3 , 4 ) : self . _update ( * args [ 0 ] ) else : self . m128 = args [ 0 ] elif len ( args ) in ( 3 , 4 ) : self . x = args [ 0 ] self . y = args [ 1 ] self . z = args [ 2 ] if len ( args ) == 4 : self . w = args [ 3 ] elif "m128" in kwargs : self . m128 = kwargs [ "m128" ] elif all ( k in kwargs for k in ( "x" , "y" , "z" ) ) : self . x = kwargs [ "x" ] self . y = kwargs [ "y" ] self . z = kwargs [ "z" ] if "w" in kwargs : self . w = kwargs [ "w" ] else : raise TypeError ( "Invalid arguments (*{}, **{})" . format ( args , kwargs ) )
Assign a value to the vector
Assign a value to the vector
# {{{1 "Assign a value to the vector"
self