ããªã»ã¤ã³ã»ã³æ©æ§ãHTML5 Canvasã§ã¢ãã¡ã¼ã·ã§ã³ã«
ã¯ããã«
ãªã©ã³ãã®ã¢ã¼ãã£ã¹ãã§ããTheo Jansen(ããªã»ã¤ã³ã»ã³)æ°ã¯ã風åã«ãã£ã¦æ©è¡ãã巨大ãªèãã¹ãã©ã³ããã¼ã¹ãããã¤ãã£ããã¨ã§æåã§ãããã¹ãã©ã³ããã¼ã¹ããã«ã¯ç¹æ®ãªãªã³ã¯æ©æ§(Jansen's Linkage)ãç¨ãããã¦ãããããã«ãã£ã¦é¢¨åã«ããå転éåãçç©ã®ããã«çãçãã¨ããèã®åãã«å¤æãã¦ãã¾ãã
Theo Jansen Japan
Jansen's linkage - Wikipedia, the free encyclopedia
以ä¸ã®ãããªçµã¿ç«ã¦ããããçºå£²ããã¦ãã¾ããç§ãæã£ã¦ãã¾ãã楽ããã§ãã
大人ã®ç§å¦ãã¬ã¸ã³ Vol.30 (ããªã»ã¤ã³ã»ã³ã®ãããã¼ã¹ã) (Gakken Mook)
- ä½è : 大人ã®ç§å¦ãã¬ã¸ã³ç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: å¦ç¿ç 究社
- çºå£²æ¥: 2011/01/14
- ã¡ãã£ã¢: ã ãã¯
- è³¼å ¥: 13人 ã¯ãªãã¯: 267å
- ãã®ååãå«ãããã° (37件) ãè¦ã
ãã®åããã¢ãã¡ã¼ã·ã§ã³ã«ãã¦ã¿ããã¨ããã®ãä»åã®ãã¼ãã§ãã
ä¸è¨è¨äºã¨åæ§ã«HTML5 Canvasãç¨ãããã©ã¦ã¶ä¸ã§åãããã«ãã¾ãã
ã¤ã³ã»ã³ã®ãªã³ã¯æ©æ§
ã¤ã³ã»ã³ã®ãªã³ã¯æ©æ§ã¯ä»¥ä¸ã®ãããªæ§é ã«ãªã£ã¦ãã¾ã(å³ã¯ç足ã®ã¿)ãé»åããªã³ã¯ã®ååa~i, éåãç¹ã®ååA~Gã表ããç·è²ã¯è£å©ç·ã§ããåãªã³ã¯ã®é·ãã¯æ±ºã¾ã£ã¦ãã¦ãWikipediaãªã©ã§ã¿ããã¨ãã§ããã¨æãã¾ããæ¬è¨äºæ«å°¾ã®ã½ã¼ã¹ã³ã¼ãã«ãå®ç¾©ããã¦ãã¾ãã
ç¹Oã¨ç¹Bã¯åºå®ããã¦ãããç¹Oã¾ããã«ãªã³ã¯m(ç·åOA)ãå転ããã®ã«å¿ãã¦å
¨ä½ãåãããã«ãªã£ã¦ãã¾ãã
ã¢ãã¡ã¼ã·ã§ã³
ã¢ãã¡ã¼ã·ã§ã³ã¯ä»¥ä¸ã®æé ã«ãã£ã¦è¡ããã¨ãã§ãã¾ãã
- 座æ¨ç³»ã®åç¹ãç¹Oã¨ãã
- ãªã³ã¯m(ç·åOA)ã®è§åº¦Îã決ãã
- Îã«å¿ãã¦ç¹Aã®åº§æ¨ã決ã¾ããé å¼µã£ã¦è¨ç®ããã°ä»ã®ç¹ã®åº§æ¨ãæ±ã¾ã
- ä¸è¨ã®åº§æ¨ã«å¿ãã¦ãªã³ã¯ãæç»
- è§åº¦Îãå°ãå¢å ããã3ã«æ»ãï¼ã«ã¼ãï¼
ä¸è¨ã®ãé å¼µã£ã¦è¨ç®ããã°ãã¨ããã¨ãããæ²è
ã§ããç§ã¯é å¼µã£ã¦è¨ç®ãã¾ããããå³è§£ããã®ã¯å¤§å¤ãããªã®ã§ä»å¾æéãããã°è¿½è¨ãã¾ãâ¦
ä½å¼¦å®çã¨ãã®é«æ ¡æ°å¦ã使ãã¾ãã
追è¨ï¼è©³ç´°èª¬æã®è¨äºã追å ãã¾ããã
テオ・ヤンセン機構の計算【詳細版】 - roombaの日記
å ã»ã©ã®å³ã¯ç足ã®ã¿ã§ããããå³ã®å³å´ã«ãåæ§ã®è¨ç®ããå対å´ã®èããããã¨ãã§ãã¾ããããã«ãä½ç¸ã120°ãã¤ãããã¦3ãã¢ã®èãåæã«æç»ããã¨ä»¥ä¸ã®ãããªã¢ãã¡ã¼ã·ã§ã³ãå¾ããã¾ãã
æ©ãã¦ãï¼
ã½ã¼ã¹ã³ã¼ã
æ±ãã½ã¼ã¹ã³ã¼ãã以ä¸ã«ç¤ºãã¾ãã
ãé å¼µã£ã¦è¨ç®ãã®å
容ãdraw_jansené¢æ°ã«è©°ãè¾¼ã¾ãã¦ããã®ã§ããã大å¤ãªã®ã§è§£èªã¯ãã¾ããããããã¾ããã
èªç±ã«ãå©ç¨ãã ããã
<canvas id="canvas1"></canvas> <script type="text/javascript"> var c1 = document.getElementById("canvas1"); c1.width = 350; c1.height = 300; var ctx = c1.getContext("2d"); // ---------- å¤æ° ---------- // ãªã³ã¯ã®é·ã var a = 38;ããvar b = 41.5; var c = 39.3;ãvar d = 40.1; var e = 55.8;ãvar f = 39.4; var g = 36.7;ãvar h = 65.7; var i = 49;ããvar j = 50; var k = 61.9;ãvar l = 7.8; var m = 15; // åç¹ã®åº§æ¨ var O = [0.0, 0.0];ãvar A = [0.0, 0.0]; var B = [-a, -l];ããvar C = [0.0, 0.0]; var D = [0.0, 0.0];ãvar E = [0.0, 0.0]; var F = [0.0, 0.0];ãvar G = [0.0, 0.0]; // ååç¯ã®è§åº¦(ãããæéã¨ã¨ãã«å¤å) var theta = 0; // ---------- main ---------- function main(){ setInterval(display, 10);// displayãå®æçã«å®è¡ } // å®è¡ main(); // ---------- ãã®ä»ã®é¢æ° ---------- // (x1, y1)ãã(x2, y2)ã«ç·ãå¼ãé¢æ° function draw_link(x1, y1, x2, y2){ ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(1.5*x1+175, -1.5*y1+150);// æ¬å½ã¯æ¬å¼§å ã(x1, y1)ã¨ããããã©ãæç»é åã»åãã»å¤§ããã®é½å㧠ctx.lineTo(1.5*x2+175, -1.5*y2+150);// ä¸ã®è¡ã¨åæ§ ctx.closePath(); ctx.stroke(); } // ååç¯mã®è§åº¦ããã¨ã«ãªã³ã¯æ©æ§ãæç»ããé¢æ° // 第äºå¼æ°signã«+1ã-1ãããããã¨ã§ãç»é¢å·¦å´orå³å´ã®ã©ã¡ãã®èãæç»ãããé¸æ function draw_jansen(theta, sign){ var theta_ab, theta_bc, theta_de, theta_df; var xc, yc; var AB, DE; // link j,b AB = Math.sqrt( (a+A[0])*(a+A[0]) + (l+A[1])*(l+A[1]) ); xc = (AB*AB + b*b - j*j) / (2.0*AB); yc = Math.sqrt( b*b - xc*xc ); theta_ab = Math.atan2(A[1]-B[1], A[0]-B[0]); C[0] = -a + xc*Math.cos(theta_ab) + yc*Math.cos(theta_ab+Math.PI/2); C[1] = -l + xc*Math.sin(theta_ab) + yc*Math.sin(theta_ab+Math.PI/2); draw_link(sign*A[0], A[1], sign*C[0], C[1]);// link j draw_link(sign*B[0], B[1], sign*C[0], C[1]);// link b // link e,d xc = (b*b + d*d - e*e) / (2.0*b); yc = Math.sqrt( d*d - xc*xc ); theta_bc = Math.atan2(C[1]-B[1], C[0]-B[0]); E[0] = B[0] + xc*Math.cos(theta_bc) + yc*Math.cos(theta_bc+Math.PI/2); E[1] = B[1] + xc*Math.sin(theta_bc) + yc*Math.sin(theta_bc+Math.PI/2); draw_link(sign*E[0], E[1], sign*C[0], C[1]);// link e draw_link(sign*B[0], B[1], sign*E[0], E[1]);// link d // link k,c xc = (AB*AB + c*c - k*k) / (2.0*AB); yc = Math.sqrt( c*c - xc*xc ); D[0] = B[0] + xc*Math.cos(theta_ab) + yc*Math.cos(theta_ab-Math.PI/2); D[1] = B[1] + xc*Math.sin(theta_ab) + yc*Math.sin(theta_ab-Math.PI/2); draw_link(sign*A[0], A[1], sign*D[0], D[1]);// link k draw_link(sign*B[0], B[1], sign*D[0], D[1]);// link c // link f,g DE = Math.sqrt( (D[0]-E[0])*(D[0]-E[0]) + (D[1]-E[1])*(D[1]-E[1]) ); xc = (DE*DE + g*g - f*f) / (2.0*DE); yc = Math.sqrt( g*g - xc*xc ); theta_de = Math.atan2(E[1]-D[1], E[0]-D[0]); F[0] = D[0] + xc*Math.cos(theta_de) + yc*Math.cos(theta_de+Math.PI/2); F[1] = D[1] + xc*Math.sin(theta_de) + yc*Math.sin(theta_de+Math.PI/2); draw_link(sign*F[0], F[1], sign*D[0], D[1]);// link g draw_link(sign*E[0], E[1], sign*F[0], F[1]);// link f // link h,i xc = (g*g + i*i - h*h) / (2.0*g); yc = Math.sqrt( i*i - xc*xc ); theta_df = Math.atan2(F[1]-D[1], F[0]-D[0]); G[0] = D[0] + xc*Math.cos(theta_df) + yc*Math.cos(theta_df+Math.PI/2); G[1] = D[1] + xc*Math.sin(theta_df) + yc*Math.sin(theta_df+Math.PI/2); draw_link(sign*F[0], F[1], sign*G[0], G[1]);// link h draw_link(sign*D[0], D[1], sign*G[0], G[1]);// link i } // å·¦å´ã¨å³å´ã®ä¸¡èã®ãã¢ãæç»ããé¢æ° function draw_pair(theta){ // çå´ã®èã®ãªã³ã¯æ©æ§ãæç» A[0] = m * Math.cos(theta); A[1] = m * Math.sin(theta);// ååç¯mã®ç«¯Aã®åº§æ¨ draw_link(O[0], O[0], A[0], A[1]);// ååç¯m(=OA)ãæç» draw_jansen(theta, 1);// ãªã³ã¯æ©æ§ãæç» // å対å´ã®èã®ãªã³ã¯æ©æ§ãæç» A[0] = m * Math.cos(Math.PI-theta); A[1] = m * Math.sin(Math.PI-theta); draw_jansen(Math.PI-theta, -1);// 第äºå¼æ°ã-1ã«ãããã¨ã§å対å´ã®èãé¸æ } function display(){ var omega = 0.05;// è§é度 // 120度ãã¨ã«ããããããããè²ãå¤ãã¦æç»ãã ctx.clearRect(0, 0, 350, 300);// æ®åãæ¶ã ctx.strokeStyle = "rgb(255, 100, 100)"; draw_pair(theta); ctx.strokeStyle = "rgb(100, 255, 100)"; draw_pair(theta+Math.PI/1.5); ctx.strokeStyle = "rgb(100, 100, 255)"; draw_pair(theta+2*Math.PI/1.5); theta += omega; } </script>