æã¨ã³ãã¬ã ããã©ã¯ã¿ã«åãã¦ç¡éã«ãºã¼ã ããé¢ç©ãæ±ãã
ã¯ããã«
æ±äº¬ãªãªã³ããã¯ã®ã¨ã³ãã¬ã ã«ã¤ãã¦ä¸æ¶çãã£ãããã§ããã詳ãããã¨ã¯ç¥ãã¾ããããã¨ã³ãã¬ã ã®é¢ç©ãè¨ç®ãã¦ããæ¹ããã¦äººç楽ãããã ãªã¨æãã¾ããã
ãã®å§¿å¢ãè¦ç¿ããæ¬è¨äºã§ã¯ã¨ã³ãã¬ã ããã©ã¯ã¿ã«ã£ã½ããã¦ã¿ããã¨ã«ãã¾ããããã«ããã©ã¯ã¿ã«å³å½¢ã¯ç¡éã«ç´°ããå½¢ç¶ã¨ãããã®ã§ãHTML5ã®Canvasãç¨ãã¦ç¡éã«ãºã¼ã ãç¶ããã¢ãã¡ã¼ã·ã§ã³ã製ä½ãã¾ããããã¦æå¾ã«ããããã¦ã§ãããã©ã¯ã¿ã«å³å½¢ã®é¢ç©ãè¨ç®ãã¦ç· ãæ¬ããã¨ã¨ãã¾ãã
åèï¼ãã©ã¯ã¿ã«å³å½¢ã¨ã¯ãå³å½¢ã®é¨åã¨å
¨ä½ãèªå·±ç¸ä¼¼ã«ãªã£ã¦ãããããªãããªã§ã¼ã·ã«çå³å½¢ã®ãã¨ã§ãâ
フラクタル - Wikipedia
ãã©ã¯ã¿ã«å
é
è²ã¯é©å½ã§ããã以ä¸ã®æ¨¡æ§ããã¼ã¹ã«èãã¾ãã
ããã§ã以ä¸ã®2ã¤ã®åã«æ³¨ç®ãã¾ãã
- ãå·¦ä¸ã¨å³ä¸ã®å¼§ãå«ã大ããªå(åå ¨ä½ã¯æ示çã«æããã¦ããªã)ã
- ãå³ä¸ã®èµ¤ãåã
åè ãã大ããªåããå¾è ããå°ããªåãã¨å¼ã¶ãã¨ã«ãã¾ãã
以ä¸ã®å³ã®ããã«ã¨ã³ãã¬ã ã2ã¤ä¸¦ã¹ãå³å´ã®ã¨ã³ãã¬ã ã®ã大ããªåããå·¦å´ã®ã¨ã³ãã¬ã ã®ãå°ããªåãã¨åã大ããã«ãªãããã«å³å´ã®ã¨ã³ãã¬ã ã縮å°ãã¾ãã
ããã¦ã縮å°å¾ã®ã¨ã³ãã¬ã ã®ã大ããªåããå·¦å´ã®ã¨ã³ãã¬ã ã®ãå°ããªåãã«ä¸è´ããããã«é
ç½®ããã¨ã以ä¸ã®ããã«ãªãã¾ããã
ãã®ä½æ¥ãç¡éã«ç¹°ãè¿ãã¨ã以ä¸ã®ãããªãã©ã¯ã¿ã«ï¼çï¼ï¼å³å½¢ãå®æãã¾ãã
ç»è³ªã®é¢ä¿ã§ã¯ã£ããã¨ã¯è¦ãã¾ããããå³ä¸ãç¡éã«ç´°ãããªã£ã¦ãã¾ãã
ç¡éã«ãºã¼ã
ããã¾ã§ã¯ãã©ã¯ã¿ã«åã®æ¹æ³ãç´¹ä»ãã¾ããããã©ã¯ã¿ã«åããã¦ããã®ã§å³ä¸ãç¡éã«ç´°ãããªã£ã¦ããã®ã§ãããã¤ã¡ã¼ã¸ãã¤ãã¿ã«ããã¨æãã®ã§ããã®é¨åãæ¡å¤§ãã¦ããã¢ãã¡ã¼ã·ã§ã³ãä½ãã¾ããç¡éã«ç´°ããã®ã§ãç¡éã«æ¡å¤§ãç¶ãããã¨ãã§ãã¾ãã
ã¢ãã¡ã¼ã·ã§ã³
ç´°ãã説æã¯å¾åãã«ãã¦ãã§ããã¢ãã¡ã¼ã·ã§ã³ã以ä¸ã«è²¼ãä»ãã¾ããã¹ããã§ãåãã¯ãã§ãããã¹ã¯ãã¼ã«ä¸ã¯æ¢ã¾ãã®ã§æ³¨æãã¦ãã ããã
ã¢ãã¡ã¼ã·ã§ã³ã®ä½ãæ¹
ä¸ã®ã¢ãã¡ã¼ã·ã§ã³ãã©ãä½ãã説æãã¾ããé£ã°ãã¦ãçµæ§ã§ãã
(1) ãã©ã¯ã¿ã«ã®æç»
ã¾ãã以ä¸ã®ããã«åº§æ¨ã»ç¹Aï½Jãå®ãã¾ããåç¹ã¯å·¦ä¸ã§ãä¸åããyã»å³åããxã§ããããã¯Canvasã®ããã©ã«ãã ã£ãã¨æãã¾ãã
ãµã¤ãºã¯300ãã¯ã»ã«ã¨ãã¾ãããI, Jã¯å¤§ããªåã®æ¥ç·ã®äº¤ç¹ã§ãã
ãã®ãããªãéè²ï¼é»è²ï¼ç°è²ãã®é åãæãdraw_tokyoé¢æ°ãç¨æãã¾ãã
ããã¦ãdraw_tokyoé¢æ°ã®å¼æ°ã¨ãã¦æ¡å¤§çãã¨ãããã«ããæ¡å¤§çzåãªãå³ä¸(300, 0)ãä¸å¿ã«zåãã座æ¨ããã¨ã«ãéè²ï¼é»è²ï¼ç°è²ãã®é åãæããããã«ãã¾ãã
ãã®æ§ãªæ¡å¤§ï¼ç¸®å°ï¼ã¯ä»¥ä¸ã®åº§æ¨å¤æã«ãã£ã¦å®ç¾ã§ãã¾ãããã®åº§æ¨å¤æã¯é¢æ°zoom_x, zoom_yã«å®è£
ããã¦ãã¾ãã
ããã¦ãdraw_tokyoé¢æ°ã«ãã£ã¦
- æ¡å¤§ç1ã®ãéè²ï¼é»è²ï¼ç°è²ãé å
- æ¡å¤§ç1/sqrt(10)ã®ãéè²ï¼é»è²ï¼ç°è²ãé å
- æ¡å¤§ç1/(sqrt(10))^2ã®ãéè²ï¼é»è²ï¼ç°è²ãé å
- æ¡å¤§ç1/(sqrt(10))^3ã®ãéè²ï¼é»è²ï¼ç°è²ãé å
- â¦â¦
ã¨ç¡éã«æç»ããã°ãã©ã¯ã¿ã«å½¢ç¶ãæç»ã§ãã¾ãï¼ã¾ã ã¢ãã¡ã¼ã·ã§ã³ã§ã¯ãªãï¼ããç¡éã«ãã¨æ¸ãã¾ããããç»é¢ã®ç´°ããã¯æéãªã®ã§å®éã¯æ°åè¡ãã°ååã§ãããã
(2) ã¢ãã¡ã¼ã·ã§ã³
以ä¸ã®ãã©ã¯ã¿ã«å³å½¢ã«ãºã¼ã ã¤ã³ããã¢ãã¡ã¼ã·ã§ã³ãè¡ãã«ã¯ãå
¨ä½ãæ¡å¤§ç1.0ããã«ã¼ã10ã®ç¯å²ã§æ¡å¤§ï¼å³ä¸ãä¸å¿ï¼ãã¦ããã ãã§ããããã°ã©ã ã§ã¯ã°ãã¼ãã«å¤æ°zãæ¡å¤§çã¨ãã¦ãã¾ãã
ã«ã¼ã10ã¨ããã®ã¯ãã大ããåãã¨ãå°ããåãã®åå¾æ¯ã§ãããã©ã¯ã¿ã«ãªã®ã§ã«ã¼ã10åã¾ã§æ¡å¤§ããã°æ¡å¤§åã¨ä¸è´ããã®ããã¤ã³ãã§ãã
(3) ã½ã¼ã¹ã³ã¼ã
以ä¸ã«è²¼ãã¾ãããæ±ãã®ã§ãããããªããã¨ãããã°æ°è»½ã«ã³ã¡ã³ããã ããã
<canvas id="canvas1"></canvas> <script type="text/javascript"> var c1 = document.getElementById("canvas1"); c1.width = 300; c1.height = 300; var ctx = c1.getContext("2d"); // ---------- å¤æ° ---------- // ååºã®åº§æ¨ A = [0.0, 0.0]; B = [0.0, 100.0]; C = [100.0, 0.0]; D = [100.0, 300.0]; E = [200.0, 300.0]; F = [200.0, 0.0]; G = [300.0, 300.0]; H = [300.0, 200.0]; I = [25.0, 25.0]; J = [275.0, 275.0]; K = [250.0, 50.0]; // æ¡å¤§ç var z = 1.0; // ---------- main ---------- function main(){ setInterval(display, 10);// displayãå®æçã«å®è¡ } // å®è¡ main(); // ---------- ãã®ä»ã®é¢æ° ---------- // X座æ¨ãå³ä¸ãä¸å¿ã«æ¡å¤§çzã§æ¡å¤§ããé¢æ° function zoom_x(x, z){ return 300 - z*(300-x); } // Y座æ¨ãå³ä¸ãä¸å¿ã«æ¡å¤§çzã§æ¡å¤§ããé¢æ° function zoom_y(y, z){ return z*y; } // æ¡å¤§çzoomï¼å³ä¸ãä¸å¿ã«ï¼ã§å·¦ä¸ã®éè²ã»å³ä¸ã®ç°è²ã»ä¸å¤®ã®é»ãæç»ããé¢æ° function draw_tokyo(zoom){ // ä¸å¿ã®é»ãé·æ¹å½¢ ctx.beginPath(); ctx.fillStyle = "rgb(20, 20, 20)"; ctx.fillRect(zoom_x(C[0], zoom), zoom_y(C[1], zoom), zoom*(E[0]-C[0]), zoom*(E[1]-C[1])); ctx.fill(); // å·¦ä¸ã®éè²ã®ä¸è§å½¢ã£ã½ãé¨å ctx.beginPath(); ctx.fillStyle = "rgb(230, 180, 30)"; ctx.moveTo(zoom_x(A[0], zoom), zoom_y(A[1], zoom)); ctx.lineTo(zoom_x(B[0], zoom), zoom_y(B[1], zoom)); ctx.arcTo(zoom_x(I[0], zoom), zoom_y(I[1], zoom), zoom_x(C[0], zoom), zoom_y(C[1], zoom), zoom*50.0*Math.sqrt(10)); ctx.lineTo(zoom_x(A[0], zoom), zoom_y(A[1], zoom)); ctx.fill(); // å³ä¸ã®ç°è²ã®ä¸è§å½¢ã£ã½ãé¨å ctx.beginPath(); ctx.fillStyle = "rgb(200, 200, 200)"; ctx.moveTo(zoom_x(G[0], zoom), zoom_y(G[1], zoom)); ctx.lineTo(zoom_x(E[0], zoom), zoom_y(E[1], zoom)); ctx.arcTo(zoom_x(J[0], zoom), zoom_y(J[1], zoom), zoom_x(H[0], zoom), zoom_y(H[1], zoom), zoom*50.0*Math.sqrt(10)); ctx.lineTo(zoom_x(G[0], zoom), zoom_y(G[1], zoom)); ctx.fill(); } function display(){ var dz = 0.005; if (z < Math.sqrt(10)){ z += dz; }else{ z = 1.0;// ã«ã¼ã10åã«ãªã£ããæåã«æ»ã } ctx.clearRect(0, 0, 300, 300);// æ®åãæ¶ã draw_tokyo(z); draw_tokyo(z/Math.sqrt(10)); draw_tokyo(z/(Math.sqrt(10)*Math.sqrt(10))); draw_tokyo(z/(Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10))); draw_tokyo(z/(Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10))); draw_tokyo(z/(Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10)*Math.sqrt(10))); } </script>
é¢ç©ããã¨ãã
ãã¨ãã¨ã®é¢ç©
以ä¸ã®è¨äºã«ããã°ãä¸è¾ºã2aã¨ãã¦ãä¸å¤®ã®é»ãé·æ¹å½¢ã®é¢ç©ã
å·¦ä¸ã®éè²é¨ã¨å³ä¸ã®ç°è²é¨ã®åè¨ã
å³ä¸ã®èµ¤ãåã
ã¨ãªã£ã¦ãã¾ããtogetter.com
ãã©ã¯ã¿ã«åããå ´åã以ä¸ã®å³ãã大ããåã¨å°ããåã®åå¾æ¯ã1:ã«ã¼ã10ãªã®ã§ãé¢ç©æ¯ã¯1:10ã¨ãªãã¾ãã
ãã¨ã®ãéè²é¨+ç°è²é¨+é»è²é¨ãã®é¢ç©ãxã¨ããã°ããã©ã¯ã¿ã«åå¾ã®é¢ç©ã¯
ã¨ãªãã¾ããç¡éçæ¯ç´æ°ã®åã®å
¬å¼ãããããã¯
ããã§ãxã¯ãéè²é¨+ç°è²é¨+é»è²é¨ãã®é¢ç©ãªã®ã§
ã¨ãªãããã©ã¯ã¿ã«åãããã¨ã³ãã¬ã ã®é¢ç©ã¯å¼(1)ã«å¼(2)ã代å
¥ãããã¨ã§
ã¨æ±ãããã¾ãããã§ãããã§ããã