Extract the required points and insert them back into a list in order?

Query1.gh (13.8 KB)
optimize.3dm (48.1 KB)

Referring to gh file I have attached I am deleting off the points in red i.e whenever a segment of curve approches a straight line . But on doing so I am loosing a bit of originality of the curve.

Is there any way I can fix this ?
One way could be extract the mid points of the segments joining the red points and insert it back into the points wanted list(Complex). But I dont know how to do it and I am lost. Is there any other way ?
Help me fix this.

How about CurveToPolyline?

Query1_Re.gh (12.9 KB)

I see you have posted elsewhere.
If it is unnecessary, please delete the thread.