improved straight line algorithm