Line position claculation