add line_near function in Element class