-->
Roues et courbes
Roue circulaire
Xmin = -5
Xmax = 5
Ymin = -1
Ymax = 9
A2 = [-5,-1]
C2 = [-5,-0.5]
function graphe(){
couleur = noir
trait = 1
cercle(C2,0.5)
trait = 0.5
point(A2)
}
function rotation(){
trait = 1.2
couleur = blanc
cercle(C2,0.5)
couleur = rouge
trait = 0.5
point(A2)
A2 = rotation2d(C2,a2,A2)
}
function trans(){
A2 = translation(U2,A2)
C2 = translation(U2,C2)
}
graphe()
a2 = -0.1
U2 = [0.1,0]
function move(){
rotation()
trans()
graphe()
if( A2[0] > 6.5 ){
peinture = blanc
rectangle([-10,10],20,20)
A2 = [-5,-1]
C2 = [-5,-0.5]
}
}
setInterval(function (){ move()},80)
Roue carrée
Xmin = -5
Xmax = 5
Ymin = -1.2
Ymax = 8
A = [-5,-1]
B = [-4,-1]
C = [-4,0]
D = [-5,0]
function graphe(){
couleur = noir
trait = 0.2
point(A)
point(B)
point(C)
point(D)
trait = 1
segment(A,B)
segment(A,D)
segment(B,C)
segment(C,D)
}
function rotation(){
trait = 1.2
couleur = blanc
segment(A,B)
segment(A,D)
segment(B,C)
segment(C,D)
E = [(A[0]+C[0])/2,(A[1]+C[1])/2]
A = rotation2d(E,a,A)
B = rotation2d(E,a,B)
C = rotation2d(E,a,C)
D = rotation2d(E,a,D)
}
function trans(){
A = translation(U,A)
B = translation(U,B)
C = translation(U,C)
D = translation(U,D)
}
graphe()
a = -0.1
U = [0.1,0]
function move(){
rotation()
trans()
graphe()
if( A[0] > 6.5 ){
peinture = blanc
rectangle([-10,10],20,20)
A = [-5,-1]
B = [-4,-1]
C = [-4,0]
D = [-5,0]
}
}
setInterval(function (){ move()},80)
Roue triangulaire
Xmin = -5
Xmax = 5
Ymin = -1.3
Ymax = 8
A1 = [-5,-1]
B1 = [-4,-1]
C1 = [-4.5,-0.13]
function graphe(){
couleur = noir
trait = 0.2
point(A1)
point(B1)
point(C1)
trait = 1
segment(A1,B1)
segment(B1,C1)
segment(C1,A1)
}
function rotation(){
trait = 1.2
couleur = blanc
segment(A1,B1)
segment(B1,C1)
segment(C1,A1)
E1 = [(A1[0]+C1[0]+B1[0])/3,(A1[1]+C1[1]+B1[1])/3]
A1 = rotation2d(E1,a1,A1)
B1 = rotation2d(E1,a1,B1)
C1 = rotation2d(E1,a1,C1)
}
function trans(){
A1 = translation(U1,A1)
B1 = translation(U1,B1)
C1 = translation(U1,C1)
}
graphe()
a1 = -0.1
U1 = [0.1,0]
function move(){
rotation()
trans()
graphe()
if( A1[0] > 6.5 ){
peinture = blanc
rectangle([-10,10],20,20)
A1 = [-5,-1]
B1 = [-4,-1]
C1 = [-4.5,-0.13]
}
}
graphe()
setInterval(function (){ move()},80)