update the line length and position