05-15-2023, 12:10 PM
(05-12-2023, 10:17 AM)Jens Noritzsch Wrote: I should have mentioned that you could find the encoder in the source of https://phyphox.org/xmas-generator-2021.html (it's plain uncompressed javascript). That's likely much easier to read than the phyphox file format…
Hello, sorry again, i dont quite understand this part of the code:
function hue2index(h, s, v) {
if (s < 0.5) {
return 7; //White
} else {
if (h < 0.083333333) {
return 3; //red
} else if (h < 0.25) {
return 4; //yellow
} else if (h < 0.416666667) {
return 5; //green
} else if (h < 0.583333333) {
return 6; //cyan
} else if (h < 0.75) {
return 1; //blue
} else if (h < 0.916666667) {
return 2; //magenta
} else {
return 3; //red (again)
}
Mainly i dont understand where 0.0833333, 0.4166666 .... come from. Thanks in advance