 |
Apprendre Maple Site dédié au logiciel de calcul formel Maple
|
Voir le sujet précédent :: Voir le sujet suivant |
Auteur |
Message |
michel
Inscrit le: 23 Juin 2006 Messages: 72
|
Posté le: 03 Aoû 2014 10:41 Sujet du message: Animation Arc capable |
|
|
Bonjour, comment faire parcourir les 2 arcs l'un après l'autre et non simultanément ? Merci.
> restart;with(geometry); with(plots); _EnvHorizontalName := 'x'; _EnvVerticalName := 'y';
> cb := color = blue; t3 := thickness = 3; l3 := linestyle = 3;
> xA := 3; yA := 0; xB := -3; yB := 0; c := 6; alpha := arctan(3/4); evalf(%*180/Pi); point(A, xA, yA); point(B, xB, yB): R:=5:
> xH := (xA+xB)*(1/2); yH := (yA+yB)*(1/2); point(H, xH, yH);
> xO1 := 0; yO1 := 4; point(O1, xO1, yO1);
> xO2 := 0; yO2 := -4; point(O2, xO2, yO2);
> segment(sAB, A, B); segment(sHO, H, O1); segment(sAO, A, O1); segment(sBO, B, O1);
> alpha1 := arctan((yO1-yA)/(xO1-xA)); beta := Pi+arctan((yO1-yB)/(xO1-xB));
> AR1 := plottools[arc]([xO1, yO1], R, alpha1 .. beta, l3); AR2 := plottools[arc]([xO2, yO2], R, -beta .. -alpha1, l3);
> N := 80; dt := (beta-alpha1)/N;
> dr := draw({O1, O2, sAB, sHO, sAO(cb), sBO(cb)});
> tex := textplot([[xA, yA-.5, "A"], [xB, yB-.5, "B"], [xO1, yO1+.5, "O1"], [xO2, yO2-.5, "O2"], [xH-.5, yH-.5, "H"]]);
> M1 := seq(plottools[disk]([R*cos(dt*t+alpha1)+xO1, R*sin(dt*t+alpha1)+yO1], .2, color = orange), t = 0 .. N); M2 := seq(plottools[disk]([R*cos(dt*t+alpha1+Pi)+xO2, R*sin(dt*t+alpha1+Pi)+yO2], .2, color = orange), t = 0 .. N); P1 := seq(plottools[polygon]([[R*cos(dt*t+alpha1)+xO1, R*sin(dt*t+alpha1)+yO1], [xA, yA], [xB, yB]], color = aquamarine, linestyle = dash), t = 0 .. N); P2 := seq(plottools[polygon]([[R*cos(dt*t+alpha1+Pi)+xO2, R*sin(dt*t+alpha1+Pi)+yO2], [xA, yA], [xB, yB]], color = aquamarine, linestyle = dash), t = 0 .. N);
> for t to N do E[t] := display(dr, tex, AR1, AR2, M1[t], M2[t], P1[t], P2[t]) end do;
> display([seq(E[t], t = 1 .. N)], insequence = true, axes = none, scaling = constrained, view = [-10 .. 10, -10 .. 10]); |
|
Revenir en haut de page |
|
 |
ALS
Inscrit le: 11 Sep 2006 Messages: 647
|
Posté le: 04 Aoû 2014 7:46 Sujet du message: Re: Animation Arc capable |
|
|
Bonjour,
Tout fonctionne parfaitement dans votre code, votre question ne demande qu'une correction légère.
1) Pour ne plus avoir l'affichage des variables et objets graphiques créés, j'ai remplacé tous les ; par des :
2) J'ai séparé en 2 séquences distinctes, celle des E[t] et celle des F[t], de façon que l'affichage soit successif et non simultané pour les points P1[t] et P2[t].
3) Pour visualiser le graphique animé:
Lancer l'application en cliquant sur l'icône !!!.
Une fois le dessin affiché, y faire un clic droit. Choisir dans le menu popup "Animation" et "Play".
Une barre apparait alors sous la barre d'outils principale de Maple.
On peut jouer en boucle en cliquant sur l'icône la plus à droite de cette nouvelle barre ou jouer plus ou moins vite en cliquant sur 2 icônes gérant la vitesse de l'animation.
Code: |
> restart;with(geometry): with(plots): _EnvHorizontalName := 'x': _EnvVerticalName := 'y':
> cb := color = blue: t3 := thickness = 3: l3 := linestyle = 3:
> xA := 3: yA := 0: xB := -3: yB := 0: c := 6: alpha := arctan(3/4): evalf(%*180/Pi): point(A, xA, yA): point(B, xB, yB): R:=5:
> xH := (xA+xB)*(1/2): yH := (yA+yB)*(1/2): point(H, xH, yH):
> xO1 := 0: yO1 := 4: point(O1, xO1, yO1):
> xO2 := 0: yO2 := -4: point(O2, xO2, yO2):
> segment(sAB, A, B): segment(sHO, H, O1): segment(sAO, A, O1): segment(sBO, B, O1):
> alpha1 := arctan((yO1-yA)/(xO1-xA)): beta := Pi+arctan((yO1-yB)/(xO1-xB)):
> AR1 := plottools[arc]([xO1, yO1], R, alpha1 .. beta, l3): AR2 := plottools[arc]([xO2, yO2], R, -beta .. -alpha1, l3):
> N := 80: dt := (beta-alpha1)/N:
> dr := draw({O1, O2, sAB, sHO, sAO(cb), sBO(cb)}):
> tex := textplot([[xA, yA-.5, "A"], [xB, yB-.5, "B"], [xO1, yO1+.5, "O1"], [xO2, yO2-.5, "O2"], [xH-.5, yH-.5, "H"]]):
> M1 := seq(plottools[disk]([R*cos(dt*t+alpha1)+xO1, R*sin(dt*t+alpha1)+yO1], .2, color = orange), t = 0 .. N): M2 := seq(plottools[disk]([R*cos(dt*t+alpha1+Pi)+xO2, R*sin(dt*t+alpha1+Pi)+yO2], .2, color = orange), t = 0 .. N): P1 := seq(plottools[polygon]([[R*cos(dt*t+alpha1)+xO1, R*sin(dt*t+alpha1)+yO1], [xA, yA], [xB, yB]], color = aquamarine, linestyle = dash), t = 0 .. N): P2 := seq(plottools[polygon]([[R*cos(dt*t+alpha1+Pi)+xO2, R*sin(dt*t+alpha1+Pi)+yO2], [xA, yA], [xB, yB]], color = aquamarine, linestyle = dash), t = 0 .. N):
> for t to N do E[t] := display(dr, tex, AR1, AR2, M1[t], P1[t]): F[t] := display(dr, tex, AR1, AR2, M2[t], P2[t]) end do:
> display([seq(E[t], t = 1 .. N),seq(F[t], t = 1 .. N)], insequence = true, axes = none, scaling = constrained, view = [-10 .. 10, -10 .. 10]);
|
Bravo pour cette programmation!
À plus tard sur ce forum. |
|
Revenir en haut de page |
|
 |
michel
Inscrit le: 23 Juin 2006 Messages: 72
|
Posté le: 05 Aoû 2014 10:44 Sujet du message: Animation |
|
|
Bonjour,
Merci beaucoup pour votre réponse qui convient parfaitement.
Je m'étais enferrer à tord avec M1[t] et M2[N+t] qui ne fonctionnent pas.
A plus tard. |
|
Revenir en haut de page |
|
 |
|
|
Vous ne pouvez pas poster de nouveaux sujets dans ce forum Vous ne pouvez pas répondre aux sujets dans ce forum Vous ne pouvez pas éditer vos messages dans ce forum Vous ne pouvez pas supprimer vos messages dans ce forum Vous ne pouvez pas voter dans les sondages de ce forum
|

Développé par phpBB © 2001, 2006 phpBB Group
Traduction par : phpBB-fr.com
Apprendre Maple - ©
- Alain Le Stang - Navigation optimisée pour une résolution 1024 x 768.
|