texlive[65122] Master/texmf-dist: profcollege (27nov22)
commits+karl at tug.org
commits+karl at tug.org
Sun Nov 27 21:51:41 CET 2022
Revision: 65122
http://tug.org/svn/texlive?view=revision&revision=65122
Author: karl
Date: 2022-11-27 21:51:41 +0100 (Sun, 27 Nov 2022)
Log Message:
-----------
profcollege (27nov22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp
trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
Modified: trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp 2022-11-27 20:51:02 UTC (rev 65121)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp 2022-11-27 20:51:41 UTC (rev 65122)
@@ -637,6 +637,37 @@
apj.@:=apj-1;
enddef;
+vardef ObjetSphereNew[](expr Rn)=
+ Outcolor.@:=outcolor;
+ Incolor.@:=incolor;
+ if creux:Ferme.@:=false else: Ferme.@:=true fi;
+ scantokens("numeric "&substring(0,1) of Rn&"; "&Rn&";");
+ vardef Famille(expr u,v)=(R*(cos(u)*cos(v),cos(u)*sin(v),sin(u))) enddef;
+ umin:=-pi/2; upas:=pi/nb; umax:=pi/2;
+ vmin:=-pi; vpas:=2*pi/subh; vmax:=pi;
+ apj:=0;
+ %On cr\xE9e les facettes et on calcule la profondeur en Z.
+ for k=0 upto (nb-1):
+ for l=0 upto (subh-1):
+ tcpt.@[apj]:=apj;
+ OTFc.@[apj].nb:=4;
+ OTFc.@[apj][1]:=Image(Famille(umin+(k+1)*upas,vmin+l*vpas));
+ OTFc.@[apj][2]:=Image(Famille(umin+k*upas,vmin+l*vpas));
+ OTFc.@[apj][3]:=Image(Famille(umin+k*upas,vmin+(l+1)*vpas));
+ OTFc.@[apj][4]:=Image(Famille(umin+(k+1)*upas,vmin+(l+1)*vpas));
+ OTFc.@[apj].iso:=(OTFc.@[apj][1]+OTFc.@[apj][2]+OTFc.@[apj][3]+OTFc.@[apj][4])/4;
+ ALT.@[apj]:=-Zpart(GCoord(OTFc.@[apj].iso));
+ if ProduitScalaire(Oeil-OTFc.@[apj].iso,Normal(OTFc.@[apj].iso,OTFc.@[apj][1],OTFc.@[apj][2]))>=0:
+ Vue.@[apj]:=true;coul.@[apj]:=outcolor;
+ else:
+ Vue.@[apj]:=false;coul.@[apj]:=incolor;
+ fi;
+ apj:=apj+1;
+ endfor;
+ endfor;
+ apj.@:=apj-1;
+enddef;
+
vardef Objetcalotte[](expr Rn,Phib,Phih)=
Outcolor.@:=outcolor;
Incolor.@:=incolor;
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty 2022-11-27 20:51:02 UTC (rev 65121)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty 2022-11-27 20:51:41 UTC (rev 65122)
@@ -4,7 +4,7 @@
\NeedsTeXFormat{LaTeX2e}%
\def\filedate{2022/12/01}%
\let\PfCfiledate\filedate%
-\def\fileversion{0.99-z-b}%
+\def\fileversion{0.99-z-c}%
\let\PfCfileversion\fileversion%
\ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]
@@ -51,6 +51,7 @@
\RequirePackage{iftex}
\ifluatex
+\RequirePackage{luacas}
\RequirePackage{luamplib}
\everymplib{input PfCSvgnames; input PfCConstantes; input PfCGeometrie; input PfCAfficheur; beginfig(1);}
\everyendmplib{endfig;}
@@ -347,6 +348,954 @@
}
%%%
+% Barres de calculs
+%%%
+\setKVdefault[SuiteBarre]{Litteral=false,Perso=false,Decimaux=false}
+
+\NewDocumentCommand\BarresCalculs{o m m}{%
+ \useKVdefault[SuiteBarre]%
+ \setKV[SuiteBarre]{#1}%
+ \xdef\PfCListeCalculsBarre{}%
+ \xdef\PfCListeResultatsBarre{}%
+ \ignoreemptyitems%
+ \ifboolKV[SuiteBarre]{Perso}{%
+ \setsepchar[*]{,*§}%
+ \readlist*\PfCListeBarresCalculs{#2}%
+ \foreachitem\compteur\in\PfCListeBarresCalculs{%
+ \StrChar{#3}{\compteurcnt}[\PfCLettreB]%
+ \StrSubstitute[0]{\PfCLettreB}{*}{Départ}[\PfCLettreC]%
+ \xdef\PfCListeResultatsBarre{\PfCListeResultatsBarre \PfCLettreC,}%
+ }%
+ \setsepchar{,}%
+ \readlist*\PfCListeResultats{\PfCListeResultatsBarre}%
+ \begin{NiceTabular}{ccc}[hvlines]
+ \xintFor* ##1 in{\xintSeq{1}{\PfCListeResultatslen}}\do{%
+ \xintifForFirst{\Block{2-1}{}}{\Block{2-1}{\ifboolKV[SuiteBarre]{Decimaux}{%
+ \num{\fpeval{\PfCListeBarresCalculs[\fpeval{##1-1},1]}}%
+ }{%
+ \begin{CAS}
+ c = \PfCListeBarresCalculs[\fpeval{##1-1},1]
+ \end{CAS}$\print{c:autosimplify()}$}%
+ }}&\Block{2-1}{\PfCListeResultats[##1]}&\Block{2-1}{$\PfCListeBarresCalculs[##1,2]$}\\
+ &&\\
+ }%
+ \end{NiceTabular}
+ }{%
+ \setsepchar{,}%\ignoreemptyitems%
+ \readlist*\PfCListeBarresCalculs{#2}%
+ \ifboolKV[SuiteBarre]{Litteral}{%
+ \foreachitem\compteur\in\PfCListeBarresCalculs{%
+ \StrChar{#3}{\compteurcnt}[\PfCLettreB]%
+ \StrSubstitute[0]{\PfCLettreB}{*}{Départ}[\PfCLettreC]%
+ \xdef\PfCListeResultatsBarre{\PfCListeResultatsBarre \PfCLettreC,}%
+ }%
+ \setsepchar[*]{,*/}%
+ \readlist*\PfCListeResultats{\PfCListeResultatsBarre}%
+ \setsepchar{,}%
+ \readlist*\PfCListeCalculs{#2}%
+ \begin{NiceTabular}{ccc}[hvlines]
+ \xintFor* ##1 in{\xintSeq{1}{\PfCListeResultatslen}}\do{%
+ \xintifForFirst{\Block{2-1}{}}{\Block{2-1}{$\print{c:expand():topolynomial()}$}}&\Block{2-1}{\PfCListeResultats[##1,1]}&\Block{2-1}{\begin{CAS}
+ vars('x')
+ c = \PfCListeCalculs[##1]
+ \end{CAS}$\print{c}$}\\
+ &&\\
+ }%
+ \end{NiceTabular}
+ }{%
+ \foreachitem\compteur\in\PfCListeBarresCalculs{%
+ \StrChar{#3}{\compteurcnt}[\PfCLettreB]%
+ \StrSubstitute[0]{\PfCLettreB}{*}{Départ}[\PfCLettreC]%
+ \xdef\PfCListeResultatsBarre{\PfCListeResultatsBarre \num{\fpeval{\compteur}}/\PfCLettreC,}%
+ \StrSubstitute[0]{\compteur}{*}{\times}[\PfCListeResultatEtapeA]%
+ \StrSubstitute[0]{\PfCListeResultatEtapeA}{/}{\div}[\PfCListeResultatEtapeB]%
+ \StrSubstitute[0]{\PfCListeResultatEtapeB}{(}{\left(}[\PfCListeResultatEtapeC]%
+ \StrSubstitute[0]{\PfCListeResultatEtapeC}{)}{\right)}[\PfCListeResultatEtapeD]%
+ \xdef\PfCListeCalculsBarre{\PfCListeCalculsBarre $\PfCListeResultatEtapeD$,}%
+ }%
+ \setsepchar[*]{,*/}%
+ \readlist*\PfCListeResultats{\PfCListeResultatsBarre}%
+ \setsepchar{,}%
+ \readlist*\PfCListeCalculs{\PfCListeCalculsBarre}%
+ \begin{NiceTabular}{ccc}[hvlines]
+ \xintFor* ##1 in{\xintSeq{1}{\PfCListeResultatslen}}\do{%
+ \xintifForFirst{\Block{2-1}{}}{\Block{2-1}{\PfCListeResultats[\fpeval{##1-1},1]}}&\Block{2-1}{\PfCListeResultats[##1,2]}&\Block{2-1}{\PfCListeCalculs[##1]}\\
+ &&\\
+ }%
+ \end{NiceTabular}
+ }%
+ }%
+ \reademptyitems%
+}%
+
+%%%
+% Solide et sections
+%%%
+\setKVdefault[ClesSolides]{Nom=cube,Aretes,Sommets,Pointilles,Largeur=1.5,Hauteur=1,Profondeur=0.75,ListeSommets={A,B,C,D,E,F,G,H},Rho=1500,Phi=30,Theta=20,Distance=50,Code=false,Couleur=white,Anglex=0,RayonCone=1,HauteurCone=2,HauteurPyramide=2,SommetsPyramide=5,Reguliere=false,DecalageSommet={(0,0,0)},RayonCylindre=1,HauteurCylindre=2,RayonSphere=1,AutoLabel=true,Sections=false,CoefSection=0.3,Axes=false,PointsSection={M,N,O,P},RemplisSection=false,ObjetSection={0.5,E,H,0.25,F,G,G,B}}%
+\defKV[ClesSolides]{Traces=\setKV[ClesSolides]{Code}}%
+\defKV[ClesSolides]{Section=\setKV[ClesSolides]{Sections}}%
+\defKV[ClesSolides]{CouleurSection=\setKV[ClesSolides]{RemplisSection}}%
+
+\newcommand\MPSolideCylindre[3]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ input PfCSolid;
+
+ boolean NommeSommets,Code,Sections,Axes,RemplisSection;
+ NommeSommets=\useKV[ClesSolides]{Sommets};
+ Code=\useKV[ClesSolides]{Code};
+ Sections:=\useKV[ClesSolides]{Sections};
+ Axes:=\useKV[ClesSolides]{Axes};
+ RemplisSection=\useKV[ClesSolides]{RemplisSection};
+ if RemplisSection:color CouleurSection;CouleurSection=\useKV[ClesSolides]{CouleurSection};fi;
+ %Initialisation
+ PfCRho=\useKV[ClesSolides]{Rho};
+ PfCPhi=\useKV[ClesSolides]{Phi};
+ PfCTheta=\useKV[ClesSolides]{Theta};
+ PfCDistance=\useKV[ClesSolides]{Distance};
+ CoefSection=\useKV[ClesSolides]{CoefSection};
+ anglerotationx=\useKV[ClesSolides]{Anglex};
+ rayoncylindre=\useKV[ClesSolides]{RayonCylindre};
+ hauteurcylindre=\useKV[ClesSolides]{HauteurCylindre};
+
+ string Section;
+ if Sections:Section=\useKV[ClesSolides]{Section};fi;
+
+ color PfCOutColor;
+ PfCOutColor=\useKV[ClesSolides]{Couleur};
+
+ vardef BaseCylindre(text t)=
+ save Cer;
+ picture Cer;
+ save n;
+ n:=0;
+ for p_=t:
+ if color p_:
+ n:=n+1;
+ _T[n]:=p_;
+ fi;
+ endfor;
+ pascercle:=5;
+ color ptcer[];
+ for k=0 step pascercle until (360+pascercle) :
+ ptcer[k div pascercle]-_T[1]=Distance(_T[1],_T[2])*((_T[4]-_T[3])*cosd(k)/Distance(_T[3],_T[4])+(_T[5]-_T[3])*sind(k)/Distance(_T[3],_T[5]));
+ endfor;
+ %
+ color ddcer,cccer;
+ nbpointilles:=0;
+ nbtraces:=0;
+ path PathSection[];
+ nbpathsection:=0;
+ Cer=image(%
+ for k=0 step pascercle until 360:
+ ddcer:=Oeil-ptcer[k div pascercle];
+ cccer:=-Normal(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle],ptcer[k div pascercle]+Sommet1-Sommet2);
+ if (ProduitScalaire(ddcer,cccer)>=0):
+ nbtraces:=nbtraces+1;
+ if (nbtraces=1) and (nbpointilles>0):
+ draw chemin(ptcer[k div pascercle],ptcer[k div pascercle]+Sommet1-Sommet2);
+ fi;
+ nbpathsection:=nbpathsection+1;
+ PathSection[nbpathsection]=chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ draw chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ draw chemin(ptcer[k div pascercle]+Sommet1-Sommet2,ptcer[(k+pascercle) div pascercle]+Sommet1-Sommet2);
+ else:
+ nbpointilles:=nbpointilles+1;
+ nbtraces:=0;
+ if (nbpointilles=1):
+ draw chemin(ptcer[k div pascercle],ptcer[k div pascercle]+Sommet1-Sommet2);
+ fi;
+ if k mod (2*pascercle)=0:
+ nbpathsection:=nbpathsection+1;
+ PathSection[nbpathsection]=chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ draw chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ draw chemin(ptcer[k div pascercle]+Sommet1-Sommet2,ptcer[(k+pascercle) div pascercle]+Sommet1-Sommet2);
+ fi;
+ fi;
+ endfor;
+ );
+ Cer
+ enddef;
+
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
+% Initialisation(1500,30,20,50);
+ typetrace:="3D";
+ typerepre:="persp";
+ eclairage:=false;
+ nb:=36;%36
+ subh:=1;%
+ incolor:=white;
+ outcolor:=PfCOutColor;
+ Ferme1:=true;
+ angx:=anglerotationx;
+ Objetcylindre1("r="&decimal(rayoncylindre),"h="&decimal(hauteurcylindre));
+ eclairage:=false;
+% traits:=false;
+% AffichageObjet1;
+
+ color O,S,A,M,B,C,D,Sommet[];
+ Sommet2=(0,0,0);
+ Sommet1-Sommet2=(0,0,hauteurcylindre);
+ Sommet3-Sommet2=rayoncylindre*(cosd(0),-sind(0),0);
+ Sommet4-Sommet2=rayoncylindre*(cosd(90),-sind(90),0);
+ color MSection[];
+ MSection[1]-Sommet2=rayoncylindre*(CoefSection,sin(arccos(CoefSection)),0);
+ MSection[7]-Sommet2=rayoncylindre*(CoefSection+0.01,sin(arccos(CoefSection+0.01)),0);
+ MSection[2]-Sommet2=rayoncylindre*(CoefSection,-sin(arccos(CoefSection)),0);
+ MSection[3]-MSection[2]=Sommet1-Sommet2;
+ MSection[4]-MSection[1]=Sommet1-Sommet2;
+ MSection[5]-Sommet2=CoefSection[Sommet1,Sommet2];
+ MSection[6]-MSection[5]=MSection[2]-MSection[1];
+ Sommet1:=RotXYZ(Sommet1);
+ Sommet2:=RotXYZ(Sommet2);
+ Sommet3:=RotXYZ(Sommet3);
+ Sommet4:=RotXYZ(Sommet4);
+ MSection[1]:=RotXYZ(MSection[1]);
+ MSection[2]:=RotXYZ(MSection[2]);
+ MSection[3]:=RotXYZ(MSection[3]);
+ MSection[4]:=RotXYZ(MSection[4]);
+ MSection[5]:=RotXYZ(MSection[5]);
+ MSection[6]:=RotXYZ(MSection[6]);
+ MSection[7]:=RotXYZ(MSection[7]);
+
+ trace BaseCylindre(Sommet2,Sommet3,Sommet2,Sommet3,Sommet4);
+ currentpicture:=nullpicture;
+
+ if Sections:
+ if Section="parallele":
+ if RemplisSection:
+ fill polygone(MSection[1],MSection[2],MSection[3],MSection[4]) withcolor CouleurSection;
+ fi;
+ color dcer,ccer;
+ invnormale:=if CoefSection<=0:-1 else:1 fi;
+ %1er côté et 3eme côté : face "basse" et face "haute"
+ dcer:=Oeil-Sommet3;
+ ccer:=-Normal(Sommet3,MSection1,MSection2);
+ draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ draw chemin(MSection3,MSection4) if (ProduitScalaire(dcer,ccer)>0):dashed evenly fi;
+ % 2eme côté et 4eme coté
+ dcer:=Oeil-MSection7;
+ ccer:=-Normal(MSection7,MSection4,MSection1);
+ draw chemin(MSection4,MSection1) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ draw chemin(MSection2,MSection3) if (ProduitScalaire(dcer,ccer)>0):dashed evenly fi;
+ else:
+ if RemplisSection:
+ fill (PathSection[1] for p_=2 upto nbpathsection:--PathSection[p_] endfor--cycle) shifted(Projette(CoefSection[Sommet1,Sommet2]-Sommet2)) withcolor CouleurSection;
+ fi;
+ for p_=1 upto nbpathsection:
+ draw (PathSection[p_] shifted(Projette(CoefSection[Sommet1,Sommet2]-Sommet2)));
+ endfor;
+ fi;
+ fi;
+
+ trace BaseCylindre(Sommet2,Sommet3,Sommet2,Sommet3,Sommet4);
+
+ color dcer,ccer;
+ dcer:=Oeil-Sommet2;
+ ccer:=Normal(Sommet2,Sommet3,Sommet4);
+ if (ProduitScalaire(dcer,ccer)>=0):
+ draw Cercles(Sommet2,Sommet3,Sommet2,Sommet3,Sommet4);
+ fi;
+ dcer:=Oeil-Sommet1;
+ ccer:=Normal(Sommet1,Sommet4+Sommet1-Sommet2,Sommet3+Sommet1-Sommet2);
+ if (ProduitScalaire(dcer,ccer)>=0):
+ draw Cercles(Sommet1,Sommet3+Sommet1-Sommet2,Sommet1,Sommet3+Sommet1-Sommet2,Sommet4+Sommet1-Sommet2);
+ fi;
+
+ vardef EcrireSommets(text t)=
+ nb:=0;
+ for p_=t:
+ nb:=nb+1;
+ if bluepart(Sommet1)>bluepart(Sommet2):
+ if nb=1:
+ label.ulft(TEX(p_),Projette(Sommet1));%p_
+ elseif nb=2:
+ dotlabel.rt(TEX(p_),Projette(Sommet2));%p_
+ fi;
+ else:
+ if nb=1:
+ label.bot(TEX(p_),Projette(Sommet1));
+ elseif nb=2:
+ dotlabel.ulft(TEX(p_),Projette(Sommet2));
+ fi;
+ fi;
+ endfor;
+ enddef;
+
+ DefinirSommets(#1);
+ DefinirSommetsSection(#3);
+
+ if Axes:
+ draw segment(1.5[Sommet1,Sommet2],1.5[Sommet2,Sommet1]) dashed dashpattern(on6 off3 on3 off 3);
+ remplis (fullcircle scaled 1mm) shifted(Projette(Sommet1));
+ remplis (fullcircle scaled 1mm) shifted(Projette(Sommet2));
+ fi;
+
+ if Code:
+ \useKV[ClesSolides]{Traces};
+ fi;
+
+ \end{mplibcode}
+ \fi
+}
+
+\newcommand\MPSolidePyramide[4]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+
+ input PfCSolid;
+
+ boolean Pointilles,TraceArete,NommeSommets,Code,Reguliere,AutoLabel,Sections,RemplisSection;
+ Sections:=\useKV[ClesSolides]{Sections};
+ RemplisSection=\useKV[ClesSolides]{RemplisSection};
+ if RemplisSection:color CouleurSection;CouleurSection=\useKV[ClesSolides]{CouleurSection};fi;
+ AutoLabel:=\useKV[ClesSolides]{AutoLabel};
+ Pointilles=\useKV[ClesSolides]{Pointilles};
+ TraceArete=\useKV[ClesSolides]{Aretes};
+ NommeSommets=\useKV[ClesSolides]{Sommets};
+ Code=\useKV[ClesSolides]{Code};
+ Reguliere:=\useKV[ClesSolides]{Reguliere};
+ % Initialisation
+ PfCRho=\useKV[ClesSolides]{Rho};
+ PfCPhi=\useKV[ClesSolides]{Phi};
+ PfCTheta=\useKV[ClesSolides]{Theta};
+ PfCDistance=\useKV[ClesSolides]{Distance};
+ CoefSection=\useKV[ClesSolides]{CoefSection};
+ anglerotationx=\useKV[ClesSolides]{Anglex};
+ hauteurpyramide=\useKV[ClesSolides]{HauteurPyramide};
+ nombresommets=\useKV[ClesSolides]{SommetsPyramide};
+ color PfCOutColor,DecalageSommet;
+ PfCOutColor=\useKV[ClesSolides]{Couleur};
+ DecalageSommet=if Reguliere:(0,0,0) else: #3 fi;
+
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
+ typetrace:="3D";
+ typerepre:="persp";
+ if Pointilles=false:
+ pointilles:="non";
+ fi;
+
+ Ferme1:=true;
+
+ color O,A[],S;
+ O=(0,0,0);
+ S-O=(0,0,hauteurpyramide)+DecalageSommet;
+
+ NbS:=nombresommets;
+ Sommet1:=S;
+ ecartangle=360/(NbS-1);
+ for k=2 upto NbS:
+ if Reguliere:
+ repereangle:=(k-2)*ecartangle;
+ else:
+ repereangle:=(k-2)*ecartangle+(ecartangle*0.25+uniformdeviate(floor(ecartangle/2)));
+ fi;
+ Sommet[k]:=(cosd(repereangle),-sind(repereangle),0);
+ endfor;
+ Sommet[NbS+1]:=Sommet[2];
+
+ color TS[];
+ for k=1 upto (NbS+1):
+ TS[k]=Sommet[k];
+ endfor;
+ color PiedHauteur;
+ PiedHauteur=ProjectionsurPlan(Sommet1,Sommet2,Sommet3,Sommet4);
+ eclairage:=false;
+ traits:=false;
+ outcolor:=PfCOutColor;
+ angx:=anglerotationx;
+ for k=1 upto (NbS+1):
+ TS[k]:=RotXYZ(TS[k]);
+ endfor;
+ angx:=0;
+
+ color MSection[];
+ for p_=2 upto NbS:
+ MSection[p_-1]=CoefSection[Sommet[1],Sommet[p_]];
+ endfor;
+
+ DefinirSommetsSection(#4);
+
+ vardef SectionPyramide(expr fracsection)=
+ save Section;
+ picture Section;
+ Section=image(%
+ if RemplisSection:
+ remplis polygone(fracsection[Sommet1,Sommet2],for p_=3 upto NbS-1:fracsection[Sommet1,Sommet[p_]],endfor fracsection[Sommet1,Sommet[NbS]]) withcolor CouleurSection;
+ fi;
+ color dcer,ccer;
+ for p_=2 upto NbS:
+ dcer:=Oeil-Sommet[p_];
+ ccer:=-Normal(Sommet1,Sommet[p_],Sommet[p_+1]);
+ if (ProduitScalaire(dcer,ccer)>=0):
+ draw chemin(fracsection[Sommet1,Sommet[p_]],fracsection[Sommet1,Sommet[p_+1]]);
+ else:
+ draw chemin(fracsection[Sommet1,Sommet[p_]],fracsection[Sommet1,Sommet[p_+1]]) dashed evenly;
+ fi;
+ endfor;
+ );
+ Section
+ enddef;
+
+ ObjetNew1(%
+ TS1, for k=2 upto NbS:TS[k], endfor TS[NbS+1]
+ )(%
+ NbS-1, for p_=2 upto NbS:p_, endfor
+ for p=2 upto NbS:
+ 3,1,p+1,p,%
+ endfor);
+ AffichageObjet1;
+
+ Sommet[NbS+1]:=Sommet[2];
+
+ if Sections:
+ draw SectionPyramide(CoefSection);
+ fi;
+
+ NF:=NbS;%nombresommets;
+ % Fc[100] est la base
+ Fc[100]:=NbS-1;
+ for k=2 upto NbS:
+ Fc[100+k-1]:=k;
+ endfor;
+ for k=2 upto NF:
+ Fc[k*100]:=3;
+ Fc[k*100+1]:=1;
+ Fc[k*100+2]:=k+1;
+ Fc[k*100+3]:=k;
+ endfor;
+ DessineObjet;
+
+ vardef EcrireSommets(text t)=
+ if AutoLabel:
+ nb:=0;
+ for p_=t:
+ nb:=nb+1;
+ if nb<NbS+1:
+ if nb>1:
+ label(TEX(""&p_&""),1.1[Projette(Sommet1),Projette(Sommet[nb])]);
+ else:
+ label(TEX(p_),1.1[Projette(Sommet[2]),Projette(Sommet[1])]);
+ fi;
+ fi;
+ endfor;
+ fi;
+ enddef;
+
+ DefinirSommets(#1);
+
+ if TraceArete=false:
+ currentpicture:=nullpicture;
+ fi;
+ if NommeSommets:
+ EcrireSommets(#2);
+ fi;
+ u:=0.25u;
+ marque_p:="croix";
+ nbcroix=0;
+ for p_=#1:
+ nbcroix:=nbcroix+1;
+ if nbcroix<NbS+1:
+ pointe(p_);
+ fi;
+ endfor;
+ u:=1cm;
+ if Code:
+ \useKV[ClesSolides]{Traces};
+ fi;
+
+ \end{mplibcode}
+ \fi
+}
+
+\newcommand\MPSolideCone[3]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ boolean NommeSommets,Code,Sections,Axes,RemplisSection;
+ NommeSommets=\useKV[ClesSolides]{Sommets};
+ Code=\useKV[ClesSolides]{Code};
+ Axes:=\useKV[ClesSolides]{Axes};
+ Sections=\useKV[ClesSolides]{Sections};
+ RemplisSection=\useKV[ClesSolides]{RemplisSection};
+ if RemplisSection:color CouleurSection;CouleurSection=\useKV[ClesSolides]{CouleurSection};fi;
+ %Initialisation
+ PfCRho=\useKV[ClesSolides]{Rho};
+ PfCPhi=\useKV[ClesSolides]{Phi};
+ PfCTheta=\useKV[ClesSolides]{Theta};
+ PfCDistance=\useKV[ClesSolides]{Distance};
+ CoefSection=\useKV[ClesSolides]{CoefSection};
+ anglerotationx=\useKV[ClesSolides]{Anglex};
+ rayoncone=\useKV[ClesSolides]{RayonCone};
+ hauteurcone=\useKV[ClesSolides]{HauteurCone};
+
+ color PfCOutColor;
+ PfCOutColor=\useKV[ClesSolides]{Couleur};
+ input PfCSolid;
+
+ vardef BaseCone(text t)=
+ save Cer;
+ picture Cer;
+ save n;
+ n:=0;
+ for p_=t:
+ if color p_:
+ n:=n+1;
+ _T[n]:=p_;
+ fi;
+ endfor;
+ pascercle:=5;
+ color ptcer[];
+ for k=0 step pascercle until (360+pascercle) :
+ ptcer[k div pascercle]-_T[1]=Distance(_T[1],_T[2])*((_T[4]-_T[3])*cosd(k)/Distance(_T[3],_T[4])+(_T[5]-_T[3])*sind(k)/Distance(_T[3],_T[5]));
+ endfor;
+ %
+ color ddcer,cccer;
+ nbpointilles:=0;
+ nbtraces:=0;
+ Cer=image(%
+ for k=0 step pascercle until 360:
+ ddcer:=Oeil-ptcer[k div pascercle];
+ cccer:=-Normal(Sommet1,ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ if (ProduitScalaire(ddcer,cccer)>=0):
+ nbtraces:=nbtraces+1;
+ if (nbtraces=1) and (nbpointilles>0):
+ draw chemin(ptcer[k div pascercle],Sommet1);
+ fi;
+ draw chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ else:
+ nbpointilles:=nbpointilles+1;
+ nbtraces:=0;
+ if (nbpointilles=1):
+ draw chemin(ptcer[k div pascercle],Sommet1);
+ fi;
+ if k mod (2*pascercle)=0:
+ draw chemin(ptcer[k div pascercle],ptcer[(k+pascercle) div pascercle]);
+ fi;
+ fi;
+ endfor;
+ );
+ Cer
+ enddef;
+
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
+ typetrace:="3D";
+ typerepre:="persp";
+ eclairage:=false;
+ nb:=36;%36
+ subh:=1;%
+ incolor:=white;
+ outcolor:=PfCOutColor;
+ Ferme1:=true;
+ angx:=anglerotationx;
+ Objetcone1("r="&decimal(rayoncone),"h="&decimal(hauteurcone));
+ traits:=false;
+ AffichageObjet1;
+
+ color Sommet[];%O,S,A,M,B,C,D,
+ Sommet2=(0,0,0);
+ Sommet1-Sommet2=(0,0,hauteurcone);
+ Sommet3-Sommet2=rayoncone*(cosd(0),-sind(0),0);
+ Sommet4-Sommet2=rayoncone*(cosd(90),-sind(90),0);
+ Sommet1:=RotXYZ(Sommet1);
+ Sommet3:=RotXYZ(Sommet3);
+ Sommet4:=RotXYZ(Sommet4);
+
+ color MSection[];
+ MSection[1]=CoefSection[Sommet1,Sommet2];
+
+ DefinirSommetsSection(#3);
+
+ if Sections:
+ if RemplisSection:
+ remplis Cercles(CoefSection[Sommet1,Sommet2],CoefSection[Sommet1,Sommet3],CoefSection[Sommet1,Sommet2],CoefSection[Sommet1,Sommet3],CoefSection[Sommet1,Sommet4]) withcolor CouleurSection;
+ fi;
+ trace BaseCone(CoefSection[Sommet1,Sommet2],CoefSection[Sommet1,Sommet3],CoefSection[Sommet1,Sommet2],CoefSection[Sommet1,Sommet3],CoefSection[Sommet1,Sommet4]);
+ fi;
+
+ trace BaseCone(Sommet2,Sommet3,Sommet2,Sommet3,Sommet4);
+ color dcer,ccer;
+ dcer:=Oeil-Sommet2;
+ ccer:=Normal(Sommet2,Sommet3,Sommet4);
+ if (ProduitScalaire(dcer,ccer)>=0):
+ draw Cercles(Sommet2,Sommet3,Sommet2,Sommet3,Sommet4);
+ fi;
+
+ vardef EcrireSommets(text t)=
+ nb:=0;
+ for p_=t:
+ nb:=nb+1;
+ if bluepart(Sommet1)>bluepart(Sommet2):
+ if nb=1:
+ label.ulft(TEX(p_),Projette(Sommet1));
+ elseif nb=2:
+ dotlabel.rt(TEX(p_),Projette(Sommet2));
+ fi;
+ else:
+ if nb=1:
+ label.bot(TEX(p_),Projette(Sommet1));
+ elseif nb=2:
+ dotlabel.ulft(TEX(p_),Projette(Sommet2));
+ fi;
+ fi;
+ endfor;
+ enddef;
+
+ DefinirSommets(#1);
+
+ if Axes:
+ draw segment(1.5[Sommet1,Sommet2],1.5[Sommet2,Sommet1]) dashed dashpattern(on6 off3 on3 off 3);
+ remplis (fullcircle scaled 1mm) shifted(Projette(Sommet1));
+ remplis (fullcircle scaled 1mm) shifted(Projette(Sommet2));
+ fi;
+
+ if Code:
+ \useKV[ClesSolides]{Traces};
+ fi;
+
+ \end{mplibcode}
+ \fi
+}
+
+\newcommand\MPSolidePave[5]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ input PfCSolid;
+
+ boolean Pointilles,TraceArete,NommeSommets,Code,AutoLabel,Sections,RemplisSection;
+ AutoLabel:=\useKV[ClesSolides]{AutoLabel};
+ Pointilles=\useKV[ClesSolides]{Pointilles};
+ TraceArete=\useKV[ClesSolides]{Aretes};
+ NommeSommets=\useKV[ClesSolides]{Sommets};
+ Code=\useKV[ClesSolides]{Code};
+ Sections:=\useKV[ClesSolides]{Sections};
+ RemplisSection=\useKV[ClesSolides]{RemplisSection};
+ if RemplisSection:color CouleurSection;CouleurSection=\useKV[ClesSolides]{CouleurSection};fi;
+
+ string Section;
+ if Sections:Section=\useKV[ClesSolides]{Section};fi;
+
+ %Initialisation
+ PfCRho=\useKV[ClesSolides]{Rho};
+ PfCPhi=\useKV[ClesSolides]{Phi};
+ PfCTheta=\useKV[ClesSolides]{Theta};
+ PfCDistance=\useKV[ClesSolides]{Distance};
+
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
+ typetrace:="3D";
+ typerepre:="persp";
+ if Pointilles=false:
+ pointilles:="non";
+ fi;
+ color A,B,C,D,E,F,G,H;
+ color Sommet[];
+ trace Pave(A,B,C,D,E,F,G,H)(#3);
+ currentpicture:=nullpicture;
+ Sommet1=A;
+ Sommet2=B;
+ Sommet3=C;
+ Sommet4=D;
+ Sommet5=E;
+ Sommet6=F;
+ Sommet7=G;
+ Sommet8=H;
+
+ DefinirSommets(#1);
+
+ color MSection[];
+ numeric RetiensSection[];
+ numretienssection:=0;
+ color RetiensDefSection[];
+ numretiensdefsection:=0;
+ if Sections:
+ if Section="arete":
+ for p_=#5:
+ if numeric p_:
+ numretienssection:=numretienssection+1;
+ RetiensSection[numretienssection]=p_;
+ elseif color p_:
+ numretiensdefsection:=numretiensdefsection+1;
+ RetiensDefSection[numretiensdefsection]=p_;
+ fi;
+ endfor;
+ % On dessine la section
+ MSection[1]=(RetiensSection[1])[RetiensDefSection[1],RetiensDefSection[2]];
+ MSection[2]=(RetiensSection[2])[RetiensDefSection[3],RetiensDefSection[4]];
+ MSection[3]-MSection[2]=RetiensDefSection[6]-RetiensDefSection[5];
+ MSection[4]-MSection[1]=RetiensDefSection[6]-RetiensDefSection[5];
+ if RemplisSection:
+ fill polygone(MSection1,MSection2,MSection3,MSection4) withcolor CouleurSection;
+ fi;
+% DotLabel.top(TEX("M1"),MSection[1]);
+% DotLabel.top(TEX("M2"),MSection[2]);
+% DotLabel.top(TEX("M3"),MSection[3]);
+% DotLabel.top(TEX("M4"),MSection[4]);
+% if RemplisSection:
+% fill polygone(MSection1,MSection2,MSection3,MSection4) withcolor CouleurSection;
+% fi;
+% trace polygone(MSection1,MSection2,MSection3,MSection4);
+ color dcer,ccer;
+ % 1er cote -> ok
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]);
+ draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ % 2eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[3],RetiensDefSection[4]+RetiensDefSection[6]-RetiensDefSection[5]);
+ draw chemin(MSection2,MSection3) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ % 3eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]);
+ draw chemin(MSection3,MSection4) if (ProduitScalaire(dcer,ccer)>=0):dashed evenly fi;
+ % 4eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[3],RetiensDefSection[4]+RetiensDefSection[6]-RetiensDefSection[5]);
+ draw chemin(MSection4,MSection1) if (ProduitScalaire(dcer,ccer)>=0):dashed evenly fi;
+ else:
+ %face
+ for p_=#5:
+ if numeric p_:
+ numretienssection:=numretienssection+1;
+ RetiensSection[numretienssection]=p_;
+ elseif color p_:
+ numretiensdefsection:=numretiensdefsection+1;
+ RetiensDefSection[numretiensdefsection]=p_;
+ fi;
+ endfor;
+ % On dessine la section
+ MSection[1]=(RetiensSection[1])[RetiensDefSection[1],RetiensDefSection[2]];
+ MSection[2]-MSection[1]=RetiensDefSection[4]-RetiensDefSection[3];
+ MSection[3]-MSection[2]=RetiensDefSection[5]-RetiensDefSection[4];
+ MSection[4]-MSection[1]=MSection[3]-MSection[2];
+% DotLabel.top(TEX("M1"),MSection[1]);
+% DotLabel.top(TEX("M2"),MSection[2]);
+% DotLabel.top(TEX("M3"),MSection[3]);
+% DotLabel.top(TEX("M4"),MSection[4]);
+ if RemplisSection:
+ fill polygone(MSection1,MSection2,MSection3,MSection4) withcolor CouleurSection;
+ fi;
+ color dcer,ccer;
+ % 1er cote -> ok
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]);
+ draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ % 2eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[5],RetiensDefSection[4],RetiensDefSection[5]+RetiensDefSection[1]-RetiensDefSection[2]);
+ draw chemin(MSection2,MSection3) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
+ % 3eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]);
+ draw chemin(MSection3,MSection4) if (ProduitScalaire(dcer,ccer)>=0):dashed evenly fi;
+ % 4eme cote
+ dcer:=Oeil-RetiensDefSection[4];
+ ccer:=Normal(RetiensDefSection[5],RetiensDefSection[4],RetiensDefSection[5]+RetiensDefSection[1]-RetiensDefSection[2]);
+ draw chemin(MSection4,MSection1) if (ProduitScalaire(dcer,ccer)>=0):dashed evenly fi;
+ fi;
+ %On trace la section considérée
+ %trace polygone(MSection1,MSection2,MSection3,MSection4);
+ fi;
+
+ trace Pave(A,B,C,D,E,F,G,H)(#3);
+
+ DefinirSommetsSection(#4);
+
+ if TraceArete=false:
+ currentpicture:=nullpicture;
+ fi;
+ if NommeSommets:
+ EcrireSommetsPave(#2);
+ fi;
+ u:=0.25u;
+ marque_p:="croix";
+ nbcroix=0;
+ for p_=#1:
+ nbcroix:=nbcroix+1;
+ if nbcroix=4:
+ if Pointilles:
+ pointe(p_);
+ fi;
+ else:
+ pointe(p_);
+ fi;
+ endfor;
+ u:=1cm;
+ if Code:
+ \useKV[ClesSolides]{Traces};
+ fi;
+ \end{mplibcode}
+ \fi
+}
+
+\newcommand\MPSolideSphere[3]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ boolean NommeSommets,Code,Sections,Axes,RemplisSection;
+ NommeSommets=\useKV[ClesSolides]{Sommets};
+ Code=\useKV[ClesSolides]{Code};
+ Axes:=\useKV[ClesSolides]{Axes};
+ Sections=\useKV[ClesSolides]{Sections};
+ RemplisSection=\useKV[ClesSolides]{RemplisSection};
+ if RemplisSection:color CouleurSection;CouleurSection=\useKV[ClesSolides]{CouleurSection};fi;
+ %Initialisation
+ PfCRho=\useKV[ClesSolides]{Rho};
+ PfCPhi=0;%\useKV[ClesSolides]{Phi};
+ PfCTheta=10;%\useKV[ClesSolides]{Theta};
+ PfCDistance=\useKV[ClesSolides]{Distance};
+ CoefSection=\useKV[ClesSolides]{CoefSection};
+ anglerotationx=\useKV[ClesSolides]{Anglex};
+ rayonsphere=\useKV[ClesSolides]{RayonSphere};
+
+ color PfCOutColor;
+ PfCOutColor=\useKV[ClesSolides]{Couleur};
+ input PfCSolid;
+
+ vardef BaseSphere=
+ save Cer;
+ picture Cer;
+ color PtInter.iso,PtInter[];
+ vardef Famille(expr u,v)=(R*(cos(u)*cos(v),cos(u)*sin(v),sin(u))) enddef;
+ subh:=72;
+ Cer=image(%
+ if Sections:
+ if RemplisSection:fill (Cercles(Image((0,0,0)),Image((0,1,0)),Image((0,0,0)),Image((0,1,0)),Image((-1,0,0))) scaled (sqrt(1-(abs(CoefSection+0.02))**2))) shifted(Projette(MSection1-Sommet1)) withcolor CouleurSection; fi;
+ fi;
+ %Equateur
+ umin:=0; umax:=pi/nb; upas:=pi/nb;
+ vmin:=0; vpas:=2*pi/subh; vmax:=2*pi;
+ for l=0 upto subh-1:
+ PtInter[1]:=Image(Famille(umin+(0+1)*upas,vmin+l*vpas));
+ PtInter[2]:=Image(Famille(umin+0*upas,vmin+l*vpas));
+ PtInter[3]:=Image(Famille(umin+0*upas,vmin+(l+1)*vpas));
+ PtInter[4]:=Image(Famille(umin+(0+1)*upas,vmin+(l+1)*vpas));
+ PtInter.iso:=(PtInter[1]+PtInter[2]+PtInter[3]+PtInter[4])/4;
+ if ProduitScalaire(Oeil-PtInter.iso,Normal(PtInter.iso,PtInter[4],PtInter[1]))>=0:
+ if Sections:
+ draw (segment(PtInter[3],PtInter[2]) scaled (sqrt(1-(abs(CoefSection+0.02))**2))) shifted(Projette(MSection1-Sommet1));
+ fi;
+ draw segment(PtInter[3],PtInter[2]);
+ else:
+ if l mod 2=0:
+ if Sections:
+ draw (segment(PtInter[3],PtInter[2]) scaled (sqrt(1-(abs(CoefSection+0.02))**2))) shifted(Projette(MSection1-Sommet1));
+ fi;
+ draw segment(PtInter[3],PtInter[2]);
+ fi;
+ fi;
+ endfor;
+
+ % "Exterieur"
+ nb:=72;
+ subh:=18;
+ umin:=-pi; umax:=pi; upas:=2*pi/nb;
+ vpas:=2*pi/subh; vmin:=pi/2; vmax:=2*pi;
+ for k=0 upto nb-1:
+ PtInter[1]:=Image(Famille(umin+(k+1)*upas,vmin+0*vpas));
+ PtInter[2]:=Image(Famille(umin+k*upas,vmin+0*vpas));
+ PtInter[3]:=Image(Famille(umin+k*upas,vmin+(0+1)*vpas));
+ PtInter[4]:=Image(Famille(umin+(k+1)*upas,vmin+(0+1)*vpas));
+ PtInter.iso:=(PtInter[1]+PtInter[2]+PtInter[3]+PtInter[4])/4;
+ draw segment(PtInter[2],PtInter[1]);
+ endfor;
+ );
+ Cer
+ enddef;
+
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
+ typetrace:="3D";
+ typerepre:="persp";
+ eclairage:=false;
+ nb:=24;%36
+ subh:=36;%
+ incolor:=blue;
+ outcolor:=white;%PfCOutColor;
+ Ferme1:=true;
+ angx:=anglerotationx;
+ Objetsphere1("R="&decimal(rayonsphere));
+ % traits:=false;
+ % AffichageObjet1;
+ color Sommet[],SommetN,SommetS,SommetB;
+ Sommet1=(0,0,0);
+ Sommet2=(0,rayonsphere,0);
+ Sommet3=(-rayonsphere,0,0);
+ Sommet4=(0,0,rayonsphere);
+ SommetN=Sommet4;
+ SommetS=(0,0,-rayonsphere);
+ SommetB=(rayonsphere,0,0);
+ Sommet2:=RotXYZ(Sommet2);
+ Sommet3:=RotXYZ(Sommet3);
+ Sommet4:=RotXYZ(Sommet4);
+ SommetN:=RotXYZ(SommetN);
+ SommetS:=RotXYZ(SommetS);
+ SommetB:=RotXYZ(SommetB);
+ color MSection[];
+ MSection[1]=CoefSection[Sommet1,SommetN];
+ MSection[2]=Image((0,sqrt(1-CoefSection**2),CoefSection));
+
+ trace BaseSphere;
+
+ DefinirSommets(#1);
+ DefinirSommetsSection(#3);
+
+ if Axes:
+ draw segment(1.25[SommetN,SommetS],1.25[SommetS,SommetN]) dashed dashpattern(on6 off3 on3 off3);
+ remplis (fullcircle scaled 1mm) shifted(Projette(SommetN));
+ remplis (fullcircle scaled 1mm) shifted(Projette(SommetS));
+ fi;
+
+ if Code:
+ \useKV[ClesSolides]{Traces};
+ fi;
+
+ \end{mplibcode}
+ \fi
+}
+
+\def\UpdatetoksSolide#1\nil{\addtotok\toksolidelistesommets{"#1",}}
+\newtoks\toksolidelistesommets%
+\newtoks\toksolidelistepointssections%
+
+\newcommand\Solide[1][]{%
+ \useKVdefault[ClesSolides]%
+ \setKV[ClesSolides]{#1}%
+ \setsepchar{,}\ignoreemptyitems%
+ \xdef\foo{\useKV[ClesSolides]{ListeSommets}}%
+ \readlist*\ListeNomSommet{\foo}%\showitems\ListeNomSommet
+ \reademptyitems%
+ \toksolidelistesommets{}
+ \foreachitem\compteur\in\ListeNomSommet{\expandafter\UpdatetoksSolide\compteur\nil}%\the\toksolidelistesommets%
+ \IfStrEqCase{\useKV[ClesSolides]{Nom}}{%
+ {cube}{%
+ \MPSolidePave{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{1,1,1}{\useKV[ClesSolides]{PointsSection}}{\useKV[ClesSolides]{ObjetSection}}%
+ }%
+ {pave}{%
+ \MPSolidePave{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{\useKV[ClesSolides]{Profondeur},\useKV[ClesSolides]{Largeur},\useKV[ClesSolides]{Hauteur}}{\useKV[ClesSolides]{PointsSection}}{\useKV[ClesSolides]{ObjetSection}}%
+ }%
+ {cone}{%
+ \MPSolideCone{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{\useKV[ClesSolides]{PointsSection}}%
+ }%
+ {pyramide}{%
+ \MPSolidePyramide{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{\useKV[ClesSolides]{DecalageSommet}}{\useKV[ClesSolides]{PointsSection}}%
+ }%
+ {cylindre}{%
+ \MPSolideCylindre{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{\useKV[ClesSolides]{PointsSection}}%
+ }%
+ {sphere}{%
+ \MPSolideSphere{\useKV[ClesSolides]{ListeSommets}}{\the\toksolidelistesommets}{\useKV[ClesSolides]{PointsSection}}%
+ }%
+ }%
+}%
+
+%%%
% Vue Cubes
%%%
\setKVdefault[VueCubes]{Solution=false,Hauteur=5,Profondeur=4,Largeur=3,Angle=60,Nom=Ex1,Trou=false,Echelle=0.25,CouleurCube=LightSteelBlue,CouleurFleche=LightGray,Face=false,Creation=false,Grilles=false}
@@ -7933,21 +8882,30 @@
}%
%%% Dessin Gradue %%%
-\setKVdefault[DessinGradue]{Lignes=10,Debut=-5,Fin=5,Pas=10,Solution=false,EcartVertical=1.5,LignesIdentiques,Longueur=10,Echelle=1,Droites=false}
+\setKVdefault[DessinGradue]{Lignes=10,Debut=-5,Fin=5,Pas=10,Solution=false,EcartVertical=1.5,LignesIdentiques,Longueur=10,Echelle=1,Droites=false,DemiDroites=false}
-\def\TraceDessinGradue#1#2#3#4{%
+\def\TraceDessinGradue#1#2#3#4#5#6{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
pair La,Lb,Lab[];
+ pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
La=(0,0);
Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+ boolean Solution;
+ Solution=\useKV[DessinGradue]{Solution};
for k=0 upto #4:
Lab[k]=(k/#4)[La,Lb];
endfor;
picture EnsembleLignes,Lignes;
Lignes=image(
+ if \useKV[DessinGradue]{Droites}:
+ drawarrow 1.05[Lb,La]--1.05[La,Lb];
+ elseif \useKV[DessinGradue]{DemiDroites}:
+ drawarrow La--1.05[La,Lb];
+ else:
trace segment(La,Lb);
+ fi;
for k=0 upto #4:
trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
endfor;
@@ -7957,72 +8915,15 @@
labeloffset:=labeloffset/1.5;
);
EnsembleLignes=image(
+ if Solution:
+ drawoptions(withcolor 0.5white);
+ fi;
for k=0 upto #1-1:
trace Lignes shifted(k*u*(0,-\useKV[DessinGradue]{EcartVertical}));
label(TEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,-k*\useKV[DessinGradue]{EcartVertical}));
endfor;
- );
- trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
- \end{mplibcode}
- \else
- \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
- pair La,Lb,Lab[];
- La=(0,0);
- Lb-La=u*(LongueurLigne,0);
- for k=0 upto #4:
- Lab[k]=(k/#4)[La,Lb];
- endfor;
- picture EnsembleLignes,Lignes;
- Lignes=image(
- trace segment(La,Lb);
- for k=0 upto #4:
- trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
- endfor;
- labeloffset:=labeloffset*1.5;
- label.top(LATEX("\num{"&decimal(#2)&"}"),La);
- label.top(LATEX("\num{"&decimal(#3)&"}"),Lb);
- labeloffset:=labeloffset/1.5;
- );
- EnsembleLignes=image(
- for k=0 upto #1-1:
- trace Lignes shifted(k*u*(0,-EcartVertical));
- label(LATEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,-k*EcartVertical));
- endfor;
- );
- trace EnsembleLignes scaled Echelle;
- \end{mpost}
- \fi
-}
-
-\def\TraceDessinGradueSolution#1#2#3#4#5#6{%
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- pair La,Lb,Lab[];
- pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
- La=(0,0);
- Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
- for k=0 upto #4:
- Lab[k]=(k/#4)[La,Lb];
- endfor;
- picture EnsembleLignes,Lignes;
- Lignes=image(
- trace segment(La,Lb);
- for k=0 upto #4:
- trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
- endfor;
- labeloffset:=labeloffset*1.5;
- label.top(TEX("\num{"&decimal(#2)&"}"),La);
- label.top(TEX("\num{"&decimal(#3)&"}"),Lb);
- labeloffset:=labeloffset/1.5;
- );
- EnsembleLignes=image(%
- drawoptions(withcolor 0.5white);
- for k=0 upto #1-1:
- trace Lignes shifted(k*u*(0,-\useKV[DessinGradue]{EcartVertical}));
- label(TEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,k*(-\useKV[DessinGradue]{EcartVertical})));
- endfor;
drawoptions();
+ if Solution:
n:=0;
numeric nblignes,nbpas;
for p_=#5:
@@ -8038,11 +8939,12 @@
for p_=#6:
trace p_ withpen pencircle scaled 1.5;
endfor;
+ fi;
);
trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+ \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle}; boolean Solution,Droites,DemiDroites; Solution=\useKV[DessinGradue]{Solution};Droites=\useKV[DessinGradue]{Droites};DemiDroites=\useKV[DessinGradue]{DemiDroites};}]
pair La,Lb,Lab[];
pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
La=(0,0);
@@ -8052,7 +8954,13 @@
endfor;
picture EnsembleLignes,Lignes;
Lignes=image(
+ if Droites:
+ drawarrow 1.05[Lb,La]--1.05[La,Lb];
+ elseif DemiDroites:
+ drawarrow La--1.05[La,Lb];
+ else:
trace segment(La,Lb);
+ fi;
for k=0 upto #4:
trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
endfor;
@@ -8062,12 +8970,15 @@
labeloffset:=labeloffset/1.5;
);
EnsembleLignes=image(
+ if Solution:
drawoptions(withcolor 0.5white);
+ fi;
for k=0 upto #1-1:
trace Lignes shifted(k*u*(0,-EcartVertical));
- label(LATEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,k*(-EcartVertical)));
+ label(LATEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,-k*EcartVertical));
endfor;
drawoptions();
+ if Solution:
n:=0;
numeric nblignes,nbpas;
for p_=#5:
@@ -8083,6 +8994,7 @@
for p_=#6:
trace p_ withpen pencircle scaled 1.5;
endfor;
+ fi;
);
trace EnsembleLignes scaled Echelle;
\end{mpost}
@@ -8089,93 +9001,47 @@
\fi
}
-\def\TraceDessinGradueMul#1{%
+\def\TraceDessinGradueMul#1#2#3{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
pair La,Lb,Lab[];
La=(0,0);
+ pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+ EcartVertical=\useKV[DessinGradue]{EcartVertical};
+ boolean Solution;
+ Solution=\useKV[DessinGradue]{Solution};
picture EnsembleLignes,Lignes;
EnsembleLignes=image(
+ if Solution:
+ drawoptions(withcolor 0.5white);
+ fi;
n:=0;
m:=0;
for p_=#1:
n:=n+1;
- trace segment(La,Lb) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
- label(TEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
- for k=0 upto bluepart(p_):
- m:=bluepart(p_);
- Lab[k]:=(k/m)[La,Lb];
- trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
- endfor;
- labeloffset:=labeloffset*1.5;
- label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
- label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
- labeloffset:=labeloffset/1.5;
- endfor;
- );
- trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
- \end{mplibcode}
- \else
- \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
- pair La,Lb,Lab[];
- La=(0,0);
- Lb-La=u*(LongueurLigne,0);
- picture EnsembleLignes,Lignes;
- EnsembleLignes=image(
- n:=0;
- m:=0;
- for p_=#1:
- n:=n+1;
+ if \useKV[DessinGradue]{Droites}:
+ drawarrow (1.05[Lb,La]--1.05[La,Lb]) shifted((n-1)*u*(0,-EcartVertical));
+ elseif \useKV[DessinGradue]{DemiDroites}:
+ drawarrow (La--1.05[La,Lb]) shifted((n-1)*u*(0,-EcartVertical));
+ else:
trace segment(La,Lb) shifted((n-1)*u*(0,-EcartVertical));
+ fi;
+ label(TEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*EcartVertical));
for k=0 upto bluepart(p_):
m:=bluepart(p_);
+ retienspas[n]:=m;
Lab[k]:=(k/m)[La,Lb];
trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-EcartVertical));
- label(LATEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
endfor;
labeloffset:=labeloffset*1.5;
- label.top(LATEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
- label.top(LATEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
+ label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
+ label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
labeloffset:=labeloffset/1.5;
endfor;
- );
- trace EnsembleLignes scaled Echelle;
- \end{mpost}
- \fi
-}
-
-\def\TraceDessinGradueMulSolution#1#2#3{%
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- pair La,Lb,Lab[];
- pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
- La=(0,0);
- Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
- picture EnsembleLignes,Lignes;
- EnsembleLignes=image(%
- drawoptions(withcolor 0.5white);
- n:=0;
- m:=0;
- numeric retienspas[];
- for p_=#1:
- n:=n+1;
- trace segment(La,Lb) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
- label(TEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
- for k=0 upto bluepart(p_):
- m:=bluepart(p_);
- retienspas[n]:=bluepart(p_);
- Lab[k]:=(k/m)[La,Lb];
- trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
- endfor;
- labeloffset:=labeloffset*1.5;
- label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
- label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
- labeloffset:=labeloffset/1.5;
- endfor;
drawoptions();
+ if Solution:
n:=0;
numeric nblignes,nbpas;
for p_=#2:
@@ -8192,37 +9058,46 @@
for p_=#3:
trace p_ withpen pencircle scaled 1.5;
endfor;
+ fi;
);
trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+ \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle}; boolean Solution,Droites,DemiDroites; Solution=\useKV[DessinGradue]{Solution}; Droites=\useKV[DessinGradue]{Droites}; DemiDroites=\useKV[DessinGradue]{DemiDroites};}]
pair La,Lb,Lab[];
+ La=(0,0);
pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
- La=(0,0);
Lb-La=u*(LongueurLigne,0);
picture EnsembleLignes,Lignes;
EnsembleLignes=image(
+ if Solution:
+ drawoptions(withcolor 0.5white);
+ fi;
n:=0;
m:=0;
- numeric retienspas[];
- drawoptions(withcolor 0.5white);
for p_=#1:
n:=n+1;
+ if Droites:
+ drawarrow (1.05[Lb,La]--1.05[La,Lb]) shifted((n-1)*u*(0,-EcartVertical));
+ elseif DemiDroites:
+ drawarrow (La--1.05[La,Lb]) shifted((n-1)*u*(0,-EcartVertical));
+ else:
trace segment(La,Lb) shifted((n-1)*u*(0,-EcartVertical));
- label(LATEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
+ fi;
+ label(LATEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*EcartVertical));
for k=0 upto bluepart(p_):
m:=bluepart(p_);
- retienspas[n]:=bluepart(p_);
+ retienspas[n]:=m;
Lab[k]:=(k/m)[La,Lb];
trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-EcartVertical));
endfor;
labeloffset:=labeloffset*1.5;
- label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
- label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
+ label.top(LATEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
+ label.top(LATEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
labeloffset:=labeloffset/1.5;
endfor;
drawoptions();
+ if Solution:
n:=0;
numeric nblignes,nbpas;
for p_=#2:
@@ -8239,6 +9114,7 @@
for p_=#3:
trace p_ withpen pencircle scaled 1.5;
endfor;
+ fi;
);
trace EnsembleLignes scaled Echelle;
\end{mpost}
@@ -8253,47 +9129,36 @@
\newcommand\DessinGradue[4][]{%
\useKVdefault[DessinGradue]%
\setKV[DessinGradue]{#1}%
- \ifboolKV[DessinGradue]{Droites}{%
- %en travail
+ \ifboolKV[DessinGradue]{LignesIdentiques}{%
+ \newtoks\toklisteptsgrad%
+ \newtoks\toklistetracesgrad%
+ \ifboolKV[DessinGradue]{Solution}{%
+ \setsepchar[*]{,*/}%
+ \readlist\ListePG{#3}%
+ \setsepchar[*]{§*/}%
+ \readlist\ListeTraces{#4}%
+ \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
+ \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
+ }{}%
+ \TraceDessinGradue{\useKV[DessinGradue]{Lignes}}{\useKV[DessinGradue]{Debut}}{\useKV[DessinGradue]{Fin}}{\useKV[DessinGradue]{Pas}}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
+ }{%
\setsepchar[*]{,*/}%
- \readlist\ListeDefDroites{#2}%
- \newtoks\toklistedefdroites%
- \foreachitem\compteur\in\ListeDefDroites{\expandafter\UpdateDefDroites\compteur\nil}%
- %en travail
- }{%
- \ifboolKV[DessinGradue]{LignesIdentiques}{%
- \ifboolKV[DessinGradue]{Solution}{%
- \setsepchar[*]{,*/}%
- \readlist\ListePG{#3}%
- \setsepchar[*]{§*/}%
- \readlist\ListeTraces{#4}%
- \newtoks\toklisteptsgrad%
- \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
- \newtoks\toklistetracesgrad%
- \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
- \TraceDessinGradueSolution{\useKV[DessinGradue]{Lignes}}{\useKV[DessinGradue]{Debut}}{\useKV[DessinGradue]{Fin}}{\useKV[DessinGradue]{Pas}}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
- }{%
- \TraceDessinGradue{\useKV[DessinGradue]{Lignes}}{\useKV[DessinGradue]{Debut}}{\useKV[DessinGradue]{Fin}}{\useKV[DessinGradue]{Pas}}%
- }%
- }{%
+ \readlist\ListeDefLigne{#2}%
+ \xdef\toklistedefligne{}%
+ \foreachitem\compteur\in\ListeDefLigne{%
+ \xdef\toklistedefligne{\toklistedefligne (\ListeDefLigne[\compteurcnt,1],\ListeDefLigne[\compteurcnt,2],\ListeDefLigne[\compteurcnt,3]),}%
+ }%
+ \newtoks\toklisteptsgrad%
+ \newtoks\toklistetracesgrad%
+ \ifboolKV[DessinGradue]{Solution}{%
\setsepchar[*]{,*/}%
- \readlist\ListeDefLigne{#2}%
- \newtoks\toklistedefligne%
- \foreachitem\compteur\in\ListeDefLigne{\expandafter\UpdateDefLignes\compteur\nil}%
- \ifboolKV[DessinGradue]{Solution}{%
- \setsepchar[*]{,*/}%
- \readlist\ListePG{#3}%
- \setsepchar[*]{§*/}%
- \readlist\ListeTraces{#4}%
- \newtoks\toklisteptsgrad%
- \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
- \newtoks\toklistetracesgrad%
- \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
- \TraceDessinGradueMulSolution{\the\toklistedefligne}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
- }{%
- \TraceDessinGradueMul{\the\toklistedefligne}%
- }%
- }%
+ \readlist\ListePG{#3}%
+ \setsepchar[*]{§*/}%
+ \readlist\ListeTraces{#4}%
+ \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
+ \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
+ }{}%
+ \TraceDessinGradueMul{\toklistedefligne}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
}%
}%
@@ -19024,7 +19889,7 @@
%%%
% Fonction
%%%
-\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false}
+\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Epaisseur=1}
\newtoks\toklistePtsFn%pour la discipline
@@ -19109,10 +19974,10 @@
draw Fn[0]
for k=1 upto N:
..Fn[k]
- endfor;
+ endfor withpen pencircle scaled \useKV[ClesFonction]{Epaisseur};
\end{mplibcode}
\else
- \begin{mpost}
+ \begin{mpost}[mpsettings={numeric Epaisseur; Epaisseur=\useKV[ClesFonction]{Epaisseur};}]
x.u:=#2;
y.u:=#3;
X.u:=#4;
@@ -19181,7 +20046,7 @@
draw Fn[0]
for k=1 upto N:
..Fn[k]
- endfor;
+ endfor withpen pencircle scaled Epaisseur;
\end{mpost}
\fi
}
@@ -19267,11 +20132,11 @@
for k=1 upto (N-1):
..{dir dirav[k]}Fn[k]{dir dirap[k]}
endfor
- ..{dir dirav[N]}Fn[N];
+ ..{dir dirav[N]}Fn[N] withpen pencircle scaled \useKV[ClesFonction]{Epaisseur};
\end{mplibcode}
\else
- \begin{mpost}
- x.u:=#2;
+ \begin{mpost}[mpsettings={numeric Epaisseur; Epaisseur=\useKV[ClesFonction]{Epaisseur};}]
+ x.u:=#2;
y.u:=#3;
X.u:=#4;
Y.u:=#5;
@@ -19310,7 +20175,7 @@
MaxY:=ypart(Gn[k]);
fi;
endfor;
- if #6=0:
+ if #6=0:
for k=MinY-1 step y.u until MaxY+1:
draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
endfor;
@@ -19348,11 +20213,129 @@
for k=1 upto (N-1):
..{dir dirav[k]}Fn[k]{dir dirap[k]}
endfor
- ..{dir dirav[N]}Fn[N];
+ ..{dir dirav[N]}Fn[N] withpen pencircle scaled Epaisseur;
\end{mpost}
\fi
}
+\def\MPCatmull#1#2#3#4#5{%
+ % #1 la liste des points
+ % #2: pas en x
+ % #3: pas en y
+ % #4: unit\'e en x
+ % #5: unit\'e en y
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ x.u:=#2;
+ y.u:=#3;
+ X.u:=#4;
+ Y.u:=#5;
+ numeric dirav[],dirap[];
+ pair Fn[],Gn[];
+ n=0;
+ for p_=#1:
+ Gn[n]=p_;
+ Fn[n]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+ n:=n+1;
+ endfor;
+ N:=(n-1);
+ MinX=999;
+ MaxX=-999;
+ MinY=999;
+ MaxY=-999;
+ for k=0 upto N:
+ if xpart(Gn[k])<MinX:
+ MinX:=xpart(Gn[k]);
+ fi;
+ if xpart(Gn[k])>MaxX:
+ MaxX:=xpart(Gn[k]);
+ fi;
+ if ypart(Gn[k])<MinY:
+ MinY:=ypart(Gn[k]);
+ fi;
+ if ypart(Gn[k])>MaxY:
+ MaxY:=ypart(Gn[k]);
+ fi;
+ endfor;
+ for k=MinY-1 step y.u until MaxY+1:
+ draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+ endfor;
+ for k=MinX-1 step x.u until MaxX+1:
+ draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+ endfor;
+ for k=0 upto N:
+ fill cercles(Fn[k],0.5mm);
+ endfor;
+ drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+ drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+ %
+ label.llft(btex O etex,(0,0));
+ dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+ dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+ %
+ draw Fn[1]
+ for k=2 upto N-1:
+ ..{dir angle(Fn[k+1]-Fn[k-1])}Fn[k]{dir angle(Fn[k+1]-Fn[k-1])}
+ endfor withpen pencircle scaled \useKV[ClesFonction]{Epaisseur};
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={numeric Epaisseur; Epaisseur=\useKV[ClesFonction]{Epaisseur};}]
+ x.u:=#2;
+ y.u:=#3;
+ X.u:=#4;
+ Y.u:=#5;
+ numeric dirav[],dirap[];
+ pair Fn[],Gn[];
+ n=0;
+ for p_=#1:
+ Gn[n]=p_;
+ Fn[n]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+ n:=n+1;
+ endfor;
+ N:=(n-1);
+ MinX=999;
+ MaxX=-999;
+ MinY=999;
+ MaxY=-999;
+ for k=0 upto N:
+ if xpart(Gn[k])<MinX:
+ MinX:=xpart(Gn[k]);
+ fi;
+ if xpart(Gn[k])>MaxX:
+ MaxX:=xpart(Gn[k]);
+ fi;
+ if ypart(Gn[k])<MinY:
+ MinY:=ypart(Gn[k]);
+ fi;
+ if ypart(Gn[k])>MaxY:
+ MaxY:=ypart(Gn[k]);
+ fi;
+ endfor;
+ for k=MinY-1 step y.u until MaxY+1:
+ draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+ endfor;
+ for k=MinX-1 step x.u until MaxX+1:
+ draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+ endfor;
+ for k=0 upto N:
+ fill cercles(Fn[k],0.5mm);
+ endfor;
+ drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+ drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+ %
+ label.llft(btex O etex,(0,0));
+ dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+ dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+ %
+ draw Fn[1]
+ for k=2 upto N-1:
+ ..{dir angle(Fn[k+1]-Fn[k-1])}Fn[k]{dir angle(Fn[k+1]-Fn[k-1])}
+ endfor withpen pencircle scaled Epaisseur;
+ \end{mpost}
+ \fi
+}%
+
\newcommand\Fonction[2][]{%
\useKVdefault[ClesFonction]%
\setKV[ClesFonction]{#1}%
@@ -19365,23 +20348,32 @@
\toklistePtsFn{}%
\setsepchar[*]{§*/}%\ignoreemptyitems%
\readlist*\ListePoints{#2}%
- \ifboolKV[ClesFonction]{Tangentes}{%
+ \ifboolKV[ClesFonction]{Catmull}{%
+ \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}
\foreachitem\compteur\in\ListePoints{%
- \expandafter\UpdatePtsFn\compteur\nil%
+ \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}%
}%
- \ifboolKV[ClesFonction]{Prolonge}{%
- \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
- }{%
- \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
- }%
+ \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\ListePointslen,2],\ListePoints[\ListePointslen,3]),}%
+ \MPCatmull{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}%
}{%
- \foreachitem\compteur\in\ListePoints{%
- \expandafter\UpdatePtsFN\compteur\nil%
- }%
- \ifboolKV[ClesFonction]{Prolonge}{%
- \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
+ \ifboolKV[ClesFonction]{Tangentes}{%
+ \foreachitem\compteur\in\ListePoints{%
+ \expandafter\UpdatePtsFn\compteur\nil%
+ }%
+ \ifboolKV[ClesFonction]{Prolonge}{%
+ \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
+ }{%
+ \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
+ }%
}{%
- \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
+ \foreachitem\compteur\in\ListePoints{%
+ \expandafter\UpdatePtsFN\compteur\nil%
+ }%
+ \ifboolKV[ClesFonction]{Prolonge}{%
+ \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
+ }{%
+ \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
+ }%
}%
}%
}{%
@@ -19419,7 +20411,7 @@
%%%
% Diff\'erentes représentations graphiques
%%%
-\setKVdefault[TraceG]{Grille=false,Graduations=false,PasGradX=1,PasGradY=1,PasGrilleX=1,PasGrilleY=1,Xmin=-5.5,Xmax=5.5,Xstep=1,Ymin=-5.5,Ymax=5.5,Ystep=1,Bornea=-5.5,Borneb=5.5,LabelX={},LabelY={},LabelC=0.5,NomCourbe={},Origine={(5.5,5.5)},Fonction=false,Points=false,Invisible=false,CouleurPoint=red,CouleurTrace=black,Relie=false,RelieSegment=false,Marque=dot}
+\setKVdefault[TraceG]{Grille=false,Graduations=false,PasGradX=1,PasGradY=1,PasGrilleX=1,PasGrilleY=1,Xmin=-5.5,Xmax=5.5,Xstep=1,Ymin=-5.5,Ymax=5.5,Ystep=1,Bornea=-5.5,Borneb=5.5,LabelX={},LabelY={},LabelC=0.5,NomCourbe={},Origine={(5.5,5.5)},Fonction=false,Points=false,Invisible=false,CouleurPoint=red,CouleurTrace=black,Epaisseur=1,Relie=false,RelieSegment=false,Marque=dot}
\newcommand\TraceGraphique[2][]{%
\useKVdefault[TraceG]%
@@ -19637,7 +20629,8 @@
gradx=\useKV[TraceG]{PasGradX};
grady=\useKV[TraceG]{PasGradY};
pos=\useKV[TraceG]{LabelC};
-
+ Epaisseur:=\useKV[TraceG]{Epaisseur};
+
color colortrace;
colortrace=\useKV[TraceG]{CouleurTrace};
@@ -19720,12 +20713,12 @@
dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(xpart(Origine*cm),k*y.u+ypart(Origine*cm)));
endfor;
fi;
- drawoptions(withpen pencircle scaled1.5);
+ drawoptions(withpen pencircle scaled(1));
drawarrow (u*(0,ymin)--u*(0,ymax)) shifted (u*(xpart(Origine),0));
drawarrow (u*(xmin,0)--u*(xmax,0)) shifted (u*(0,ypart(Origine)));
label.llft(btex 0 etex,u*Origine);
drawoptions();
- draw courbe1(borneinf,bornesup,100)(#2) withcolor colortrace;
+ draw courbe1(borneinf,bornesup,100)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace;
% labelisation
numeric t;
t=pos*length Cb1;
@@ -19743,7 +20736,7 @@
\usepackage{ProfCollege}
\setKV[TraceG]{#1}
}
- \begin{mpost}[mpsettings={borneinf=\useKV[TraceG]{Bornea};bornesup=\useKV[TraceG]{Borneb};xmin=\useKV[TraceG]{Xmin};xmax=\useKV[TraceG]{Xmax};ymin=\useKV[TraceG]{Ymin};ymax=\useKV[TraceG]{Ymax};pasx=\useKV[TraceG]{Xstep};pasy=\useKV[TraceG]{Ystep};xu=1cm/\useKV[TraceG]{Xstep};yu=1cm/\useKV[TraceG]{Ystep};grillex=\useKV[TraceG]{PasGrilleX};grilley=\useKV[TraceG]{PasGrilleY};pos=\useKV[TraceG]{LabelC};color colortrace;colortrace=\useKV[TraceG]{CouleurTrace};boolean Grille;Grille=\useKV[TraceG]{Grille};boolean Graduations;Graduations=\useKV[TraceG]{Graduations};
+ \begin{mpost}[mpsettings={borneinf=\useKV[TraceG]{Bornea};bornesup=\useKV[TraceG]{Borneb};xmin=\useKV[TraceG]{Xmin};xmax=\useKV[TraceG]{Xmax};ymin=\useKV[TraceG]{Ymin};ymax=\useKV[TraceG]{Ymax};pasx=\useKV[TraceG]{Xstep};pasy=\useKV[TraceG]{Ystep};xu=1cm/\useKV[TraceG]{Xstep};yu=1cm/\useKV[TraceG]{Ystep};grillex=\useKV[TraceG]{PasGrilleX};grilley=\useKV[TraceG]{PasGrilleY};pos=\useKV[TraceG]{LabelC};Epaisseur=\useKV[TraceG]{Epaisseur}; color colortrace;colortrace=\useKV[TraceG]{CouleurTrace};boolean Grille;Grille=\useKV[TraceG]{Grille};boolean Graduations;Graduations=\useKV[TraceG]{Graduations};
pair Origine;
Origine=(xmin,ymin)+\useKV[TraceG]{Origine};}]
@@ -19821,7 +20814,7 @@
drawarrow (u*(0,ymin)--u*(0,ymax)) shifted (u*(xpart(Origine),0));
drawarrow (u*(xmin,0)--u*(xmax,0)) shifted (u*(0,ypart(Origine)));
drawoptions();
- draw courbe1(borneinf,bornesup,100)(#2) withcolor colortrace;
+ draw courbe1(borneinf,bornesup,100)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace;
% % labelisation
numeric t;
t=pos*length Cb1;
@@ -22714,7 +23707,7 @@
if p_<>"":
drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3));
label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(valeur[n],-1)));
- pointe(unitp*(valeur[n]-ValeurOrigine,0));
+ pointe(unitp*(valeur[n],0));
fi;
elseif AffichageCoord=2:
if p_<>"":
@@ -22856,7 +23849,7 @@
if p_<>"":
drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3));
label.bot(btex \noexpand\hbox to2em{\noexpand\dotfill} etex,(unitp*(valeur[n],-1)));
- pointe(unitp*(valeur[n]-ValeurOrigine,0));
+ pointe(unitp*(valeur[n],0));
fi;
elseif AffichageCoord=2:
if p_<>"":
@@ -25540,7 +26533,7 @@
\setlength{\PfCLongInter}{-40pt+\fpeval{\useKV[Tableur]{LargeurUn}}pt+\fpeval{(\useKV[Tableur]{Colonnes}-2)*\useKV[Tableur]{Largeur}}pt+\fpeval{2*\useKV[Tableur]{Colonnes}-6}\tabcolsep+\fpeval{\useKV[Tableur]{Colonnes}+2}\arrayrulewidth}%
\ifboolKV[Tableur]{Bandeau}{%
\begin{NiceTabular}{p{\PfCTableurLargeur}p{10pt}p{50pt}p{\PfCLongInter}}
- \Block[draw]{}{\useKV[Tableur]{Cellule}}&\Block[draw]{}{\scriptsize$\blacktriangledown$}&\Block{}{$f_x$\hfill$\sum$~\scriptsize$\blacktriangledown$\hfill$=$}&\Block[draw]{}{\useKV[Tableur]{Formule}\hfill\scriptsize$\blacktriangledown$}\\
+ \Block[draw,l]{}{\useKV[Tableur]{Cellule}}&\Block[draw]{}{\scriptsize$\blacktriangledown$}&\Block{}{$f_x$\hfill$\sum$~\scriptsize$\blacktriangledown$\hfill$=$}&\Block[draw]{}{\useKV[Tableur]{Formule}\hfill\scriptsize$\blacktriangledown$}\\
\end{NiceTabular}%
\nopagebreak%
\\%
More information about the tex-live-commits
mailing list.