Lookup tables in C++ -


I have to implement small multimage graphic controls, which in essence has an array of 9 pictures, which were shown one after the other. is. The final goal is to act as a minislider

Now, this graphic control is going to get different integer ranges: 5 to 25 or 0 to 7 or 9-9 to 9

If I am going to use proportion - "rule of all three" I am afraid it is not technically latent because it can be a source of errors. My guess is to use some lookup tables, but Is there any good advice for the approach?

Thnx

I'm not sure the tables are required to see From your input value, you can get the image indices between 0 to 9 proportionally:

  int ConvertToImageArrayIndex (int inputValue) {int maxInputFromOtherModule = 25; Int minInputFromOtherModule = 5; // +1 is required so that the potential limit includes both the minimum and maximum input value // 0.5, therefore, round on the closest image instead of the goal always. // 8.0 needs to get an output range of 9 potential indices [0..8] Int image index = ((float) ((input-value-mininputfomother module) * 8.0) / (float) (maximal inputfomass module - Mininputfo audio Module + 1)) + 0.5; Return image index; }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -