Find out the angle in a circle based on temperature

36 Views Asked by At

I have a specific range of temperature from a circle control which I'm developing for mobiles. This control has a range of temperatures from 35.0C to 41.5C. I would like to know how can I discover the specific angle passing a value inside this range, for example: 38.0C. My math skills are poor. I admit.

1

There are 1 best solutions below

1
On BEST ANSWER

Assuming that your control looks a bit like a speedometer, rather than a full circle, you just need to interpolate the desired angle into the range between start angle $a$ and end angle $b$, knowing that the start angle corresponds to $35.0°$C and the end angle corresponds to $41.5°$C

So for a temperature $T$, $\frac{\large T-35}{\large 41.5-35}$ gives the proportion of how far through the range it is, and $a + (b-a)\times \frac{\large T-35}{\large 41.5-35}$ gives the relevant angle by scaling the temperautre range to the angle range.