Skip to content

Commit

Permalink
animation in real time, beautified variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter230655 committed Aug 3, 2024
1 parent d2cdc75 commit a28b1e0
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions examples-gallery/plot_ball_rolling_on_spinning_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@
**Additional parameters**
- N: inertial frame
- A1: frame fixed to the ball
- A2: frame fixed to the disc
- O: point fixed in N
- CP: contact point of ball with disc
- Dmc: center of the ball
- :math:`m_{Dmc}: position of observer
- h: intervall which opty should minimize.
- ``N``: inertial frame
- ``A1``: frame fixed to the ball
- ``A2``: frame fixed to the disc
- ``O``: point fixed in N
- ``CP``: contact point of ball with disc
- ``Dmc``: center of the ball
- :math:`m_{Dmc}`: position of observer
- ``h``: intervall which opty should minimize.
A video similar to this one, which I saw in something JM published
gave me the idea.
Expand Down Expand Up @@ -494,7 +493,7 @@ def func (x, *args):

# %%
# Animate the system.
fps = 40
fps = 30

def add_point_to_data(line, x, y):
old_x, old_y = line.get_data()
Expand Down Expand Up @@ -579,8 +578,7 @@ def update(t):
f'projection of the torque vector on the X/Y plane \n' +
f'The blue arrow is the component of the torque perpendicular ' +
f'to the disc \n' +
f'The blue dot is the observer \n' +
f'The magenta line shows the curve in N the ball will take'
f'The blue dot is the observer'
)
ax.set_title(message, fontsize=10)

Expand All @@ -604,7 +602,8 @@ def update(t):
return line1, line2, line3, line4, line5, ball, observer, pfeil1, pfeil2

animation = FuncAnimation(fig, update, frames=np.arange(t0,
num_nodes*solution[-1], 1 / fps), interval=1.5*fps, blit=False)
(num_nodes - 1) * solution[-1], 1 / fps),
interval=fps, blit=False)

# %%
# A frame from the animation.
Expand Down

0 comments on commit a28b1e0

Please sign in to comment.