Outils pour utilisateurs

Outils du site


figure_de_lichtenberg

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
figure_de_lichtenberg [2019/11/18 01:10] Mushussufigure_de_lichtenberg [2021/04/21 10:48] (Version actuelle) – [Figures de Lichtenberg] Mushussu
Ligne 1: Ligne 1:
 ====== Figures de Lichtenberg ====== ====== Figures de Lichtenberg ======
  
-https://en.wikipedia.org/wiki/Lichtenberg_figure+Définition sur [[https://en.wikipedia.org/wiki/Lichtenberg_figure|Wikipedia]] 
 En mode analogique : En mode analogique :
-https://youtu.be/1jhqZg8UBJU?t=145+ 
 +[[https://youtu.be/1jhqZg8UBJU?t=145|Dangerous! Electrifying Woodworking!]]
  
 Sinon d’autres renseignements : Sinon d’autres renseignements :
-http://capturedlightning.com/frames/lichtenbergs.html+ 
 +[[http://capturedlightning.com/frames/lichtenbergs.html|What are Lichtenberg figures, and how do we make them?]] 
 + 
 +[[https://images.wur.nl/digital/collection/coll13/search/page/1|Système racinaire]]
  
 ==== Illustration ==== ==== Illustration ====
  
-{{:hydrographie_france.jpg?400|}}+{{media_07:hydrographie_france.jpg?400|}}
  
 ==== Théorie ==== ==== Théorie ====
  
-http://paulbourke.net/fractals/dla/+[[http://paulbourke.net/fractals/dla/|DLA - Diffusion Limited Aggregation]]
  
 ===== Simulation ===== ===== Simulation =====
  
 ==== Résultat ==== ==== Résultat ====
-{{:dla-002986.png?400|}}+{{media_03:dla-002986.png?400|}}
 ==== Processing ==== ==== Processing ====
 <code java> <code java>
Ligne 146: Ligne 151:
  
 ==== Processing 3D ==== ==== Processing 3D ====
-<code java> 
  
 +Voici le code avec exportation .png et .stl :
 +<code java>
 +import java.io.*;
 import peasy.PeasyCam; import peasy.PeasyCam;
  
 PeasyCam cam; PeasyCam cam;
 +File repertoire;
 +
  
 ArrayList<Marcheur> arbre; ArrayList<Marcheur> arbre;
 ArrayList<Marcheur> marcheurs; ArrayList<Marcheur> marcheurs;
-int nombreMarcheurs = 2000;+int nombreMarcheurs = 1000;
 int limite = 800; int limite = 800;
 int rangMax = 0; int rangMax = 0;
Ligne 170: Ligne 179:
 public void setup() { public void setup() {
   cam = new PeasyCam(this, 400);   cam = new PeasyCam(this, 400);
 +    repertoire = new File(sketchPath());
 +
 } }
  
Ligne 200: Ligne 211:
     }     }
   }   }
-  affichageArbre();+  affichageArbre(arbre);
   if (marcheurs.size() == 0) {   if (marcheurs.size() == 0) {
     println(rangMax);     println(rangMax);
Ligne 206: Ligne 217:
 } }
  
-void affichageArbre() {+void affichageArbre(ArrayList<Marcheur> a) {
   background(0);   background(0);
-  for (int j = 1; j < arbre.size(); j++) { +  for (int j = 1; j < a.size(); j++) { 
-    Marcheur ma1 = arbre.get(j);+    Marcheur ma1 = a.get(j);
     Marcheur ma2 = ma1.parent;     Marcheur ma2 = ma1.parent;
     stroke(255);     stroke(255);
Ligne 221: Ligne 232:
     saveFrame("images/DLA3D-######.png");     saveFrame("images/DLA3D-######.png");
   }   }
 +  if (key == 'e') {
 +    exporterSTL(arbre);
 +  }
 +}
 +
 +void exporterSTL(ArrayList<Marcheur> a) {
 +  String ligne = "[";
 +    for (int j = 1; j < a.size(); j++) {
 +      if (j != 1) {
 +        ligne += ",";
 +      }
 +      Marcheur ma1 = a.get(j);
 +      Marcheur ma2 = ma1.parent;
 +      String p1 = "[" + ma1.position.x + "," + ma1.position.y + "," + ma1.position.z + "]";
 +      String p2 = "[" + ma2.position.x + "," + ma2.position.y + "," + ma2.position.z + "]";
 +      ligne += "[[" + p1 + "," + ma1.rayon / 3.5 + "]," + "[" + p2 + "," + ma2.rayon / 3.5 + "]]";
 +    }
 +    ligne += "]";
 +    println(ligne);
 +    String[] cmd = {"/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD", 
 +      "-o", 
 +      "Arbre.stl", 
 +      "-D", 
 +      "u = " + ligne, 
 +      "Arbre.scad"};
 +      
 +    Process p;
 +    try {
 +      p = Runtime.getRuntime().exec(cmd, new String[0], repertoire);
 +      p.waitFor();
 +      float error = p.exitValue();
 +      println("Erreur = " + error);
 +    } 
 +    catch (InterruptedException e) {
 +      e.printStackTrace();
 +    } 
 +    catch (IOException e) {
 +      e.printStackTrace();
 +    }
 } }
  
Ligne 272: Ligne 322:
   float dz = b.z - a.z;   float dz = b.z - a.z;
   return dx * dx + dy * dy + dz * dz;   return dx * dx + dy * dy + dz * dz;
 +}
 +</code>
 +
 +Pour la partie OpenSACD de l'exportation .stl :
 +<code c>
 +$fn = 15;
 +
 +u = [[[[10, 10, 10], 30], [[30, 20, 40], 20]], [[[30, 20, 40], 20], [[60, 30, 45], 10]]];
 +
 +for (i = [0:len(u) - 1]) {
 +    element(u[i]);
 +}
 +
 +module element(e) {
 +    a = e[0];
 +    b = e[1];
 +    hull() {
 +        translate(a[0]) sphere(d = a[1]);
 +        translate(b[0]) sphere(d = b[1]);
 +    }
 } }
 </code> </code>
Ligne 277: Ligne 347:
 === Heightmap === === Heightmap ===
  
-https://forum.processing.org/two/discussion/25167/fly-over-a-heightmap-generated-landscape+[[https://forum.processing.org/two/discussion/25167/fly-over-a-heightmap-generated-landscape|v]]
  
 === Agrégation limitée par la diffusion (DLA) === === Agrégation limitée par la diffusion (DLA) ===
  
-https://medium.com/@jason.webb/simulating-dla-in-js-f1914eb04b1d+[[https://medium.com/@jason.webb/simulating-dla-in-js-f1914eb04b1d|Simulating 2D diffusion-limited aggregation (DLA) with JavaScript]]
  
-https://thecodingtrain.com/CodingChallenges/034-dla.html+[[https://thecodingtrain.com/CodingChallenges/034-dla.html|Diffusion-Limited Aggregation]]
  
-https://www.openprocessing.org/sketch/460864+[[https://www.openprocessing.org/sketch/460864|Challenge #34: Diffusion-Limited Aggregation]]
  
-{{tag>processing sylvain}}+{{tag> processing sylvain}}
figure_de_lichtenberg.1574039450.txt.gz · Dernière modification : 2019/11/18 01:10 de Mushussu