Rewrite compute_distance2line to use rpacket_t structure