-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples not using full color pallete (with solution) #17
Comments
hihi, could you submit a PR, then we could test your updates :) |
I have just submitted a PR. Its my first time, I hope I did it correctly |
The PR is #18. Just adding the reference here for tie in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The examples provided do not make use of all available 255 colors in the array.
This is because the map () function converts pixels[] to an int, resulting in a different color for every full degree shown on screen. The result is the absolute maximum number of differet colors that can be shown on screen at any one time is the difference between MAXTEMP and MINTEMP in whole numbers (for example, if MINTEMP= 25 and MAXTEMP = 35, only 10 different colors from the array can be used at any one time).
Solution
The solution is very simple, inside the map() function, multiply pixels[], mintemp, and maxtemp by 100, this moves the decimal point of the float 2 places to the right. The resulting whole number is then mapped to colorIndex, which will result in the full color array being used.
Standard example:
Interpolation example:
The text was updated successfully, but these errors were encountered: