The problem I have is:
Fill a circle by drawing one-pixel-wide horizontal lines across its inside area.
My initial thought is to generate the circles' coordinates symmetrically to a vertical axis passing through its centre, using the parametric equations: \begin{align} x &= x_{\rm offset} + r \cdot \cos\theta \\ y &= y_{\rm offset} + r \cdot \sin\theta \end{align}
and letting the angle $\theta$ decrementing1 from $270^\circ$ to $180^\circ$, to generate the starting points of the horizontal lines and then incrementing1 for the $I$ and $IV$ quadrants: from $270^\circ$ to $360^\circ$ to generate the ending points of the lines.
As mathematics is clearly not my forte, I am asking the following:
Question:
- Should I proceed with the implementation of the above rationale or is there a more efficient2 method to achieve the task?
Note:
The coordinate system I use is left-handed: the $y$ coordinate increases downwards.
1. By the thickness of the lines
2. Using less calculations.
For $r_y=-r\ldots r$, let $r_x=\sqrt{r^2-r_y^2}$ and draw the line at: $y=y_{\text{offset}}+r_y$
from $x=x_{\text{offset}}-r_x$ to $x=x_{\text{offset}}+r_x$.