2011-08-04から1日間の記事一覧

コッホ曲線

コッホ曲線を描いてみました <html> <body> <canvas id="koch" height=600px width=800px></canvas> <script> window.onload = function() { var canvas = document.getElementById("koch"); var ctx = canvas.getContext("2d"); function drawKoch(stack, x, y, s, L) { if(L <= 1) { ctx.moveTo(x, y); ctx.lineTo(x + L*Math.cos(s),</body></html>…