0.02)||(abs($y_pt-$y_pt2)>0.02)) {$dep=mt_rand(0,100);$x_pt=$x_pt2;$y_pt=$y_pt2; if ($dep<=$lim1) {$x_pt2=$a1*$x_pt+$b1*$y_pt+$c1;$y_pt2=$d1*$x_pt+$e1*$y_pt+$f1;} else {if ($dep<=$lim2) {$x_pt2=$a2*$x_pt+$b2*$y_pt+$c2;$y_pt2=$d2*$x_pt+$e2*$y_pt+$f2;} else {if ($dep<=$lim3) {$x_pt2=$a3*$x_pt+$b3*$y_pt+$c3;$y_pt2=$d3*$x_pt+$e3*$y_pt+$f3;} else {if ($dep<=$lim4) {$x_pt2=$a4*$x_pt+$b4*$y_pt+$c4;$y_pt2=$d4*$x_pt+$e4*$y_pt+$f4;} else {$x_pt2=$a5*$x_pt+$b5*$y_pt+$c5;$y_pt2=$d5*$x_pt+$e5*$y_pt+$f5;}}}} imagesetpixel($image,20+$x_dep+50*$x_pt2,580-$y_dep-50*$y_pt2,$col2); }} function faire_image($nbessais) {global $x_pt,$y_pt,$num,$image,$col2; $image=imagecreate(600,600); $col_fond = ImageColorAllocate($image, 200,200,200); $col1 = ImageColorAllocate($image,255,255,255); $col2 = ImageColorAllocate($image,255,0,0); $col3 = ImageColorAllocate($image,0,255,0); imagefill($image,0, 0,$col_fond); imagefilledrectangle ($image,20,20,580,580,$col1); for ($j=1;$j<=$nbessais;$j++) {$x_pt=10;$y_pt=10;position();} ImagePng($image); } function faire_page() {global $nbessais,$a1,$b1,$c1,$d1,$e1,$f1,$p1,$a2,$b2,$c2,$d2,$e2,$f2,$p2; global $a3,$b3,$c3,$d3,$e3,$f3,$p3,$a4,$b4,$c4,$d4,$e4,$f4,$p4,$x_dep,$y_dep; global $a5,$b5,$c5,$d5,$e5,$f5,$p5,$option; echo "
Exemples inspirés de Fractals for the Classroom par Peitgen, Jürgens et Saupe\n"; echo ""; } if (isset($_GET["action"])) $action = $_GET["action"]; else $action = "niv"; if (isset($_GET["option"])) $option = $_GET["option"]; else $option = "fougere"; if (isset($_GET["nbessais"])) $nbessais = $_GET["nbessais"]; if (isset($_GET["x_dep"])) $x_dep = $_GET["x_dep"]; if (isset($_GET["y_dep"])) $y_dep = $_GET["y_dep"]; if (isset($_GET["a1"])) $a1 = $_GET["a1"]; if (isset($_GET["b1"])) $b1 = $_GET["b1"]; if (isset($_GET["c1"])) $c1 = $_GET["c1"]; if (isset($_GET["d1"])) $d1 = $_GET["d1"]; if (isset($_GET["e1"])) $e1 = $_GET["e1"]; if (isset($_GET["f1"])) $f1 = $_GET["f1"]; if (isset($_GET["p1"])) $p1 = $_GET["p1"]; if (isset($_GET["a2"])) $a2 = $_GET["a2"]; if (isset($_GET["b2"])) $b2 = $_GET["b2"]; if (isset($_GET["c2"])) $c2 = $_GET["c2"]; if (isset($_GET["d2"])) $d2 = $_GET["d2"]; if (isset($_GET["e2"])) $e2 = $_GET["e2"]; if (isset($_GET["f2"])) $f2 = $_GET["f2"]; if (isset($_GET["p2"])) $p2 = $_GET["p2"]; if (isset($_GET["a3"])) $a3 = $_GET["a3"]; if (isset($_GET["b3"])) $b3 = $_GET["b3"]; if (isset($_GET["c3"])) $c3 = $_GET["c3"]; if (isset($_GET["d3"])) $d3 = $_GET["d3"]; if (isset($_GET["e3"])) $e3 = $_GET["e3"]; if (isset($_GET["f3"])) $f3 = $_GET["f3"]; if (isset($_GET["p3"])) $p3 = $_GET["p3"]; if (isset($_GET["a4"])) $a4 = $_GET["a4"]; if (isset($_GET["b4"])) $b4 = $_GET["b4"]; if (isset($_GET["c4"])) $c4 = $_GET["c4"]; if (isset($_GET["d4"])) $d4 = $_GET["d4"]; if (isset($_GET["e4"])) $e4 = $_GET["e4"]; if (isset($_GET["f4"])) $f4 = $_GET["f4"]; if (isset($_GET["p4"])) $p4 = $_GET["p4"]; if (isset($_GET["a5"])) $a5 = $_GET["a5"]; if (isset($_GET["b5"])) $b5 = $_GET["b5"]; if (isset($_GET["c5"])) $c5 = $_GET["c5"]; if (isset($_GET["d5"])) $d5 = $_GET["d5"]; if (isset($_GET["e5"])) $e5 = $_GET["e5"]; if (isset($_GET["f5"])) $f5 = $_GET["f5"]; if (isset($_GET["p5"])) $p5 = $_GET["p5"]; if ($option!="libre") {switch($option) {case "fougere": $a1=0;$b1=0;$c1=0;$d1=0;$e1=0.16;$f1=0;$p1=0.01; $a2=0.85;$b2=0.04;$c2=0;$d2=-0.04;$e2=0.85;$f2=1.6;$p2=0.85; $a3=0.2;$b3=-0.26;$c3=0;$d3=0.23;$e3=0.22;$f3=1.6;$p3=0.07; $a4=-0.15;$b4=0.28;$c4=0;$d4=0.26;$e4=0.24;$f4=0.44;$p4=0.07; $a5=0;$b5=0;$c5=0;$d5=0;$e5=0;$f5=0;$p5=0; $x_dep=300;$y_dep=0;$nbessais=100;break; case "triangle": $a1=0;$b1=-0.5;$c1=5;$d1=0.5;$e1=0;$f1=0;$p1=0.33; $a2=0;$b2=0.5;$c2=5;$d2=-0.5;$e2=0;$f2=5;$p2=0.33; $a3=0.5;$b3=0;$c3=2.5;$d3=0;$e3=0.5;$f3=5;$p3=0.34; $a4=0;$b4=0;$c4=0;$d4=0;$e4=0;$f4=0;$p4=0; $a5=0;$b5=0;$c5=0;$d5=0;$e5=0;$f5=0;$p5=0; $x_dep=30;$y_dep=0;$nbessais=50;break; case "sierpinski": $a1=0.5;$b1=0;$c1=0;$d1=0;$e1=0.5;$f1=0;$p1=0.33; $a2=0.5;$b2=0;$c2=5;$d2=0;$e2=0.5;$f2=0;$p2=0.33; $a3=0.5;$b3=0;$c3=0;$d3=0;$e3=0.5;$f3=5;$p3=0.34; $a4=0;$b4=0;$c4=0;$d4=0;$e4=0;$f4=0;$p4=0; $a5=0;$b5=0;$c5=0;$d5=0;$e5=0;$f5=0;$p5=0; $x_dep=30;$y_dep=30;$nbessais=50;break; case "buisson": $a1=0.387;$b1=0.430;$c1=2.6;$d1=0.43;$e1=-0.387;$f1=5.22;$p1=0.33; $a2=0.441;$b2=-0.091;$c2=4.2;$d2=-0.009;$e2=-0.322;$f2=5.1;$p2=0.33; $a3=-0.468;$b3=0.02;$c3=4;$d3=-0.113;$e3=0.015;$f3=4;$p3=0.34; $a4=0;$b4=0;$c4=0;$d4=0;$e4=0;$f4=0;$p4=0; $a5=0;$b5=0;$c5=0;$d5=0;$e5=0;$f5=0;$p5=0; $x_dep=30;$y_dep=0;$nbessais=50;break; case "cristal": $a1=0.255;$b1=0;$c1=3.726;$d1=0;$e1=0.255;$f1=6.74;$p1=0.25; $a2=0.255;$b2=0;$c2=1.146;$d2=0;$e2=0.255;$f2=2.232;$p2=0.25; $a3=0.255;$b3=0;$c3=6.306;$d3=0;$e3=0.255;$f3=2.232;$p3=0.25; $a4=0.37;$b4=-0.642;$c4=6.356;$d4=0.642;$e4=0.37;$f4=-0.06;$p4=0.25; $a5=0;$b5=0;$c5=0;$d5=0;$e5=0;$f5=0;$p5=0; $x_dep=30;$y_dep=0;$nbessais=100;break; case "pentagone": $a1=0.382;$b1=0;$c1=3.072;$d1=0;$e1=0.382;$f1=6.19;$p1=0.2; $a2=0.382;$b2=0;$c2=6.033;$d2=0;$e2=0.382;$f2=4.044;$p2=0.2; $a3=0.382;$b3=0;$c3=0.139;$d3=0;$e3=0.382;$f3=4.044;$p3=0.2; $a4=0.382;$b4=0;$c4=1.253;$d4=0;$e4=0.382;$f4=0.595;$p4=0.2; $a5=0.382;$b5=0;$c5=4.920;$d5=0;$e5=0.382;$f5=0.595;$p5=0.2; $x_dep=30;$y_dep=0;$nbessais=50;break; case "arbre": $a1=0.195;$b1=-0.488;$c1=4.431;$d1=0.344;$e1=0.443;$f1=2.452;$p1=0.2; $a2=0.462;$b2=0.414;$c2=2.511;$d2=-0.252;$e2=0.361;$f2=5.692;$p2=0.2; $a3=-0.058;$b3=-0.07;$c3=5.976;$d3=0.453;$e3=-0.111;$f3=0.969;$p3=0.2; $a4=-0.035;$b4=0.07;$c4=4.884;$d4=-0.469;$e4=-0.022;$f4=5.069;$p4=0.2; $a5=-0.637;$b5=0;$c5=8.562;$d5=0;$e5=0.501;$f5=2.513;$p5=0.2; $x_dep=30;$y_dep=0;$nbessais=100;break; }} if ($action=="img") {faire_image($nbessais);} else {faire_page();} ?>