def split_at_corner_index(contour, index):
 segments = []
 index = [(i + 1) for i in index]
 for (s, e) in zip(([0] + index), (index + [10000000])):
  segments.append(contour[s:(e + 1)])
 return segments

def split_at_corner_index ( contour , index ) : segments = [ ] index = [ ( i + 1 ) for i in index ] for ( s , e ) in zip ( ( [ 0 ] + index ) , ( index + [ 10000000 ] ) ) : segments . append ( contour [ s : ( e + 1 ) ] ) return segments
contour is array shape=(number of points .