>>771
X軸側を無視していいなら単純に
for i = 0 to 3
if [i+1].原点Y < [i].原点Y + [i].加工Y then
[i].加工Y = [i+1].原点Y - [i].原点Y
end if
next
でよくね?