Mandelbrot mit JSXGraph

Aus Wiki1

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
 
(Der Versionsvergleich bezieht 8 dazwischenliegende Versionen mit ein.)
Zeile 1: Zeile 1:
-
<jsxgraph box="jxgbox" width="800" height="700">
+
<jsxgraph box="jxgbox" width="600" height="700">
   
   
     const board = JXG.JSXGraph.initBoard('jxgbox', {
     const board = JXG.JSXGraph.initBoard('jxgbox', {
Zeile 20: Zeile 20:
   });
   });
-
  // Slider für Formel
 
-
  const sliderPotx = board.create('slider', [[-2.3, 1.1], [0.5, 1.1], [2, 2, 3]], {
 
-
    name:'Potenz x',
 
-
    snapWidth:0.1
 
-
  });
 
-
  // Slider für Formel
 
-
  const sliderPoty = board.create('slider', [[-2.3, 1.00], [0.5, 1.0], [2, 2, 3]], {
 
-
    name:'Potenz y',
 
-
    snapWidth:0.1
 
-
  });
 
   // Canvas ins DOM hängen
   // Canvas ins DOM hängen
   const div = document.getElementById('jxgbox');
   const div = document.getElementById('jxgbox');
   const canvas = document.createElement('canvas');
   const canvas = document.createElement('canvas');
-
   canvas.width = 800;
+
   canvas.width = 600;
   canvas.height = 600;
   canvas.height = 600;
   canvas.style.position = 'absolute';
   canvas.style.position = 'absolute';
Zeile 46: Zeile 36:
     let x = 0, y = 0, iter = 0;
     let x = 0, y = 0, iter = 0;
     while (x*x + y*y <= 4 && iter < maxIter) {
     while (x*x + y*y <= 4 && iter < maxIter) {
-
       const xtemp = Math.pow(x,sliderPotx.Value()) - Math.pow(y,sliderPoty.Value()) + cx;
+
       const xtemp = x*x - y*y + cx;
       y = 2*x*y + cy;
       y = 2*x*y + cy;
       x = xtemp;
       x = xtemp;
Zeile 102: Zeile 92:
   sliderIter.on('drag', update);
   sliderIter.on('drag', update);
   sliderZoom.on('drag', update);
   sliderZoom.on('drag', update);
-
  sliderPotx.on('drag', update);
+
 
-
  sliderPoty.on('drag', update);
+
   // Panning mit Maus
   // Panning mit Maus

Aktuelle Version vom 14:08, 22. Dez. 2025

Mit den Schiebereglern können Iterations-Tiefe und Zoom gesteuert werden. Mit der Maus+linke Maustaste kann der Bildausschnitt verschoben werden.

Persönliche Werkzeuge