I remember once needing to code my own drawing functions for an HP48 and not having a clue how to draw line.
My first implementation worked by determining the delta increment that should be applied to both x and y from the starting (x0, y0) point to the final location (x1, y1).
Although this worked, it resulted in horrendously looking jagged lines.
To make matters worst, I also had to calculate the sign of the increments, based on the slope of the line, which added complexity to the code, making it quite ugly and slow.
Then a couple of days later I realized that a line is nothing more than the radius of a circle!
That was quite an eureka moment for me.