履歴: 工作/歯車について勉強する3
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 26 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2025/4/22 12:01:10 | 工作/歯車について勉強する3 最新版 | 68,708 | +1002 | -941 | 表示 | 差分 | — |
| 2025/4/16 15:25:03 | 工作/歯車について勉強する3 | 67,731 | +6 | -1 | 表示 | 差分 | 選択 |
| 2025/3/20 9:53:29 | 工作/歯車について勉強する3 | 67,647 | +2 | -1 | 表示 | 差分 | 選択 |
| 2025/3/20 9:53:29 | 工作/歯車について勉強する3 | 67,606 | +4 | -2 | 表示 | 差分 | 選択 |
| 2025/3/20 9:53:29 | 工作/歯車について勉強する3 | 67,583 | +4 | -2 | 表示 | 差分 | 選択 |
| 2025/3/14 23:22:24 | 工作/歯車について勉強する3 | 67,482 | +2 | -2 | 表示 | 差分 | 選択 |
| 2025/3/13 22:13:45 | 工作/歯車について勉強する3 | 67,482 | +2 | -1 | 表示 | 差分 | 選択 |
| 2025/2/28 7:40:29 | 工作/歯車について勉強する3 | 67,423 | +2 | -2 | 表示 | 差分 | 選択 |
| 2025/2/24 21:13:27 | 工作/歯車について勉強する3 | 67,420 | +78 | -51 | 表示 | 差分 | 選択 |
| 2025/2/24 11:18:15 | 工作/歯車について勉強する3 | 66,118 | +942 | -1250 | 表示 | 差分 | 選択 |
| 2025/2/24 1:12:48 | 工作/歯車について勉強する3 | 64,925 | +230 | -131 | 表示 | 差分 | 選択 |
| 2025/2/23 12:54:10 | 工作/歯車について勉強する3 | 62,161 | +2 | -2 | 表示 | 差分 | 選択 |
| 2025/2/22 18:02:43 | 工作/歯車について勉強する3 | 62,150 | +5 | -5 | 表示 | 差分 | 選択 |
| 2025/2/22 13:28:18 | 工作/歯車について勉強する3 | 62,144 | +903 | -10 | 表示 | 差分 | 選択 |
| 2025/2/20 23:16:11 | 工作/歯車について勉強する3 | 45,320 | +49 | -2 | 表示 | 差分 | 選択 |
| 2025/2/18 13:50:43 | 工作/歯車について勉強する3 | 44,052 | +41 | -48 | 表示 | 差分 | 選択 |
| 2025/2/17 19:11:37 | 工作/歯車について勉強する3 | 44,448 | +244 | -33 | 表示 | 差分 | 選択 |
| 2025/2/16 16:12:28 | 工作/歯車について勉強する3 | 38,728 | +221 | -5 | 表示 | 差分 | 選択 |
| 2025/2/16 14:20:29 | 工作/歯車について勉強する3 | 33,229 | +118 | -26 | 表示 | 差分 | 選択 |
| 2025/2/15 20:37:51 | 工作/歯車について勉強する3 | 30,513 | +253 | -4 | 表示 | 差分 | 選択 |
| 2025/2/15 11:15:17 | 工作/歯車について勉強する3 | 24,431 | +368 | -123 | 表示 | 差分 | 選択 |
| 2025/2/15 1:16:20 | 工作/歯車について勉強する3 | 18,815 | +225 | -29 | 表示 | 差分 | 選択 |
| 2025/2/14 17:21:28 | 工作/歯車について勉強する3 | 13,657 | +2 | -5 | 表示 | 表示中 | 選択 |
| 2025/2/14 7:29:05 | 工作/歯車について勉強する3 | 13,622 | +14 | -1 | 表示 | 差分 | 選択 |
| 2025/2/11 11:49:36 | 工作/歯車について勉強する3 | 2,228 | +56 | -10 | 表示 | 差分 | 基準 |
| 2025/2/11 11:33:34 | 工作/歯車について勉強する3 | 1,059 | — | — | 表示 | — | 選択 |
基準: 工作/歯車について勉強する3 (2025/2/11 11:49:36) → 比較: 工作/歯車について勉強する3 (2025/2/14 17:21:28)
@@ -1,6 +1,16 @@
-#author("2025-02-11T02:49:36+00:00","default:administrator","administrator")
+#author("2025-02-14T08:21:28+00:00","default:administrator","administrator")
[[工作/歯車について勉強する]]
+* 歯車を描く [#ud5c339c]
+
+ LANG: p5js_live
+ const t=[];function e(e,n,i,r){let l=20*i+20,s=e.createSpan(n).position(20,l),a=e.createSpan(String(r.value));a.position(100,l);let h=e.createSlider(r.min,r.max,r.value,r.step);return h.position(150,l),h.size(300),h.elt.oninput=()=>a.html(String(h.value())),t.push(s,a,h),h}function n(e,i,r,l=0,s=!1){let a=100*l+20,h=20*r+20,o=e.createCheckbox();o.position(a,h),o.checked(s);let u=e.createSpan(i).position(a+20,h);return u.mouseClicked(()=>{o.checked(!o.checked()),o.elt.onchange&&o.elt.onchange()}),u.style("cursor","pointer "),t.push(u,o),o}class i{constructor(t,e){this.x=t,this.y=e}static polar(t,e){return new i(t*Math.cos(e),t*Math.sin(e))}angle(){return Math.atan2(this.y,this.x)}equal(t){return 1e-6>Math.abs(this.x-t.x)&&1e-6>Math.abs(this.y-t.y)}add(t){return new i(this.x+t.x,this.y+t.y)}sub(t){return new i(this.x-t.x,this.y-t.y)}mul(t){return new i(this.x*t,this.y*t)}rotate(t){let e=Math.cos(t),n=Math.sin(t);return new i(this.x*e-this.y*n,this.x*n+this.y*e)}addRotated(t,e){return this.add(e.rotate(t))}flipY(){return new i(this.x,-this.y)}flipX(){return new i(-this.x,this.y)}norm(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(t=1){let e=this.norm()/t;return new i(this.x/e,this.y/e)}polar(){return[this.norm(),this.angle()]}inner(t){return this.x*t.x+this.y*t.y}outer(t){return this.x*t.y-this.y*t.x}}function r(t,e){return new i(t,e)}class l extends Array{constructor(t,...e){t instanceof i?(super(t,...e),this.option={}):(super(...e),this.option=t??{})}static extractPoints(t,e){if(t.length<=e)return t;let n=t.totalLength(),i=new l(t.option),r=0,s=0;for(let l=0;l<t.length-1;l++)s>=r&&(i.push(t[l]),r=n*i.length/e),s+=t[l].sub(t[l+1]).norm();return i.push(t[t.length-1]),i}static circle(t,e=r(0,0),n={},i=100){let s=new l(n);for(let n=0;n<=i;n++){let l=2*Math.PI*n/i;s.push(r(t*Math.cos(l),t*Math.sin(l)).add(e))}return s}totalLength(){let t=0;for(let e=0;e<this.length-1;e++)t+=this[e].sub(this[e+1]).norm();return t}draw(t,e=!1){if(void 0===this.option?.stroke?t.stroke("black"):t.stroke(this.option.stroke),void 0===this.option?.weight?t.strokeWeight(1):t.strokeWeight(this.option.weight),void 0===this.option?.dash?t.drawingContext.setLineDash([]):t.drawingContext.setLineDash(this.option.dash),void 0===this.option?.fill){t.noFill(),t.beginShape();for(let e=0;e<this.length;e++)t.vertex(this[e].x,this[e].y);t.endShape()}else{t.fill(this.option.fill),t.beginShape();for(let e=0;e<this.length;e++)t.vertex(this[e].x,this[e].y);t.endShape(t.CLOSE)}e&&this.forEach(e=>t.circle(e.x,e.y,1.5))}apply(t,e=this.option){return new l(e,...this.map(t))}crossPoint(t){return s(this[0],this[1],t[0],t[1])}direction(t=0){return this[t].sub(this[t+1]).normalize()}}function s(t,e,n,i){let r=e.sub(t),l=i.sub(n),s=n.sub(t),a=r.outer(l);if(0==a)return;let h=s.outer(r)/a,o=s.outer(l)/a;if(!(h<0)&&!(h>1)&&!(o<0)&&!(o>1))return t.add(r.mul(o))}function a(t,e,n){let i=n.sub(e),r=t.sub(e);return Math.abs(i.outer(r)/i.norm())}function h(t,e,n,i=1e-6){for(;t+i<e;){let i=t+(e-t)/3,r=e-(e-t)/3;n(i)<n(r)?e=r:t=i}return(t+e)/2}function o(t){let{m:e,z:n}=t={...t};t.inner&&([t.mk,t.mf]=[t.mf,t.mk],t.fillet=0);let o=e*n/2,{r1:c,r2:m,filletCenter:f,filletRadius:d}=function(t){let{m:e,z:n,alpha:l,shift:s,fillet:a,mf:h,mk:o}=t,u=n*e/2,{sin:c,cos:m,tan:f,min:d,max:g,PI:x}=Math,b=r(u+s+o,o*f(l)),v=r(u+s-o,-o*f(l)),y=r(u+s-h,-h*f(l));a=d(a,(h-o)/(1-c(l)));let k=v.add(i.polar(a,-x/2+l));return k.y<-x*e/4&&(a=(k=k.add(y.sub(k).normalize((-x*e/4-k.y)/(y.y-k.y)))).x-y.x),{r1:b,r2:v,filletCenter:k,filletRadius:a}}(t),g=(t,e)=>e.add(r(0,-o*t)).rotate(t),x=(t,e)=>{let{sin:n,cos:i,PI:l}=Math;return e.rotate(t+l/2).add(r(o*(n(t)+t*i(t)),o*(-i(t)+t*n(t))))},b=t=>{let e=g(t,c),n=g(t,m).sub(e),i=x(t,c),r=x(t,m).sub(i),l=i.outer(n)/r.outer(n);return[e.sub(n.mul(l)),l]},v=t=>{let e=g(t,f),n=x(t,f).normalize(d),i=e.addRotated(-Math.PI/2,n),r=e.addRotated(Math.PI/2,n);return i.x-i.y<r.x-r.y?i:r},{cInvolute:y,involuteT:k}=function(t,e){let{alpha:n,mk:i,mf:r,shift:s,z:a,m:o,backlash:u}=t,c=o*a/2,{abs:m,PI:f}=Math,d,g,x=[];d=h(0,90-n,t=>m(e(t)[0].norm()-c-i-s)),e(d)[0].angle()>f/a/2-u&&(d=h(0,d,t=>m(e(t)[0].angle()-(f/a/2-u)))),g=h(0,-2*n,t=>e(t)[0].norm()),e(g)[0].norm()&&(g=function(t,e,n,i=1e-6){let r=n(t),l=n(e);if(r*l>0)return Math.abs(r)<Math.abs(l)?t:e;for(r>l&&([t,e]=[e,t]);Math.abs(t-e)>i;){let i=(t+e)/2;0>n(i)?t=i:e=i}return(t+e)/2}(0,g,t=>e(t)[0].norm()-(c-r+s)));let b=new l;for(let t=0;t<300;t++){let n=d+(g-d)*t/300;b.push(e(n)[0]),x.push(n)}return{cInvolute:b,involuteT:x}}(t,b),M=new l,w=[];return t.inner||([M,w]=function(t,e,n,r,s,a){let o,u;let{abs:c,PI:m,ceil:f}=Math,{shift:d,alpha:g,m:x,z:b,mk:v,backlash:y}=t,k=x*b/2,M=k+v;for(o=0;!(e(o,r).norm()>M+d);o-=.05);for(u=.05;!(e(u,r).norm()>M+d);u+=.05);let w=h(o,u,t=>n(t).norm());e(w,r).norm()>k&&([o,u]=[u,o]),u=w;let z=!1,P=null,I=1,S=o,C=[],N=new l;for(let t=0;t<=60;t+=I){let l=o+(u-o)*t/60,h=n(l);z||h.norm()>a.norm()&&h.sub(a).angle()<g||(z=!0,S=l,P&&(N.push(P),C.push(l-(u-o)*I/60))),z&&(N.push(h),C.push(l));let d=e(l,r);if(t>0&&d.sub(e(w,r)).norm()<x/1e3){let t=c(h.sub(e(w,r)).angle()),n=m-m/b/2+y,l=f(c(n-t)/m*180);for(let a=1;a<=l;a++){let h=t+(n-t)*a/l;N.push(e(w,r).add(i.polar(s,h)))}break}t>0&&h.sub(P).norm()>x/20&&(I/=2),P=h}return o=S,[N,C]}(t,g,v,f,d,m),{cInvolute:y,involuteT:k,cFillet:M,filletT:w}=function(t,e,n,i,r,l){let[o,u,c]=function(t,e){let n=0,i=0;for(;n<t.length-1&&i<e.length-1;){if(t[n+1].x>e[i].x){n++;continue}if(t[n].x<e[i+1].x){i++;continue}let r=s(t[n],t[n+1],e[i],e[i+1]);if(r)return[r,n,i];t[n+1].x>e[i+1].x?n++:i++}return[]}(t,i);if(o)t.splice(u+1,1/0,o),e.splice(u+1,1/0,h(e[u],e[u+1],t=>n(t)[0].sub(o).norm())),i.splice(0,c+1,o),r.splice(0,c+1,h(r[c],r[c+1],t=>l(t).sub(o).norm()));else{let[s,o,u,c]=function(t,e){let n=0,i=0,r=[1/0];for(;n<t.length-1&&i<e.length-1;){if(t[n+1].x>e[i].x){n++;continue}if(t[n].x<e[i+1].x){i++;continue}if(t[n].x<e[i].x){let l=a(t[n],e[i],e[i+1]);l<r[0]&&(r=[l,n,i,0])}else{let l=a(e[i],t[n],t[n+1]);l<r[0]&&(r=[l,n,i,1])}t[n+1].x>e[i+1].x?n++:i++}return 1==r.length?i<e.length-1?[a(t[n],e[i],e[i+1]),n,i,0]:[a(e[i],t[n],t[n+1]),n,i,1]:r}(t,i);c?(t.splice(o+1,1/0,i[u]),i.splice(0,u),e.splice(o+1,1/0,h(e[o],e[o+1],t=>n(t)[0].sub(i[u]).norm())),r.splice(0,u)):(t.splice(o+1,1/0),i.splice(0,u+1,t[o]),e.splice(o+1,1/0),r.splice(0,u+1,h(r[u],r[u+1],e=>l(e).sub(t[o]).norm())))}return{cInvolute:t,involuteT:e,cFillet:i,filletT:r}}(y,k,b,M,w,v)),function(t,e,n){let{m:i,mk:r,shift:s,z:a,backlash:h,mf:o}=t,{PI:c}=Math,m=[],f=u(i*a/2+r+s,c/a/2-h,e[0].angle());m.push(f);let d=l.extractPoints(e,30).filter((t,e,n)=>e<2||e>n.length-3||e%2==1);m.push(new l(e.option,...d));let g=l.extractPoints(n,30).filter((t,e,n)=>e<2||e>n.length-3||e%2==1);if(m.push(new l(n.option,...g)),t.inner){let t=u(e.at(-1).norm(),e.at(-1).angle(),-c/a/2-h);m.push(t)}else if(n.length>0){let t=u(i*a/2-o+s,n[n.length-1].angle(),-c/a/2-h);m.push(t)}m=m.map(t=>t.apply(t=>t.rotate(h-c/a/2)));let x=[];x.push(e[0].rotate(h-c/a/2).polar()),x.push(e.at(-1).rotate(h-c/a/2).polar()),n.length>0&&x.push(n.at(-1).rotate(h-c/a/2).polar());let b=m.reduce((t,e)=>t.slice(0,-1).concat(e.map(t=>t.polar())),[]),v={curve:[...b=b.map(t=>[t[0],-t[1]]).reverse().concat(b)],connections:[...x=x.map(t=>[t[0],-t[1]]).reverse().concat(x)]};for(let t=1;t<a;t++)v.curve=v.curve.concat(b.map(e=>[e[0],e[1]-2*t*c/a])),v.connections=v.connections.concat(x.map(e=>[e[0],e[1]-2*t*c/a]));return v}(t,y,M)}function u(t,e,n,s=r(0,0),a=.02,h=1e-4){let{abs:o,ceil:c,max:m}=Math,f=new l;if(t*o(n-e)>h){let r=m(2,c(o(n-e)/a));for(let l=0;l<=r;l++){let a=e+(n-e)*l/r;f.push(s.add(i.polar(t,a)))}}return f}let c=null,m=null,f=null;(i=>{let r;let l={width:600,height:600,ox:0,oy:0};i.setup=()=>{let{width:s,height:a}=l;l.ox=s/2,l.oy=a/2,i.createCanvas(s,a).style("position","relative"),r=function(i){let r=n(i,"ツールを非表示",27.5,0),l={m:e(i,"モジュール",0,{min:10,max:200,value:40,step:1}),alpha:e(i,"圧力角",1,{min:10,max:32,value:20,step:1}),z:e(i,"歯数A",2,{min:4,max:200,value:19,step:1}),shift:e(i,"転位A",3,{min:-.5,max:2,value:0,step:.05}),z2:e(i,"歯数B",4,{min:4,max:200,value:6,step:1}),shift2:e(i,"転位B",5,{min:-.5,max:2,value:0,step:.05}),fillet:e(i,"フィレット",6,{min:0,max:.4,value:.4,step:.01}),backlash:e(i,"バックラッシュ",7,{min:0,max:2,value:0,step:.01}),velocity:e(i,"速度",8,{min:-1,max:10,value:1,step:.1}),theta:e(i,"回転角",9,{min:-180,max:180,value:0,step:.05}),df:n(i,"歯底円",10.5,0,!1),db:n(i,"基礎円",10.5,1,!1),dp:n(i,"基準円",10.5,2,!0),dk:n(i,"歯先円",10.5,3,!1),play:n(i,"自動更新",11.5,0,!0),connection:n(i,"接続点",11.5,1,!1),inner:n(i,"内歯車",11.5,2,!1),stop:!1};return t.forEach((e,n)=>{e.style("opacity","0.2"),e.mouseOver(()=>t.forEach(t=>t.style("opacity","1"))),e.mouseOut(()=>t.forEach(t=>t.style("opacity","0.2")))}),l.theta.mousePressed(()=>{l.stop=!0}),l.theta.mouseReleased(()=>{l.stop=!1}),r.elt.onchange=()=>{t.forEach((t,e)=>{e<2||(r.checked()?t.hide():t.show())})},{get m(){return Number(l.m.value())},get alpha(){return Number(l.alpha.value())/180*Math.PI},get z(){return Number(l.z.value())},get shift(){return Number(l.shift.value())*this.m},get z2(){return Number(l.z2.value())},get shift2(){return Number(l.shift2.value())*this.m},get theta(){return-(Number(l.theta.value())/180)*Math.PI},set theta(value){l.theta.value(-(180*value)/Math.PI),l.theta.elt.oninput()},get fillet(){return Number(l.fillet.value())*this.m},get mk(){return+this.m},get mf(){return 1.25*this.m},get backlash(){return Number(l.backlash.value())/100*2*Math.PI/this.z},get play(){return l.play.checked()&&!l.stop},get velocity(){return Number(l.velocity.value())/180*Math.PI},get df(){return l.df.checked()},get db(){return l.db.checked()},get dp(){return l.dp.checked()},get dk(){return l.dk.checked()},get connection(){return l.connection.checked()},get inner(){return l.inner.checked()},incrementTheta(){this.theta-this.velocity<-Math.PI?this.theta+=-this.velocity+2*Math.PI:this.theta+=-this.velocity}}}(i)},i.draw=()=>{var t,e,n;let h;let{ox:u,oy:d}=l;i.background(220);let{gear1:g,gear2:x}=(t=r,h=null!==c?Object.keys(e=c).filter(n=>t[n]!==e[n]):[],(!m||h.filter(t=>!["m2","shift2"].includes(t)).length>0)&&(m=o({...t,backlash:t.inner?-t.backlash:t.backlash})),(!f||h.filter(t=>!["m","shift","inner"].includes(t)).length>0)&&(f=o({...t,z:t.z2,shift:t.shift2,inner:!1})),n=t,c=["m","z","alpha","shift","z2","shift2","fillet","backlash","inner"].reduce((t,e)=>(t[e]=n[e],t),{}),{gear1:m,gear2:f});r.play&&r.incrementTheta();let{m:b,z:v,z2:y,shift:k,shift2:M,inner:w,theta:z,connection:P}=r,[I,S]=[b*v/2,b*y/2],C=Math.PI;w?(s(i,g,u+I+k,d,(z+C)/v+C,P,I+k+5*b/2),a(i,u+I+k,d,r)):(s(i,g,u-I-k,d,-z/v,P,0),a(i,u-I-k,d,r)),s(i,x,u+S+M,d,(z+C)/y+C,P);let N={...r,z:y,shift:M};a(i,u+S+M,d,N)};let s=(t,e,n,i,r=0,l=!1,s=0)=>{t.strokeWeight(1),t.stroke("black"),t.fill("rgba(255, 255, 255, 0.5)"),s&&(t.circle(n,i,2*s),t.fill(220)),t.beginShape(),e.curve.forEach(e=>{t.vertex(n+e[0]*Math.cos(e[1]+r),i+e[0]*Math.sin(e[1]+r))}),t.endShape("close"),l&&e.connections.forEach(e=>{t.circle(n+e[0]*Math.cos(e[1]+r),i+e[0]*Math.sin(e[1]+r),2)})},a=(t,e,n,i)=>{let{df:r,db:l,dp:s,dk:a,m:h,z:o,mk:u,mf:c,alpha:m,shift:f}=i;t.strokeWeight(1),t.stroke("Blue"),t.noFill(),t.drawingContext.setLineDash([2,6]),r&&t.circle(e,n,(h*o/2-c+f)*2),l&&t.circle(e,n,h*o*Math.cos(m)),s&&t.circle(e,n,h*o),s&&f&&t.circle(e,n,h*o+2*f),a&&t.circle(e,n,(h*o/2+u+f)*2),t.drawingContext.setLineDash([])}})(p);
+
+内歯車について:
+
+- インボリュート曲線部分のみで歯形としている
+- フィレットは付けていない
+
* はすば歯車設計 [#m951ac17]
LANG:p5js_live