Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Implemented orbital speed change
Browse files Browse the repository at this point in the history
  • Loading branch information
dark00infinity committed Mar 31, 2021
1 parent c684748 commit 4705ace
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/poliastro/plotting/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,19 @@ def _anim(self, orbit, *, label=None, color=None, trail=False):
colors = self._get_colors(color, trail)

self.set_attractor(orbit.attractor)
from poliastro.twobody import propagation

orbit = orbit.change_plane(self.plane)

label = generate_label(orbit.epoch, label)
coordinates = orbit.sample(self._num_points)
time_laps = [i for i in range(int(orbit.period.value))]
tofs = time_laps * u.day * 2
k = propagation.danby(orbit.attractor.k, orbit.r, orbit.v, tofs)[0]
x = k.to(u.km).value[:, 0]
y = k.to(u.km).value[:, 1]
z = k.to(u.km).value[:, 2]
cartesian_repr = CartesianRepresentation(x * (u.km), y * (u.km), z * (u.km))
coordinates = cartesian_repr

return self.__anim_trajectory(
coordinates, orbit.r, label=label, colors=colors, dashed=True
Expand Down
2 changes: 1 addition & 1 deletion src/poliastro/plotting/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def animate(i):
self.fig,
animate,
frames=np.arange(0, len(x), 1),
interval=40,
interval=30,
blit=True,
repeat=True,
)
Expand Down

0 comments on commit 4705ace

Please sign in to comment.