Folding facade with absorption point

Thank you very much for your help.
Of course, I am an amateur and this algorithm is very difficult for me to understand. Isn’t there an easier solution?