# Parametric arc on a TFT LCD

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. 3.2 inch TFT LCD display, suitable for Arduino projects along with an Arduino Mega2560 TFT LCD shield like the one here.

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.

## Theory

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. Arc with its defining parameters on a 320×240 px TFT LCD screen. Angle measured in the positive mathematical direction from positive x-axis towards positive y-axis.

Knowing the defining parameters of the arc, we can write the code.

Each point on the arc is defined as (x, y); $Latex formula$ $Latex formula$,

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.