# Function to Generate Two Circles For a Color Gradient

I am working on a project creating a gauge package in software, but I am posting here because it is more of a mathematical question.

In short, I need a function to create a color gradient to fill in the rest of the rim of the gauge (See images below).

The graphics software allows you to draw a radial gradient by specifying the center and radius for two circles. You specify color stops by giving it a positional value between 0 and 1. It then draws the gradient between the two curves of the circle.

The part that I am stuck on is that the angle of the connecting color changes based on the angle of the gauge. Therefore, it seems like the circles defining the gradient are dependent on the angle of the gauge.

Any help that you could provide would be great. If you need any further information, please feel free to ask.

-

The gradient shouldn't depend on the angle; the only thing that should change is the angle of the circle sector that connects the two sides.

By the way, if you want the outer edges of the rim to join together smoothly, that angle should be the supplement of the inner angle, not equal to it as you've shown in the pictures. That way, you also won't need to change the radius of the corners depending on the angle (although you seem to have figured out a formula for that already, unless you drew those pictures by hand).

Here's a quick sketch I drew in GeoGebra to show what I mean:

$\hspace{130px}$

Here, the three small circles all have radius $r$, and the angle $\beta = 180^\circ - \alpha$. All other corners between the black lines (and circles) in this picture are (multiples of) $90^\circ$.

-
Using the supplemental angle to find the inner arc did the trick. I ended up setting it equal to the angle because the formula for the lines were more apparent at first. I always forget the simple things, like supplement angles, lol. Thank you for your time and your help. – jyore Nov 29 '11 at 19:51