Skip to content
Snippets Groups Projects
Commit 6c9226d8 authored by Alberto.Rovetta's avatar Alberto.Rovetta
Browse files

tested and debugged save bike function

parent f98caef3
Branches main
No related tags found
1 merge request!10Created get_img function to save bike images
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
def save_bike_image(points_position, counter)
def save_bike_image(points_position, counter):
"""This function save an image of the bike.
:param points_position: provide bike coordinates
:param counter: provide bike number
:return: bike image file
"""
fig, ax = plt.subplots()
ax.set_title('Bikes')
ax.set_title(f"Bike {counter}")
ax.axis('equal')
ax.set_xlim(0, 35)
ax.set_ylim(-5, 20)
num_point=4
points_position = np.random.rand(num_point, 2)*8+3
wheel_radius = 1.2
spring_indexs = []
for i in range(num_point):
......@@ -34,3 +38,7 @@ def save_bike_image(points_position, counter)
for item in balls:
ax.add_patch(item)
plt.savefig(f"img_{counter}.png")
#num_point=4
#points_position = np.random.rand(num_point, 2)*8+3
#save_bike_image(points_position, 2)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment