From 522f5a10c7f4eda856bb4c3ec72b1e31edbc89cd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 12 Oct 2022 20:11:55 +0000 Subject: profcollege (12oct22) git-svn-id: svn://tug.org/texlive/trunk@64687 c570f23f-e606-0410-a88d-b1316a301751 --- .../metapost/profcollege/PfCEngrenages.mp | 73 ++++++++++++++++++++++ .../metapost/profcollege/PfCLabyNombre.mp | 49 ++++++++++++++- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/metapost/profcollege/PfCEngrenages.mp (limited to 'Master/texmf-dist/metapost') diff --git a/Master/texmf-dist/metapost/profcollege/PfCEngrenages.mp b/Master/texmf-dist/metapost/profcollege/PfCEngrenages.mp new file mode 100644 index 00000000000..12d82c28504 --- /dev/null +++ b/Master/texmf-dist/metapost/profcollege/PfCEngrenages.mp @@ -0,0 +1,73 @@ +color CouleurEngrenage; + +vardef sin(expr t) = sind(c*t) enddef; + +vardef cos(expr t) = cosd(c*t) enddef; + +vardef tan(expr t) = sin(t)/cos(t) enddef; + +vardef Developpante(expr dp)= + save $; + path $; + $=(dp*u)*(1,0) for t=0 step 0.1 until pi: + --((dp*u)*(cos(t)+t*sin(t),sin(t)-t*cos(t))) + endfor; + $ +enddef; + +vardef Entraxe(expr na,nb)= + 0.5*(ModuleEng/u)*(na+nb)+0.04 +enddef; + +vardef Engrenage(expr M,Z,Cc)=%M : Module, Z : nb dents,Cc=Centre + % Pour des engrenages dont le profil est une développante de cercle + save $; + picture $; + ModuleEng:=M*u; + Dp:=ModuleEng*Z;%Module (mm) + + De:=Dp+2*ModuleEng;%Diamètre extérieur + Dpied:=Dp-2.5*ModuleEng;%Diamètre de pied + Alpha:=20;%Angle de pression + Db:=Dp*cosd(Alpha);%Diamètre de base + + pair OPfC,APfC,BPfC,CPfC,Obase[]; + OPfC=(0,0); + path cerclep,cerclee,cercleb,cerclepied; + cerclep=cercles(OPfC,0.5*Dp); + cerclee=cercles(OPfC,0.5*De); + cercleb=cercles(OPfC,0.5*Db); + cerclepied=cercles(OPfC,0.5*Dpied); + path dd,daction,dsupport[],dperp[],dsymetrie,darret; + dd=demidroite(OPfC,OPfC+(0,1)); + APfC=dd intersectionpoint cerclep; + BPfC=dd intersectionpoint cercleb; + path profil; + profil=(symetrie(rotation(Developpante(0.5*Db/(u)),OPfC,90),OPfC,(0,1)) cutafter cerclee);%0.5*Dp*cosd(Alpha)); + %CPfC=dd intersectionpoint cerclepied; + ReleveAngle:=90-angle(profil intersectionpoint cerclep); + dsymetrie=rotation(dd,OPfC,-(360/(4*Z)+ReleveAngle)); + darret=rotation(dd,OPfC,(360/(4*Z)-ReleveAngle)); + pair D; + D=profil intersectionpoint cerclee; + path Profil; + Profil=(reverse(cerclepied) cutbefore darret cutafter dd)--profil--(reverse(cerclee) cutbefore demidroite(OPfC,D) cutafter dsymetrie); + Profil:=Profil--symetrie(reverse(Profil),OPfC,rotation((0,1),OPfC,-(360/(4*Z)+ReleveAngle))); + path ProfilGene; + ProfilGene=Profil + for k=1 upto Z-1: + --rotation(Profil,OPfC,-k*(360/Z)) + endfor + --cycle; + $=image( + fill ProfilGene withcolor CouleurEngrenage; + trace ProfilGene; + fill cercles(OPfC,1u) withcolor blanc; + trace cercles(OPfC,1u); + fill cercles(OPfC,0.85u) withcolor 0.5white; + trace cercles(OPfC,0.85u); + fill rotation((cercles(OPfC,0.25u) shifted (dd intersectionpoint cerclepied)),OPfC,-(360/(4*Z)+ReleveAngle)); + ); + $:=rotation($,OPfC,-90+(360/(4*Z)+ReleveAngle)) shifted Cc; + $ +enddef; diff --git a/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp b/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp index e6877ef34ee..1ef8c396074 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp @@ -42,6 +42,54 @@ def PopChemin= fi; enddef; +def PopCheminMathAlea= + if indiceChemin<1: + RAZPileChemin; + for k=-1 upto LargeurLaby: + for l=-1 upto LongueurLaby: + if (k=-1) or (k=LargeurLaby) or (l=-1) or (l=LongueurLaby): + CaseExploree[k][l]:=true; + else: + CaseExploree[k][l]:=false; + fi; + endfor; + endfor; + Mobile:=Depart; + if Entree="Nord": + CaseExploree[choixligneD-1][choixcolonneD]:=true; + elseif Entree="Sud": + CaseExploree[choixligneD+1][choixcolonneD]:=true; + elseif Entree="Est": + CaseExploree[choixligneD][choixcolonneD+1]:=true; + elseif Entree="Ouest": + CaseExploree[choixligneD][choixcolonneD-1]:=true; + fi; + if SortieUnique: + if (Sortie="Est") or (Sortie="Ouest"): + for k=0 upto LargeurLaby-1: + if k<>choixligneA: + CaseExploree[k][choixcolonneA]:=true; + fi; + endfor; + elseif (Sortie="Nord") or (Sortie="Sud"): + for k=0 upto LongueurLaby-1: + if k<>choixcolonneA: + CaseExploree[choixligneA][k]:=true; + fi; + endfor; + fi; + fi; + PushChemin((choixligneD,choixcolonneD)); + CaseExploree[choixligneD][choixcolonneD]:=true; + VoisinDispo(choixligneD,choixcolonneD); + else: + if indiceChemin>0: + CaseExploree[xpart(PileChemin[indiceChemin])][ypart(PileChemin[indiceChemin])]:=true; + fi; + indiceChemin:=indiceChemin-1; + fi; +enddef; + %Pile des cases voisines de la case parcourue pair PileVoisin[]; numeric indiceVoisin; @@ -152,7 +200,6 @@ vardef murgauche= picture $; path pl[]; $=image( - %pl1=(0,0)--u*(0.15,0)--u*(0.15,0.2){dir180}..u*(0.08+uniformdeviate(0.05),0.2+uniformdeviate(0.1))..u*(0.09+uniformdeviate(0.015),0.3+uniformdeviate(0.2))..u*(0.08+uniformdeviate(0.04),0.5+uniformdeviate(0.2))..{dir0}u*(0.15,0.8)--u*(0.15,1)--u*(0,1)--cycle; pl1=(0,0)--u*(0.1,0)..u*(0.02+uniformdeviate(0.05),0.25)..u*(0.1-uniformdeviate(0.03),0.5)..u*(0.02+uniformdeviate(0.05),0.75)..u*(0.1,1)--u*(0,1)--cycle; remplis pl[1]; trace pl[1]; -- cgit v1.2.3