(curr_pos, cmd, start_of_path)
return curr_pos, start_of_path
Calculate the position of the pen after cmd is applied.
Calculate the position of the pen after cmd is applied.
Calculate the position of the pen after cmd is applied .
def _update_curr_pos(curr_pos, cmd, start_of_path):
  """Calculate the position of the pen after cmd is applied."""
  if cmd[0] in 'ml':
    curr_pos = [curr_pos[0] + float(cmd[1]), curr_pos[1] + float(cmd[2])]
    if cmd[0] == 'm':
      start_of_path = curr_pos
  elif cmd[0] in 'z':
    curr_pos = start_of_path
  elif cmd[0] in 'h':
    curr_pos = [curr_pos[0] + float(cmd[1]), curr_pos[1]]
  elif cmd[0] in 'v':
    curr_pos = [curr_pos[0], curr_pos[1] + float(cmd[1])]
  elif cmd[0] in 'ctsqa':
    curr_pos = [curr_pos[0] + float(cmd[-2]), curr_pos[1] + float(cmd[-1])]

  return curr_pos, start_of_path
def _update_curr_pos ( curr_pos , cmd , start_of_path ) : if cmd [ 0 ] in 'ml' : curr_pos = [ curr_pos [ 0 ] + float ( cmd [ 1 ] ) , curr_pos [ 1 ] + float ( cmd [ 2 ] ) ] if cmd [ 0 ] == 'm' : start_of_path = curr_pos elif cmd [ 0 ] in 'z' : curr_pos = start_of_path elif cmd [ 0 ] in 'h' : curr_pos = [ curr_pos [ 0 ] + float ( cmd [ 1 ] ) , curr_pos [ 1 ] ] elif cmd [ 0 ] in 'v' : curr_pos = [ curr_pos [ 0 ] , curr_pos [ 1 ] + float ( cmd [ 1 ] ) ] elif cmd [ 0 ] in 'ctsqa' : curr_pos = [ curr_pos [ 0 ] + float ( cmd [ - 2 ] ) , curr_pos [ 1 ] + float ( cmd [ - 1 ] ) ] return curr_pos , start_of_path