This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Xmas receiver mathematical insights
#6
(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
Reply


Messages In This Thread
Xmas receiver mathematical insights - by bulligan - 05-05-2023, 09:53 AM
RE: Xmas receiver mathematical insights - by bulligan - 05-15-2023, 12:10 PM

Forum Jump: