Outils pour utilisateurs

Outils du site


fractale_de_lyapunov

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
fractale_de_lyapunov [2019/11/17 05:05] – [C++] Mushussufractale_de_lyapunov [2020/04/07 16:53] (Version actuelle) Mushussu
Ligne 3: Ligne 3:
 ===== C++ ===== ===== C++ =====
 <code c++> <code c++>
 +// Compilation : g++ Lyapunov.cpp -o Lyapunov
 +// Execution   : ./Lyapunov "AB" 1.8 2.2 3.6 4.0 200 200 2000 -1
 +
 #include <fstream> #include <fstream>
 #include <iostream> #include <iostream>
Ligne 29: Ligne 32:
         return 0;         return 0;
     }     }
 +    // Initialisation des constantes
     sequence = argv[1];     sequence = argv[1];
     for (int i = 0; i < 4; i++) {     for (int i = 0; i < 4; i++) {
Ligne 37: Ligne 41:
     iteration = stoi(argv[8]);     iteration = stoi(argv[8]);
     limite = stof(argv[9]);     limite = stof(argv[9]);
 +
     time_t debut, fin;     time_t debut, fin;
     time(&debut);     time(&debut);
 +
     float  tableau[iteration];     float  tableau[iteration];
     tableau[0]= 0.5;     tableau[0]= 0.5;
Ligne 54: Ligne 60:
         bValeur[i] = proportion(i, 0, hauteur, bornes[2], bornes[3]);         bValeur[i] = proportion(i, 0, hauteur, bornes[2], bornes[3]);
     }     }
 +
 +    // Formation du nom du fichier
     string nom  =  "Lyapunov_" + sequence;     string nom  =  "Lyapunov_" + sequence;
     for (int i = 0; i < 4; i++) {     for (int i = 0; i < 4; i++) {
Ligne 64: Ligne 72:
     }     }
     nom += ".pgm";     nom += ".pgm";
 +
 +    // Création de l'image
     ofstream image(nom);     ofstream image(nom);
     image << "P2" << endl;     image << "P2" << endl;
Ligne 90: Ligne 100:
         }         }
     }     }
 +
 +
     time(&fin);     time(&fin);
     cout << "Durée = " << difftime(fin, debut) << endl;     cout << "Durée = " << difftime(fin, debut) << endl;
Ligne 95: Ligne 107:
     system(fonction.c_str());     system(fonction.c_str());
     return 0;     return 0;
 +}
 +</code>
 +
 +====== Processing =====
 +<code java>
 +
 +int iteration = 20000;
 +int valMin = 0;
 +
 +void setup() {
 +size(200, 200);
 +}
 +
 +void draw() {
 +println(hour() + ":" + minute() + ":" + second());
 +loadPixels();
 +for (int i = 0; i < width; i++) {
 + for (int j = 0; j < height; j++) {
 +   float a = map(i, 0, width, 1.8, 2.2);
 +   float b = map(j, 0, height, 3.6,4);
 +   float seq[] = {a, a, a, a, b, b, b, b, b,b ,b , b,b , b, b, b, b, b, b, b}; // AAABBBBBAB
 +   float[]  A = new float[iteration];
 +   A[0]= 0.5;
 +   for (int k = 1; k < iteration; k++) {
 +     A[k] = seq[k % seq.length] * A[k - 1] * (1 - A[k - 1]);
 +   }
 +   float exposant = 0;
 +   for (int k = 1; k < iteration; k++) {
 +     exposant += log(abs(seq[k % seq.length] * (1 - 2 * A[k])));
 +   }
 +   exposant = exposant / iteration;
 +
 +   int c;
 +   if ((exposant > 0) || (exposant < -1)) {
 +     c = 0;
 +   } else {
 +     c = floor(map(exposant, 0, -1, 255, 0));
 +   }
 +   pixels[i + j * width] = color(c);
 + }
 +}
 +updatePixels();
 +saveFrame("Lyapunov" + "-" + year() + "-" + month() + "-" + day() + "-" + hour() + "-" + minute() + "-" + second() + ".png");
 +println(hour() + ":" + minute() + ":" + second());
 +exit(); 
 } }
 </code> </code>
 ===== Liens ===== ===== Liens =====
-https://solarianprogrammer.com/2018/11/19/cpp-reading-writing-bmp-images/+[[https://solarianprogrammer.com/2018/11/19/cpp-reading-writing-bmp-images|C++ lire et écrire des images BMP]]
  
-https://danielbeard.wordpress.com/2011/06/06/image-saving-code-c/+[[https://danielbeard.wordpress.com/2011/06/06/image-saving-code-c|C++ Ecrire une image TGA]]
  
  
 === PPM === === PPM ===
-https://www.youtube.com/watch?v=fbH005SzEMc+[[https://www.youtube.com/watch?v=fbH005SzEMc|C++ Tuto vidéo écrire une image PPM]]
  
-https://www.scratchapixel.com/lessons/digital-imaging/simple-image-manipulations +[[https://www.scratchapixel.com/lessons/digital-imaging/simple-image-manipulations|Manipulation d'images simples]] 
-{{tag>c++ sylvain}}+{{tag>c++ Processing sylvain}}
fractale_de_lyapunov.1573967106.txt.gz · Dernière modification : 2019/11/17 05:05 de Mushussu