Non ho capito bene l'indentazione ma è una cosa del genere
codice:
subroutine raypacket (from, to)
stack calls
push(calls, (from, to))
while not empty(calls) do
(from, to) = pop(calls)
if from = to then raytraverse(from) //problema banale
if from-to=1 then raytraverse(to); raytraverse(from) // problema banale
else
destination1=raytraverse(from)
destination2=raytraverse(to)
if destination1=destination2 then
if from - to > 1 then linear_interpolate_distance(from,to)
else begin
push(calls, (from+(to-from)/2+1,to))
push(calls, (from,from+(to-from)/2))
end
end
end