When you draw the y_curve
, rotate it in a different direction using the cosine of theta instead of the sine. Also, since you want to connect the lines, elevate the centre of the semicircle to be in between the two adjacent ones: (i + 0.5)
. Here's the line that shows the right y coordinates for me:
width = 10
spacing = 1
length = 10
for i in range(int(width // spacing)):
theta = np.linspace(0, np.pi, 100)
x_curve = length + (spacing / 2) * np.cos(theta)
y_curve = (i + 0.5) * spacing + (spacing / 2) * np.cos(theta) # this is the line in qquestion
print(f"X: {x_curve}\nY: {y_curve}")