Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ def bernstein_poly(i, n, t):
|
|
| 11 |
return comb(n, i) * (t**(i)) * ((1 - t)**(n - i))
|
| 12 |
|
| 13 |
# --- MUDANÇA #1: VELOCIDADE AUMENTADA (Menos Vetores) ---
|
| 14 |
-
def bezier_curve_3d(points, n_times=
|
| 15 |
n_points = len(points)
|
| 16 |
x_points, y_points, z_points = np.array([p[0] for p in points]), np.array([p[1] for p in points]), np.array([p[2] for p in points])
|
| 17 |
t = np.linspace(0.0, 1.0, n_times)
|
|
@@ -32,10 +32,10 @@ def motor_da_simulacao_infinita(angulo_camera: int):
|
|
| 32 |
e maior velocidade de movimento.
|
| 33 |
"""
|
| 34 |
ponto_a = np.array([-40., 20., 10.])
|
| 35 |
-
vetor_inercia = np.array([30.,
|
| 36 |
historico_rastro = [ponto_a.tolist()]
|
| 37 |
|
| 38 |
-
fig = plt.figure(figsize=(
|
| 39 |
cor_fundo = '#0a0a0a'; fig.patch.set_facecolor(cor_fundo); ax.set_facecolor(cor_fundo)
|
| 40 |
|
| 41 |
ciclo_num = 0
|
|
@@ -43,7 +43,7 @@ def motor_da_simulacao_infinita(angulo_camera: int):
|
|
| 43 |
ciclo_num += 1
|
| 44 |
|
| 45 |
# --- MUDANÇA #2: UNIVERSO EXPANDIDO (Alvos Mais Distantes) ---
|
| 46 |
-
ponto_b = np.random.rand(3) *
|
| 47 |
|
| 48 |
ponto_controle = ponto_a + vetor_inercia
|
| 49 |
pontos_curva = [ponto_a, ponto_controle, ponto_b]
|
|
@@ -51,7 +51,7 @@ def motor_da_simulacao_infinita(angulo_camera: int):
|
|
| 51 |
|
| 52 |
novos_pontos_rastro = list(zip(x_ciclo, y_ciclo, z_ciclo))
|
| 53 |
historico_rastro.extend(novos_pontos_rastro)
|
| 54 |
-
max_rastro =
|
| 55 |
historico_rastro = historico_rastro[-max_rastro:]
|
| 56 |
|
| 57 |
tamanho_eco = 15
|
|
@@ -82,7 +82,7 @@ def motor_da_simulacao_infinita(angulo_camera: int):
|
|
| 82 |
ax.text2D(0.05, 0.95, info_texto, transform=ax.transAxes, color='white', fontsize=10)
|
| 83 |
|
| 84 |
yield fig
|
| 85 |
-
time.sleep(0.
|
| 86 |
|
| 87 |
ponto_a = ponto_b
|
| 88 |
|
|
|
|
| 11 |
return comb(n, i) * (t**(i)) * ((1 - t)**(n - i))
|
| 12 |
|
| 13 |
# --- MUDANÇA #1: VELOCIDADE AUMENTADA (Menos Vetores) ---
|
| 14 |
+
def bezier_curve_3d(points, n_times=24): # De 60 para 40 vetores por ciclo
|
| 15 |
n_points = len(points)
|
| 16 |
x_points, y_points, z_points = np.array([p[0] for p in points]), np.array([p[1] for p in points]), np.array([p[2] for p in points])
|
| 17 |
t = np.linspace(0.0, 1.0, n_times)
|
|
|
|
| 32 |
e maior velocidade de movimento.
|
| 33 |
"""
|
| 34 |
ponto_a = np.array([-40., 20., 10.])
|
| 35 |
+
vetor_inercia = np.array([30., 90., -120.])
|
| 36 |
historico_rastro = [ponto_a.tolist()]
|
| 37 |
|
| 38 |
+
fig = plt.figure(figsize=(32, 32)); ax = fig.add_subplot(111, projection='3d')
|
| 39 |
cor_fundo = '#0a0a0a'; fig.patch.set_facecolor(cor_fundo); ax.set_facecolor(cor_fundo)
|
| 40 |
|
| 41 |
ciclo_num = 0
|
|
|
|
| 43 |
ciclo_num += 1
|
| 44 |
|
| 45 |
# --- MUDANÇA #2: UNIVERSO EXPANDIDO (Alvos Mais Distantes) ---
|
| 46 |
+
ponto_b = np.random.rand(3) * 240 - 80 # Agora de -100 a 100 em cada eixo
|
| 47 |
|
| 48 |
ponto_controle = ponto_a + vetor_inercia
|
| 49 |
pontos_curva = [ponto_a, ponto_controle, ponto_b]
|
|
|
|
| 51 |
|
| 52 |
novos_pontos_rastro = list(zip(x_ciclo, y_ciclo, z_ciclo))
|
| 53 |
historico_rastro.extend(novos_pontos_rastro)
|
| 54 |
+
max_rastro = 8 # Rastro um pouco menor para dar sensação de velocidade
|
| 55 |
historico_rastro = historico_rastro[-max_rastro:]
|
| 56 |
|
| 57 |
tamanho_eco = 15
|
|
|
|
| 82 |
ax.text2D(0.05, 0.95, info_texto, transform=ax.transAxes, color='white', fontsize=10)
|
| 83 |
|
| 84 |
yield fig
|
| 85 |
+
time.sleep(0.005)
|
| 86 |
|
| 87 |
ponto_a = ponto_b
|
| 88 |
|