Apprendre Maple Index du Forum Apprendre Maple
Site dédié au logiciel de calcul formel Maple
 
  Page d'accueilPage d'accueil   FAQFAQ    RechercherRechercher    Liste des MembresListe des Membres    Groupes d'utilisateursGroupes d'utilisateurs 
S'enregistrerS'enregistrer    ProfilProfil   Se connecter pour vérifier ses messages privésSe connecter pour vérifier ses messages privés   ConnexionConnexion 

animation d'une tige constante entre 2 axes

 
Poster un nouveau sujet   Répondre au sujet    Apprendre Maple Index du Forum -> Maple en géométrie
Voir le sujet précédent :: Voir le sujet suivant  
Auteur Message
michel



Inscrit le: 23 Juin 2006
Messages: 72

MessagePosté le: 04 Oct 2014 14:27    Sujet du message: animation d'une tige constante entre 2 axes Répondre en citant

Bonjour,
J'essaie d'animer une tige de longueur constante entre 2 axes;
Voici le code qui ne donne pas entière satisfaction !

Code:

> with(geometry):with(plots):with(LinearAlgebra):
> _EnvHorizontalName:='x':_EnvVerticalName:='y':
> mu:=arctan(0.9):
> Cbar:=0.7,0.2,0.2:
> # Soit B un point de l'axe Ou d'angle theta par rapport à l'horizontale
> B:=[l*sin(t)*cot(theta),l*sin(t)]: xB:=op(1,B):yB:=op(2,B):
> # Soit x l'abscisse de C sur l'axe Ov d'angle phi par rapport à l'horizontale
> # Recherche des coordonnées xC et yC
> eq:=expand((l*sin(t)*cos(theta)-x)^2+(l*sin(t)-x*tan(phi))^2)=l^2;#distance BC constante égale l
> sol:=solve(eq,x):
> xC1:=sol[1]:yC1:=tan(phi)*xC1:xC2:=sol[2]:yC2:=tan(phi)*xC2:
C1:=[xC1,yC1]:C2:=[xC2,yC2]:
> theta:=arctan(0.9):l:=5:nbf:=200:phi:=-Pi/12:

> arti:=display([seq(PLOT(POINTS(op(evalf(subs(t=j*2*Pi/nbf,[B,C1]))),
                         COLOR(RGB,0,0,0),SYMBOL(CIRCLE,14))),j=0..nbf)],insequence=true):

> tige:=display([seq(PLOT(CURVES(evalf(subs(t=j*Pi*2/nbf,[B,C1])),
                            COLOR(RGB,Cbar),THICKNESSj=0..nbf)],thickness=2,insequence=true):

> display([plot(tan(theta)*x,x=-6..6,color=grey,thickness=2),plot(tan(phi)*x,x=-6..6,color=grey,thickness=2),
           arti,tige],scaling=constrained,view=[-7.8..7.8,-6..6],axes=none);



Comment corriger cette animation pour qu'elle fonctionne ? Merci.
Revenir en haut de page
Voir le profil de l'utilisateur Envoyer un message privé
ALS



Inscrit le: 11 Sep 2006
Messages: 647

MessagePosté le: 06 Oct 2014 7:41    Sujet du message: Répondre en citant

Bonjour,

Difficile de voir comme cela.
Déjà je vois une erreur de syntaxe dans la ligne définissant tige : THICKNESSj=0..nbf

D'autre part, mieux vaut ne pas utiliser les syntaxes PLOT, CURVES, POINTS qui sont des syntaxes que Maple utilise plutôt pour des affichages de structures graphiques créées.
Utiliser plot, pointplot, display, ou animate.

Voir l'aide.
Revenir en haut de page
Voir le profil de l'utilisateur Envoyer un message privé
ALS



Inscrit le: 11 Sep 2006
Messages: 647

MessagePosté le: 07 Oct 2014 8:52    Sujet du message: Répondre en citant

Bonjour Michel,

J'ai essayé de refaire votre animation, mais j'ai eu quelques problèmes avec les valeurs complexes non réelles dans C1.
J'ai utilisé disk pour dessiner les extrémités de la barre.

Voici le code. Vous pourrez peut-être abaisser la vitesse de l'animation en cliquant sur le bouton de la barre qui s'affichera sous la barre principale de Maple.

Code:

> restart:
> with(geometry):with(plots):with(plottools):
> _EnvHorizontalName:='x':_EnvVerticalName:='y':
> mu:=evalf(arctan(0.9)): Cbar:=0.7,0.2,0.2: phi:=evalf(-Pi/12): theta:=evalf(arctan(0.9)): l:=5: nbf:=200:
> # Soit B un point de l'axe Ou d'angle theta par rapport à l'horizontale
> B:=[l*sin(t)*cot(theta),l*sin(t)]: xB:=op(1,B): yB:=op(2,B):
> # Soit x l'abscisse de C sur l'axe Ov d'angle phi par rapport à l'horizontale
> #Recherche des coordonnées xC et yC
> eq:=expand((l*sin(t)*cos(theta)-x)^2+(l*sin(t)-x*tan(phi))^2)=l^2;#distance BC constante égale l
> sol:=solve(eq,x):xC1:=sol[1]:yC1:=tan(phi)*xC1:xC2:=sol[2]:yC2:=tan(phi)*xC2:C1:=[xC1,yC1]:C2:=[xC2,yC2]:

                          2                                       2
  eq := 38.81215469 sin(t)  - 4.753449538 sin(t) x + 1.071796770 x

         = 25

> c:=display([plot(tan(theta)*x,x=-6..6,color=grey,thickness=5),plot(tan(phi)*x,x=-6..6,color=grey,thickness=5,axes=none,scaling=constrained)]):
 
> tigearti:=proc(j)
> local b,c1;
> b:=evalf(subs(t=j*2*Pi/nbf,B)):c1:=evalf(subs(t=j*2*Pi/nbf,C1)):
> # rejet des valeurs complexes non réelles
> if Im(evalc(c1[1]))<>0 or Im(evalc(c1[2]))<>0 then return c fi:
> display( plot([b,c1],style=line,thickness=5,color=ColorTools[Color]([Cbar])),
> disk(b,0.15,color=ColorTools[Color]([Cbar])),disk(c1,0.15,color=ColorTools[Color]([Cbar]))
>  ) end proc:
 
> animate(tigearti,[k], k=0..nbf, background=c, scaling=constrained, frames=nbf, axes=none);



Est-ce que cela convient?
Revenir en haut de page
Voir le profil de l'utilisateur Envoyer un message privé
michel



Inscrit le: 23 Juin 2006
Messages: 72

MessagePosté le: 07 Oct 2014 9:44    Sujet du message: Répondre en citant

Bonjour ALS, en fait j'ai animé une plaque triangulaire (Th de la Hire) en utilisant des matrices de rotation et non les racines d'une équation.
Cbar:=0.7,0.2,0.2:
A:=[l*cos(t)+l*sin(t)*cot(theta),0];xA:=op(1,A):yA:=op(2,A):#A sur l'axe horizontal
[l cos(t) + l sin(t) cot(theta), 0]
B:=[l*sin(t)*cot(theta),l*sin(t)];xB:=op(1,B):yB:=op(2,B):
[l sin(t) cot(theta), l sin(t)]
R:=Matrix([[cos(phi),sin(phi)],[-sin(phi),cos(phi)]]);
R:=Typesetting:-maction([Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(

cosApplyFunction(?), rowalign = "", columnalign = "", groupalign = "",

rowspan = "1", columnspan = "1"), Typesetting:-mtd(sinApplyFunction(?),

rowalign = "", columnalign = "", groupalign = "", rowspan = "1",

columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""),

Typesetting:-mtr(Typesetting:-mtd(uminus0sinApplyFunction(?), rowalign = "",

columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"),

Typesetting:-mtd(cosApplyFunction(?), rowalign = "", columnalign = "",

groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "",

columnalign = "", groupalign = ""), align = "axis", rowalign = "baseline",

columnalign = "center", groupalign = "{left}", alignmentscope = "true",

columnwidth = "auto", width = "auto", rowspacing = "1.0ex",

columnspacing = "0.8em", rowlines = "none", columnlines = "none",

frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false",

equalcolumns = "false", displaystyle = "false", side = "right",

minlabelspacing = "0.8em")], actiontype = "rtableaddress",

rtableid = "367260096")
V:=Transpose(convert(A,Vector));
V:=Typesetting:-maction([Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(

l cosApplyFunction(t)+l sinApplyFunction(t) cotApplyFunction(?),

rowalign = "", columnalign = "", groupalign = "", rowspan = "1",

columnspan = "1"), Typesetting:-mtd(0, rowalign = "", columnalign = "",

groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "",

columnalign = "", groupalign = ""), align = "axis", rowalign = "baseline",

columnalign = "center", groupalign = "{left}", alignmentscope = "true",

columnwidth = "auto", width = "auto", rowspacing = "1.0ex",

columnspacing = "0.8em", rowlines = "none", columnlines = "none",

frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false",

equalcolumns = "false", displaystyle = "false", side = "right",

minlabelspacing = "0.8em")], actiontype = "rtableaddress",

rtableid = "378593136")

A:=V.R;#produit matriciel A par R
A:=Typesetting:-maction([Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(

(l cosApplyFunction(t)+l sinApplyFunction(t) cotApplyFunction(?)) cos

ApplyFunction(?), rowalign = "", columnalign = "", groupalign = "",

rowspan = "1", columnspan = "1"), Typesetting:-mtd((l cosApplyFunction(t)+l

sinApplyFunction(t) cotApplyFunction(?)) sinApplyFunction(?), rowalign = "",

columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"),

rowalign = "", columnalign = "", groupalign = ""), align = "axis",

rowalign = "baseline", columnalign = "center", groupalign = "{left}",

alignmentscope = "true", columnwidth = "auto", width = "auto",

rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none",

columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex",

equalrows = "false", equalcolumns = "false", displaystyle = "false",

side = "right", minlabelspacing = "0.8em")], actiontype = "rtableaddress",

rtableid = "367260936")
xA:=A[1];yA:=A[2];A:=[xA,yA]:
(l cos(t) + l sin(t) cot(theta)) cos(phi)
(l cos(t) + l sin(t) cot(theta)) sin(phi)
V:=Transpose(convert(B,Vector));
V:=Typesetting:-maction([Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(

l sinApplyFunction(t) cotApplyFunction(?), rowalign = "", columnalign = "",

groupalign = "", rowspan = "1", columnspan = "1"), Typesetting:-mtd(

l sinApplyFunction(t), rowalign = "", columnalign = "", groupalign = "",

rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "",

groupalign = ""), align = "axis", rowalign = "baseline",

columnalign = "center", groupalign = "{left}", alignmentscope = "true",

columnwidth = "auto", width = "auto", rowspacing = "1.0ex",

columnspacing = "0.8em", rowlines = "none", columnlines = "none",

frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false",

equalcolumns = "false", displaystyle = "false", side = "right",

minlabelspacing = "0.8em")], actiontype = "rtableaddress",

rtableid = "367261176")
B:=V.R;#produit matriciel B par R
B:=Typesetting:-maction([Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(

l sinApplyFunction(t) cotApplyFunction(?) cosApplyFunction(?) - l sin

ApplyFunction(t) sinApplyFunction(?), rowalign = "", columnalign = "",

groupalign = "", rowspan = "1", columnspan = "1"), Typesetting:-mtd(l sin

ApplyFunction(t) cotApplyFunction(?) sinApplyFunction(?)+l sinApplyFunction(

t) cosApplyFunction(?), rowalign = "", columnalign = "", groupalign = "",

rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "",

groupalign = ""), align = "axis", rowalign = "baseline",

columnalign = "center", groupalign = "{left}", alignmentscope = "true",

columnwidth = "auto", width = "auto", rowspacing = "1.0ex",

columnspacing = "0.8em", rowlines = "none", columnlines = "none",

frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false",

equalcolumns = "false", displaystyle = "false", side = "right",

minlabelspacing = "0.8em")], actiontype = "rtableaddress",

rtableid = "367261656")
xB:=B[1]:yB:=B[2]:B:=[xB,yB]:
simplify(sqrt((xA-xB)^2+(yA-yB)^2));
csgn(l) l
xH:=(xA*alpha+xB*beta)/(alpha+beta):yH:=(yA*alpha+yB*beta)/(alpha+beta):
H:=[xH,yH]:
S:=Matrix([[cos(tau),sin(tau),0],[-sin(tau),cos(tau),0],[0,0,1]]):
T:=Matrix([[1,0,0],[0,1,0],[-xB,-yB,1]]):
P:=Matrix([[1,0,0],[0,1,0],[xB,yB,1]]):
K:=T.S.P:
M:=Transpose(<xH,yH,1>).K:
xM:=M[1]:yM:=M[2]:M:=[xM,yM]:
E:=M:#coordonnées de E point qui décrit l'ellipse
Bor:=11:
theta:=Pi/4+Pi/12:l:=c:nbf:=200:phi:=-Pi/12:epsilon:=0.00001:alpha:=5:beta:=0.5:tau:=-0.18:
dt:=Pi*2/nbf:
arti:=display([seq(PLOT(POINTS(op(evalf(subs(t=j*2*Pi/nbf,[B,A,M]))),
COLOR(RGB,0,0,0),SYMBOL(CIRCLE,14))),j=0..nbf)],insequence=true):

tiges:=display([seq(PLOT(CURVES(evalf(subs(t=j*Pi*2/nbf,[B,A,M,B])),
COLOR(RGB,Cbar),THICKNESS(3))),j=0..nbf)],thickness=2,insequence=true):
courbe:=animate([op(subs(t=t*w,E)),t=0..2*Pi],w=0..1,frames=nbf+1,color=green):
P1 := display([seq(plottools[polygon](evalf(subs(t = 2*j*Pi/nbf, [B, A, M])),color =magenta,transparency =.9),j=0..nbf)],
insequence=true):
display([plot(tan(theta+phi)*x,x=-Bor..Bor,color=grey,thickness=2),plot(tan(phi)*x,x=-Bor..Bor,color=grey,thickness=2),
arti,tiges,courbe,P1],scaling=constrained,view=[-Bor..Bor,-Bor..Bor],axes=none);
Merci beaucoup.
Revenir en haut de page
Voir le profil de l'utilisateur Envoyer un message privé
Montrer les messages depuis:   
Poster un nouveau sujet   Répondre au sujet    Apprendre Maple Index du Forum -> Maple en géométrie Toutes les heures sont au format GMT + 2 Heures
Page 1 sur 1

 
Sauter vers:  
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


phpBB

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.