It took me a long time to realize that each of your “many small kinks” has two ~90 degree angles!!
When I finally figured that out, I culled duplicate points with a tolerance value of 1, high enough to average the two discontinuity points at each kink into a single point, then rebuilt the closed polyline.
At that point, the code in the white group worked as expected. It was quite baffling that it didn’t work on the original polyline. Very tricky.
corners_2020May13a.gh (17.2 KB)