Vous êtes sur la page 1sur 8

#fract-ol

Lissage des couleurs avec le log


#include <stdio.h>

#include <math.h>

#define MAX_COLORS 256

// Tableau de couleurs originales

unsigned char colors[MAX_COLORS];

// Tableau de couleurs lissées

unsigned char smooth_colors[MAX_COLORS];

int main() {

// Remplissage du tableau de couleurs

for (int i = 0; i < MAX_COLORS; i++) {

colors[i] = i;

// Lissage des couleurs en utilisant la fonction logarithme

for (int i = 0; i < MAX_COLORS; i++) {

smooth_colors[i] = log(colors[i] + 1) / log(MAX_COLORS) * MAX_COLORS;

return 0;

Changement de l'axe
|________|________|_______|_______+x (WIDTH) 500

+y (HEIGHT) 500

+y 1.5

________|________|________|________+x 1.5

On part donc de zi = −1.5 + i1.5 pour arriver jusqu'à zf = 1.5 − i1.5

Donc :
z.x = -1.5 + (pix.x / (WIDTH / 3));

z.y = 1.5 - (pix.y / (HEIGHT / 3));

double range = 1.5;

z.x = ((pix.x / (WIDTH / (range * 2))) - range) * WIDTH / HEIGHT;

z.y = range - (pix.y / (HEIGHT / (range * 2)));

c.x = -0.4
c.y = 0.6
range = 2
zoom = 0
IMAX color = 0x00000000
Derive color = 0x00a2dcc7 * i / 10000

c.x = -0.4
c.y = 0.6
range = 2
zoom = 0
IMAX color = 0x0068c2d3
Derive color = 0x00a2dcc7 * i / 10000
c.x = 1.6180339887498948482 - 2
c.y = 1.6180339887498948482 - 1
range = 2
zoom = 0
IMAX color = 0x0068c2d3
Derive color = 0x0DC6700 * i / 10000000

Agrandissement
+y 2

________|________|________|________+x 2

On part donc de zi = −2 + i2 pour arriver jusqu'à zf = 2 − i2

range * 0.5

+y 1

_________________|________________+x 1

On part donc de zi = −1 + i1 pour arriver jusqu'à zf = 1 − i1


+y 2

.x = -1 |

y = 1 |

-2 |
________________|________________|+x 0

On part donc de zi = −2 + i2 pour arriver jusqu'à zf = 0 − i0


+y 1

-1 |
_________________________________|+x 0

On part donc de zi = −1 + i1 pour arriver jusqu'à zf = 0 − i0

Vous aimerez peut-être aussi