ajout du tp5 de maths

master
Antoine PEREDERII 2 years ago
parent 9674970e00
commit 19d0d8ff40

@ -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()
Loading…
Cancel
Save