(lines)
return strokes[1:, :]
Convert polyline format to stroke-3 format.
Convert polyline format to stroke-3 format.
Convert polyline format to stroke - 3 format .
def lines_to_strokes(lines):
  """Convert polyline format to stroke-3 format."""
  eos = 0
  strokes = [[0, 0, 0]]
  for line in lines:
    linelen = len(line)
    for i in range(linelen):
      eos = 0 if i < linelen - 1 else 1
      strokes.append([line[i][0], line[i][1], eos])
  strokes = np.array(strokes)
  strokes[1:, 0:2] -= strokes[:-1, 0:2]
  return strokes[1:, :]
def lines_to_strokes ( lines ) : eos = 0 strokes = [ [ 0 , 0 , 0 ] ] for line in lines : linelen = len ( line ) for i in range ( linelen ) : eos = 0 if i < linelen - 1 else 1 strokes . append ( [ line [ i ] [ 0 ] , line [ i ] [ 1 ] , eos ] ) strokes = np . array ( strokes ) strokes [ 1 : , 0 : 2 ] -= strokes [ : - 1 , 0 : 2 ] return strokes [ 1 : , : ]