def kinks(path, tol=<NUM_LIT>):
kink_list = []<EOL>for idx in range(len(path)):<EOL><INDENT>if idx == <NUM_LIT:0> and not path.isclosed():<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>u = path[(idx - <NUM_LIT:1>) % len(path)].unit_tangent(<NUM_LIT:1>)<EOL>v = path[idx].unit_tangent(<NUM_LIT:0>)<EOL>u_dot_v = u.real*v.real + u.imag*v.imag<EOL>flag = False<EOL><DEDENT>except ValueError:<EOL><INDENT>flag = True<EOL><DEDENT>if flag or abs(u_dot_v - <NUM_LIT:1>) > tol:<EOL><INDENT>kink_list.append(idx)<EOL><DEDENT><DEDENT>return kink_list<EOL>
returns indices of segments that start on a non-differentiable joint.