diff --git a/Maths/tp/Bezier/tp5/TP5_comparaison_algorithmes.pdf b/Maths/tp/Bezier/tp5/TP5_comparaison_algorithmes.pdf new file mode 100644 index 0000000..4b3e996 Binary files /dev/null and b/Maths/tp/Bezier/tp5/TP5_comparaison_algorithmes.pdf differ diff --git a/Maths/tp/Bezier/tp5/tp5.py b/Maths/tp/Bezier/tp5/tp5.py new file mode 100644 index 0000000..5c18166 --- /dev/null +++ b/Maths/tp/Bezier/tp5/tp5.py @@ -0,0 +1,33 @@ +import matplotlib.pyplot as plt +import numpy as np +import time +# import shape + +# On active le "mode interactif" de pyplot. Ainsi, les plt.show() ne sont plus nécessaires. +plt.ion() + +# -------------------------------------------------------------------------------------- +# Fonction de "fin temporaire" pendant l'avancée du TP. Attend une frappe Entrée, puis quitte le script. + +def stop_ici(): + plt.pause(0.1) # nécessaire pour que matplotlib ait le temps d'afficher les figures + input() + exit() + + +def CastelJauUnPoint(t, P): + P = P.copy() + N = P.shape[0] - 1 + for i in range(N): + for j in range(N-i): + P[j] = (1-t)*P[j] + t*P[j+1] + return P[0] + + +def traceBezierCastelJau(P,K): + allt = np.linspace(0,1,K) + allFt = np.array([CastelJauUnPoint(t,P) for t in allt]) + plt.plot(allFt[:,0], allFt[:,1]) + + +stop_ici() \ No newline at end of file