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