8.1 Fonctions graphiques prédéfinies

<argument> : signifie que l’argument est obligatoire.

[, argument] : signifie que l’argument est facultatif.

Les fonctions prédéfinies sont des fonctions basiques qui ne permettent pas la modification locale des paramètres du graphique, contrairement aux macros graphiques du modèle draw2d.

8.1.1 (Poly-)Bézier

  1. \begin{texgraph}[name=Bezier, file]
  2. Graph image = [
  3. view(-4,4,-4,5),Marges(0,0,0,0),size(7.5),Width:=8,
  4. A:=-3+4*i, B:=3+i, C:=3-3*i, D:=-3-3*i,
  5. C1:=4.5*i,C2:=-2*i, C3:=2-i, C4:=-2,
  6. FillStyle:=full, FillColor:=lightblue,Color:=red,
  7. Bezier([A,C1,C2,B,jump,C,C3,C4,D,jump,A]),
  8. FillStyle:=none, Color:=black, DotStyle:=cross, DotScale:=2,
  9. L:=[A,"$A$","N",B,"$B$","E",C,"$C$","SE",D,"$D$","SO",
  10. C1,"$C_1$","E",C2,"$C_2$","SO",C3,"$C_3$","N",
  11. C4,"$C_4$","N"],
  12. for Z in L By 3 do
  13.  draw("label",Z[2],[anchor:=Z[1],labeldir:=Z[3],showdot:=1])
  14. od,
  15. LineStyle:=userdash, DashPattern:=[5,2,0.5,2],Width:=6,
  16. Line([A,C1,C2,B,jump,C,C3,C4,D])
  17. ];
  18. \end{texgraph}

 PIC

Commande Bezier

8.1.2 Cartesian

  1. \begin{texgraph}[name=Cartesienne, file]
  2. Graph image = [
  3. view(-2,2,-0.1,2),Marges(0.5,0.5,0.5,0.5),size(7.5),
  4. tMin:=-2, tMax:=2, Width:=8,
  5. draw("grid",[-2,2+2*i],[unit:=[0.5,0.5],gridstyle:=dotted]),
  6. Axes(0,1+i,1), NbPoints:=100, Color:=darkseagreen,
  7. Cartesian(x*Ent(1/x),5,1)
  8. ];
  9. \end{texgraph}

 PIC

Courbe avec discontinuités

8.1.3 Dot (nuage de points)

  1. \begin{texgraph}[name=Point, file]
  2. Graph image = [
  3. view(2.75,4,0,1),
  4. Marges(0.75,0.5,0.5,0.5),size(7.5),
  5. Axes(Xmin+i*Ymin,0.25+0.2*i,1+i),
  6. pas:=0.001, Color:=red,
  7. DotScale:=0.1,
  8. Dot(
  9.  for r from Xmin to Xmax step pas do
  10.  u:=0.5,
  11.  for k from 1 to 25 do u:=r*u*(1-u) od,
  12.  for k from 1 to 25 do u:=r*u*(1-u), r+i*u od
  13.  od)
  14. ];
  15. \end{texgraph}

 PIC

Diagramme de bifurcation de la suite un+1 = run(1 un)

8.1.4 Ellipse

  1. \begin{texgraph}[name=ellipse, file]
  2. Graph image = [
  3. view(-5.25,5.25,-5.25,5.25), Marges(0,0,0,0), size(7.5),
  4. background(full,blue), Width:=4, Color:=white,
  5. inclin:=[0,35,-35],
  6. for z in inclin do
  7.  Ellipse(0,5,2,z)
  8. od,
  9. Width:=2*mm, Ellipse(0,1.5,4.5),
  10. Label(-0.1, "\resizebox{6cm}{3.5cm}{R\ T\ F}")
  11. ];
  12. \end{texgraph}

 PIC

Ellipses

8.1.5 EllipticArc

  1. \begin{texgraph}[name=EllipticArc, file]
  2. Graph image = [
  3. view(-2.25,3.75,-2,5),Marges(0,0,0,0),size(7.5),
  4. A:=0, B:=3+i, C:=2+4*i, DotScale:=2, Width:=8,
  5. Ligne([B,A,C],0), Color:=red,
  6. LabelDot(A,"$A$","S",1), LabelDot(B,"$B$","N",1),
  7. LabelDot(C,"$C$","SE",1), Arrows:=1, Color:=blue,
  8. EllipticArc(B,A,C,2,1,-1), EllipticArc(B,A,C,2,3,1)
  9. ];
  10. \end{texgraph}

 PIC

Commande EllipticArc

Remarques :

8.1.6 Implicit

  1. \begin{texgraph}[name=Implicit, file]
  2. Graph image = [
  3. view(-5,5,-5,5),Marges(0,0,0,0), size(7.5),
  4. Arrows:=1, Axes(0,1+i), Arrows:=0,
  5. Width:=8, Color:=red,
  6. Implicit( sin(x*y) )
  7. ];
  8. \end{texgraph}

 PIC

Équation sin(xy) = 0

8.1.7 Label

  1. \begin{texgraph}[name=Label, file]
  2. Include "PolyedresII.mac";
  3. Graph image = [
  4. view(-5,5,-5,5),Marges(0,0,0,0), size(7.5,0),
  5. C:=Cube(Origin, M(3,3,0)), S:=Sommets(C),
  6. Point3D(S), DrawPoly(C,0), k:=0,
  7. for Z in S by 2 do
  8.  Inc(k,1),
  9.  Label(Proj3D(Z)+if k>4 then 0.5*i else -0.5*i fi,
  10.    ["$S_",k,"$"])
  11. od
  12. ];
  13. \end{texgraph}

 PIC

Nommer des points

8.1.8 Line (Ligne polygonale)

  1. \begin{texgraph}[name=Ligne, file]
  2. Graph image = [
  3. Marges(0,0,0,0), size(7.5),
  4. A:=-5-5*i, B:=5*i, C:=5-5*i, niv:=6,
  5. Tr:=[A,B,C,jump], {figure initiale}
  6. for k from 1 to niv do
  7.  Tr:=[hom(Tr,A,0.5),hom(Tr,B,0.5),hom(Tr,C,0.5)]
  8. od,
  9. FillStyle:=full, FillColor:=blue, Line(Tr,1)
  10. ];
  11. \end{texgraph}

 PIC

Triangle de Sierpinski

8.1.9 Odeint (ou EquaDif)

  1. \begin{texgraph}[name=EquaDif, file]
  2. Graph image = [
  3. view(-10.5,2.5,-1.5,4.5),Marges(0,0,0,0), size(7.5,0),
  4. draw("axes",[0,2+i],[legend:=["$x$","$t$"],Arrows:=1,
  5.  nbsubdiv:=[1,0]]),
  6. Width:=8, Color:=red, tMin:=-10, tMax:=2,
  7. Odeint(y+i*(t*x+y+sin(t)),0,-1+i/2, 1),
  8. Color:=black, LabelStyle:=stacked,
  9. Label(-6+2*i,
  10.  "$x-x'-tx=\sin(t)$\\avec $x(0)=-1$ et $x'(0)=\frac12$")
  11. ];
  12. \end{texgraph}

 PIC

Équation différentielle

8.1.10 Parametric (ou Courbe)

8.1.11 Path

  1. \begin{texgraph}[name=Path, file]
  2. Graph image = [
  3. view(-5,5,-4,6), Marges(0,0,0,0), size(7.5),
  4. Axes(2*i,1+i),
  5. Eofill:=1, FillStyle:=full, FillOpacity:=0.85,
  6. FillColor:= blue, Width:=8,
  7. Path([-4,i,circle,
  8.    -3+2*i,move,-3,-2,line,
  9.    0,2,2,-1,arc,
  10.    3,3+3*i,0.5,linearc,
  11.    1,-1+5*i,-3+2*i,bezier,
  12.    closepath,
  13.    ])
  14. ];
  15. \end{texgraph}

 PIC

Commande Path et Eofill

8.1.12 Polar (ou Polaire)

  1. \begin{texgraph}[name=Polaire, file]
  2. Graph image = [
  3. view(-3,2,-2,3),Marges(0.25,0.25,0.25,0.25), size(7.5),
  4. Axes(0,1+i), NbPoints:=250, tMin:=-25, tMax:=25,
  5. courbe:=Get(Polar((t+1)/(t-1))),
  6. ptDoubles:= courbe InterL courbe,
  7. Width:=8, Color:= blue, Line(courbe),
  8. DotStyle:=dotcircle, DotScale:=1.5, Dot(ptDoubles),
  9. Label(1+2*i,"$r(t)=\dfrac{t+1}{t-1}$")
  10. ];
  11. \end{texgraph}

 PIC

Courbe polaire et points doubles

8.1.13 Spline

  1. \begin{texgraph}[name=Spline, file]
  2. Graph image = [
  3. view(-5,5,-5,5), Marges(0.25,0.25,0.25,0.25), size(7.5),
  4. Axes(0,1+i),
  5. A:= -4-3*i, B:=-2+2*i, C:=1-3*i, D:=4+3*i,
  6. LabelDot(A,"$A$","S",1), LabelDot(B,"$B$","N",1),
  7. LabelDot(C,"$C$","S",1), LabelDot(D,"$D$","O",1),
  8. Width:=8, Color:=red, Spline(0,A,B,C,D,0),
  9. Line([-4.5+4.5*i,-4+4.5*i]), LabelStyle:=left,
  10. Label(-3.5+4.5*i,"libre"), Color:=blue, Spline(5,A,B,C,D,5*i),
  11. Line([-4.5+3.5*i,-4+3.5*i]), Label(-3.5+3.5*i,"contrainte"),
  12. Width:=4, Arrows:=1, Line([A,A+2,jump,D,D+2*i])
  13. ];
  14. \end{texgraph}

 PIC

Commande Spline

8.1.14 StraightL (droite)

  1. \begin{texgraph}[name=Droite, file]
  2. Graph image = [
  3. view(-5,5,-5,5), Marges(0,0,0,0), size(7.5),
  4. F:=sqrt(7), F':=-F, {foyers} Width:=1, Color:=darkgray,
  5. for t from -pi to pi step 0.1 do
  6.  M:=4*cos(t)+3*i*sin(t),
  7.  Vn:=(M-F)/abs(M-F)+(M-F')/abs(M-F'),
  8.  StraightL(M,M+Vn), {normale a l'ellipse}
  9. od,
  10. Width:=8, Color:=red, Ellipse(0,4,3),
  11. LabelDot(F,"$F$","S",1), LabelDot(F',"$F'$","S",1)
  12. ];
  13. \end{texgraph}

 PIC

Développée d’une ellipse