update some codes for drawing a line.

A line can have different direction. I distinguish several way. Using a
lineHelper can get the direction of line.