def split_at_angle(contour, curvature, angle):
 segments = []
 kink_index = [i for i in range(len(curvature)) if (curvature[i] < angle)]
 for (s, e) in zip(([0] + kink_index), (kink_index + [None])):
  if (e is not None):
   segments.append(contour[s:(e + 1)])
  else:
   segments.append(contour[s:e])
 return segments

def split_at_angle ( contour , curvature , angle ) : segments = [ ] kink_index = [ i for i in range ( len ( curvature ) ) if ( curvature [ i ] < angle ) ] for ( s , e ) in zip ( ( [ 0 ] + kink_index ) , ( kink_index + [ None ] ) ) : if ( e is not None ) : segments . append ( contour [ s : ( e + 1 ) ] ) else : segments . append ( contour [ s : e ] ) return segments
contour is array shape=(number of points .