Encode complex number as RGB pixel

Posted by Vi on Stack Overflow See other posts from Stack Overflow or by Vi
Published on 2010-04-02T13:20:34Z Indexed on 2010/04/02 13:23 UTC
Read the original article Hit count: 421

How is it better to encode a complex number into RGB pixel and vice versa?

Probably (logarithm of) an absolute value goes to brightness and an argument goes to hue.

Desaturated pixes should receive randomized argument in reverse transformation.

Something like:
0 -> (0,0,0)
1 -> (255,0,0)
-1 -> (0,255,255)
0.5 -> (128,0,0)
i -> (255,255,0)
-i -> (255,0,255)

(0,0,0) -> 0
(255,255,255) -> e^(i * random)
(128,128,128) -> 0.5 * e^(i *random)
(0,128,128) -> -0.5

Are there ready-made formulas for that?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about graphics