import numpy as np
import matplotlib.pyplot as plt
import Objectes as ob
import Sistemes as sis
#Exemple Camp gravitcional en estatic
"""
terra = ob.cos(5.972*10E24,10E12,0,5519,3,escala=10E3,color="blue")
sol = ob.cos(1.989 *10E30, 0,0,9400,escala= 10E2,color="yellow")

sistema_solar = ob.static_sistem(limits=[-(1.1)*10E12,(1.1)*10E12,-(1.1)*10E12,(1.1)*10E12])
sistema_solar.add(terra)
sistema_solar.add(sol)
plt.show()
"""

#Exemple Particula amb una velocitat donada en un camp gravitacional
# Atencio valors irrealistes nomes per ensenyar el funcionament 

Gxmin = -100
Gxmax = 100
Gymin = -100
Gymax = 100

sys= sis.static_sistem([Gxmin,Gxmax,Gymin,Gymax])

#sys.add(ob.cos(3*10E16,0,0,escala=10E-7))
#sys.add(ob.cos(2*10E17,4.5,-2,escala=10E-7))
sys.add(ob.cos(2*10E16,-15,-15,escala=10E-6))

sys.field_plot(np.meshgrid(np.linspace(Gxmin, Gxmax, 2000), np.linspace(Gymin, Gymax, 2000)))
p =ob.particula_accelerada(sys, -13, 15, [],1,vx_0=0.01,vy_0=-0.01,Tf=0.3,Te=0.0001,color="red")

k =ob.particula_accelerada(sys, -13, 15, [[0,0.1,10E3,-10E2,],[0.1,2.1,-10E2,-10E3,],[10.1,5,-10E20,-10E20,],[10222,5,-10E20,-10E20,]],1,vx_0=0.01,vy_0=-0.01,Tf=20,Te=0.0001)

p.trajectoria()
k.trajectoria()
plt.show()
