-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulation.py
52 lines (30 loc) · 1.13 KB
/
simulation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import matplotlib.pyplot as plt
from Univert import *
solar_system = Univers(400)
'''Etoile(solar_system, 10,couleur="red",position=(10,15,10),vitesse=(0,0,0))
Etoile(solar_system, 10,couleur="green",position=(-12,-1,-10),vitesse=(0,0,0))
Etoile(solar_system, 10,couleur="yellow",position=(-20,-20,-20),vitesse=(0,0,0))'''
# Palette de couleurs
cmap = plt.get_cmap("viridis")
for i in range(20):
# Obtenir la couleur de la palette en fonction de i
couleur = cmap(i / 29.0) # Normalisation pour obtenir une valeur entre 0 et 1
# Créer une étoile avec une couleur différente à chaque itération
Etoile(solar_system, 10 + i, couleur='green',vitesse=(0,0,0))
def on_close(event):
plt.close()
global running
running = False
plt.gcf().canvas.mpl_connect('close_event', on_close)
plt.show(block=False)
global running
running = True
while running:
solar_system.draw_all()
solar_system.update_all()
solar_system.draw_octree_from_repr()
'''if solar_system.octree.__repr__() != first:
print('after')
print(solar_system.octree)'''
#plt.pause(0.001)
#print(body.vitesse)