After you are using your Arduino for a while, you will start missing functions and features for your graphical TFT LCD screen like the one in the picture.
Recently I needed to draw a smiley 🙂 for a game for one of my customers and that simply meant, that I needed to draw an arc. I did found another way of doing that, but the smiley couldn’t be parametrised easily, so I decided to make a parametric arc first.
Let me walk you through the trigonometry behind it.
The arc is shown in the figure below with all its parameters; x and y coordinate of the center, starting and ending angles φstart and φend respectively, and the arc radius r.
Knowing the defining parameters of the arc, we can write the code.
Each point on the arc is defined as (x, y);
where xc and yc are coordinates of the center, r is the arc radius and φ is the angle in radians to the point on the arc, starting from x-coordinate towards the positive y-axis.