(cmds)
return new_cmds
Convert commands in a path to relative positioning.
Convert commands in a path to relative positioning.
Convert commands in a path to relative positioning .
def make_relative(cmds):
  """Convert commands in a path to relative positioning."""
  curr_pos = (0.0, 0.0)
  start_of_path = (0.0, 0.0)
  new_cmds = []
  for cmd in cmds:
    if cmd[0].lower() == cmd[0]:
      new_cmd = cmd
    elif cmd[0].lower() == 'z':
      new_cmd = [cmd[0].lower()]
    else:
      new_cmd = [cmd[0].lower()] + _convert_args(cmd[1:], curr_pos, cmd=cmd[0])
    new_cmds.append(new_cmd)
    curr_pos, start_of_path = _update_curr_pos(curr_pos, new_cmd, start_of_path)
  return new_cmds
def make_relative ( cmds ) : curr_pos = ( 0.0 , 0.0 ) start_of_path = ( 0.0 , 0.0 ) new_cmds = [ ] for cmd in cmds : if cmd [ 0 ] . lower ( ) == cmd [ 0 ] : new_cmd = cmd elif cmd [ 0 ] . lower ( ) == 'z' : new_cmd = [ cmd [ 0 ] . lower ( ) ] else : new_cmd = [ cmd [ 0 ] . lower ( ) ] + _convert_args ( cmd [ 1 : ] , curr_pos , cmd = cmd [ 0 ] ) new_cmds . append ( new_cmd ) curr_pos , start_of_path = _update_curr_pos ( curr_pos , new_cmd , start_of_path ) return new_cmds