Generates a color for the pixel at (pos[0], pos[1]) with coefficients k[0] and k[1], and colouring functions f_a and f_b that map R->[-1, 1].
(pos, k, f_a, f_b)
| 47 | |
| 48 | |
| 49 | def _gen_color(pos, k, f_a, f_b): |
| 50 | """ |
| 51 | Generates a color for the pixel at (pos[0], pos[1]) with coefficients k[0] |
| 52 | and k[1], and colouring functions f_a and f_b that map R->[-1, 1]. |
| 53 | """ |
| 54 | p0 = float(pos[0]) |
| 55 | p1 = float(pos[1]) |
| 56 | return (f_a(p0 * f_b(p1/k[0])/k[1]) + 1.0) * 255.0 / 2.0 |
| 57 | |
| 58 | |
| 59 | def _gen_buffers(width, height): |