I just noticed that things are even more complicated and a more subtle logic must be used:
If the magenta - lines start from the "lower" points the distances must be calculated similarly, but in the other direction.
Look at the 2nd notebook with
convpoint = {0, 0};
p1 = {10, -7};
p2 = {10, 7};
n = 6;
That is not really complicated, but one should rewrite the notebook from scratch. I don't have the time to do that right now. The basic idea is:
If the slope of "oldlines[[i]]" is negative the magenta-line should have a slope >0 and the distance from the "lower" point to the line through the midpoint is to be calculated.