-->
Engrenages
Xmin = -5
Xmax = 5
Ymin = -5
Ymax = 5
a = 0
setInterval( function (){
peinture = blanc
transparence = 1
rectangle([-10,10],20,20)
transparence = 0
engrenage([-1.68,-1.68],0.5,10,-2*a)
engrenage([-0.45,-0.45],1,20,a)
engrenage([2,2],2,40,-a*0.5+0.05)
a = a + 0.05
},50 )
function engrenage(C,r,n,a){
cercle(C,r)
point(C)
for(k=0;k < 2*n; k = k+2){
N = 2*n
P1 = [r*cos(2*%PI*k/N+a)+C[0],r*sin(2*%PI*k/N+a)+C[1]]
P2 = [ (r+0.2*r)*cos(%PI*(2*k+1)/N+a)+C[0] , (r+0.2*r)*sin(%PI*(2*k+1)/N+a)+C[1] ]
P3 = [r*cos(2*%PI*(k+1)/N+a)+C[0],r*sin(2*%PI*(k+1)/N+a)+C[1]]
segment(P1,P2)
segment(P3,P2)
}
}
Xmin = -5
Xmax = 5
Ymin = -5
Ymax = 5
engrenage1([0,2],1,0)
engrenage2([0,-2],1,0)
a1 = 0
b1 = -0.38
setInterval( function (){
peinture = blanc
transparence = 1
rectangle([-10,10],20,20)
transparence = 0
engrenage1([0,2],1,a1)
engrenage2([0,-1],1,-b1)
a1 = a1 + %PI/20
if( a1 > 4.1 && a1 < 5.38 ){b1 = b1 + 0.131}
if( a1>=2*%PI ){ a1 = 0; b1 = -0.38}
},50 )
function engrenage1(C,r,a){
cercle(C,r)
point(C)
P1 = [r*cos(a)+C[0],r*sin(a)+C[1]]
P2 = [ (r+0.7*r)*cos(%PI/20+a)+C[0] , (r+0.7*r)*sin(%PI/20+a)+C[1] ]
P3 = [r*cos(2*%PI/20+a)+C[0],r*sin(2*%PI/20+a)+C[1]]
segment(P1,P2)
segment(P3,P2)
}
function engrenage2(C,r,a){
cercle(C,r)
point(C)
e = 0.1
for(k=0;k < 12; k = k+2){
N = 12
P1 = [r*cos(2*%PI*k/N+a+e)+C[0],r*sin(2*%PI*k/N+a+e)+C[1]]
P2 = [1.8*r*cos(2*%PI*k/N+a+e)+C[0],1.8*r*sin(2*%PI*k/N+a+e)+C[1]]
P3 = [1.8*r*cos(2*%PI*(k+1)/N+a-e)+C[0],1.8*r*sin(2*%PI*(k+1)/N+a-e)+C[1]]
P4 = [r*cos(2*%PI*(k+1)/N+a-e)+C[0],r*sin(2*%PI*(k+1)/N+a-e)+C[1]]
segment(P1,P2)
segment(P3,P2)
segment(P3,P4)
}
}