Commit c5e58dc3 authored by Louis's avatar Louis
Browse files

Conversion de "cercle_trigonometrique" en LuaLaTeX

parent 77af1b69
Pipeline #446065 passed with stage
in 1 minute and 8 seconds
......@@ -77,23 +77,24 @@ def mes_02pi(liste):
def cercle_trigo(code=0,*args):
"""Dessine le cercle trigonométrique avec un nombre indéfini d'angles en degrés ou radians, en codant ou non les angles."""
figure = """\\psset{xunit=3cm,yunit=3cm,dotstyle=+}
\\begin{pspicture}(-1.4,-1.4)(1.4,1.4)
\\psframe(-1.4,-1.4)(1.4,1.4)
\\psaxes[linewidth=0.5pt,Dx=2,Dy=2]{->}(0,0)(-1.1,-1.1)(1.1,1.1)
\\pscircle[linecolor=gray](0,0){3}
figure = """\
\\begin{tikzpicture}[very thick, scale=3]
\\draw[Maroon] (-1.4, -1.4) rectangle (1.4, 1.4);
\\draw[line width=.5pt, Maroon, -Stealth] (-1.1, 0) -> (1.1, 0);
\\draw[line width=.5pt, Maroon, -Stealth] (0, -1.1) -> (0, 1.1);
\\draw[gray] (0, 0) circle (1);
\\definecolor{grisclair}{gray}{0.20}
\\colorlet{bleuclair}{blue!40!white}\n"""
idx = 0
if not code:
for a in range(11):
if (a+1) / 6 not in [0.5,1,1.5]:
figure += "\\psline[linecolor=LightSkyBlue,linestyle=dashed](0,0)("+str(round(cos((a+1)*pi/6),2))+","+str(round(sin((a+1)*pi/6),2))+")\n"
figure += f"\\draw[LightSkyBlue,dashed] (0, 0) -- ({round(cos((a+1)*pi/6),2)}, {round(sin((a+1)*pi/6),2)});\n"
for a in range(9):
if (a+1) / 5 not in [0.5,1,1.5]:
figure += "\\psline[linecolor=LightSlateGray,linestyle=dashed](0,0)("+str(round(cos((a+1)*pi/5),2))+","+str(round(sin((a+1)*pi/5),2))+")\n"
figure += f"\\draw[LightSlateGray,dashed] (0,0) -- ({round(cos((a+1)*pi/5),2)}, {round(sin((a+1)*pi/5),2)});\n"
for a in range(4):
figure += "\\psline[linecolor=LightGreen,linestyle=dashed](0,0)("+str(round(cos((2*a+1)*pi/4),2))+","+str(round(sin((2*a+1)*pi/4),2))+")\n"
figure += f"\\draw[LightGreen,dashed] (0,0) -- ({round(cos((2*a+1)*pi/4),2)}, {round(sin((2*a+1)*pi/4),2)});\n"
for f in args:
if isinstance(f,list): # mesure en radians
rad = simprad(f)
......@@ -102,16 +103,18 @@ def cercle_trigo(code=0,*args):
f = rad[0]*pi/rad[1] # Le dénominateur ne devrait pas être nul...
frac = rad2tex(rad)
figure += "\\psline[linecolor=red,linestyle=dashed](0,0)("+str(round(cos(f),2))+","+str(round(sin(f),2))+")\n"
figure += f"\\draw[red,dashed] (0,0) -- ({round(cos(f),2)}, {round(sin(f),2)});\n"
if code:
figure += "\\rput("+str(round(1.25*cos(f),2))+","+str(round(1.25*sin(f),2))+"){"+frac+"}\n"
figure += f"\\node at ({round(1.25*cos(f),2)}, {round(1.25*sin(f),2)}) {{ {frac} }};\n"
else:
figure += "\\rput("+str(round(1.25*cos(f),2))+","+str(round(1.25*sin(f),2))+"){$M_"+str(idx)+"$}\n"
figure += f"\\node at ({round(1.25*cos(f),2)}, {round(1.25*sin(f),2)}) {{ $M_{idx}$ }};\n"
idx += 1
figure += r"""\uput[dl](0,0){$O$}
\uput[dr](1,0){$I$}
\uput[ul](0,1){$J$}"""
figure += "\n\\end{pspicture}"
figure += r"""\
\draw (0,0) node[below left]{$O$};
\draw (1,0) node[below right]{$I$};
\draw (0,1) node[above left]{$J$};
"""
figure += "\n\\end{tikzpicture}"
return figure
def findrad(itv=1, neg=0, denom_simple=1):
......@@ -212,7 +215,7 @@ def _cercle_trigonometrique():
exo.append(_(u"\\item Convertir les cinq mesures suivantes en degrés : %s, %s, %s, %s et %s~rad.") %(tuple(mes_rad_tex[0:5])))
exo.append(_(u"\\item Déterminer les mesures principales des angles suivants en radians : %s, %s, %s, %s et %s~rad.") %(tuple(mes_rad_tex[5:10])))
exo.append(_(u"\\item Des angles ont été placés sur le cercle trigonométrique ci-dessous, représentés en rouge par les points $M_0$, $M_1$, $M_2$ et $M_3$. Lire leurs mesures principales en radians"))
exo.append(_(u"( les lignes vertes, grises et bleues représentent des angles multiples de $\\dfrac{\\pi}{3}$, de $\\dfrac{\\pi}{4}$ et de $\\dfrac{\\pi}{5}$ ).\\par"))
exo.append(_(u"(les lignes vertes, grises et bleues représentent des angles multiples de $\\dfrac{\\pi}{3}$, de $\\dfrac{\\pi}{4}$ et de $\\dfrac{\\pi}{5}$).\\par"))
exo.append(cercle_trigo(0,radq4[0],radq4[1],radq4[2],radq4[3]))
exo.append(_(u"\\item Placer les angles suivants sur le cercle trigonométrique : %s, %s, %s et %s~rad.\\par") %(tuple(mes_rad_tex[14:])))
exo.append(cercle_trigo())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment