arranging the hud degrees

Started by
0 comments, last by Oluseyi 16 years, 4 months ago
hi there guys this may be a simple problem some of you have done before i am trying to get the angles correct for my hud, it is just a round dial with a needle that shows the speed i am going , the speed is calculated from a 0 - 1 range the initial 0 position is 178 degrees the end 1 position is 110 degrees so there is a 68 degree difference from start to end. how can a work out the current angle needed if say fuel was 0.5?
Advertisement
Linear interpolation: w = u + (1 - t) * (v - u)
where
w = the angle representing the current speed
u = the angle representing the minimum speed
v = the angle representing the maximum speed
t = the current speed on a normalized 0 - 1 scale

So for a [178, 110] angular range and a current speed of 0.5:
w = 178 + (1 - 0.5) * (110 - 178)  = 178 + 0.5 * -68  = 178 - 34  = 144

This topic is closed to new replies.

Advertisement