I tried to answer your request.
This seems correct to me, but I admit that there may be bad resolutions in some cases.
Your request turns out to be complicated, I noticed that your request only concerned the case of a convex curve.
I thought this was insufficient so I included the concave curve case.
I don't think I will go further in development without remuneration...
So you will have to settle for this last proposition.
You have the source code, if you want to try to improve.
Good luck!
Retain_Wall.lsp