Simulate a rotating equal triangle with sides L inside a circle of radius r . I have tried it.but my code can not display the simulation of the rotating equal triangle with sides L inside a circle of radius r .
Please help me solve this using python
Simulate a rotating equal triangle with sides L inside a circle of radius r .
I have tried it.but my code can not display the simulation of the rotating equal triangle with sides L inside a circle of radius r .
Here is my code:
import numpy as np
from matplotlib import pyplot as plt
from IPython import display
r=1.0
θa=-20; θb=70 ; θc=160
xa=r*np.cos(θa)
ya=r*np.sin(θa)
xb=r*np.cos(θb)
yb=r*np.sin(θb)
xc=r*np.cos(θc)
yc=r*np.sin(θc)
line_abx = [xa,xb]
line_aby = [ya,yb]
line_bcx = [xb,xc]
line_bcy = [yb,yc]
line_cax = [xc,xa]
line_cay = [yc,ya]
T=2*np.pi/5
tarr=np.linspace(0,10*T,150)
theta = np.linspace(0,10*T,150)
radius = 1.0
a = radius*np.cos(theta)
b = radius*np.sin(theta)
figure , axes = plt.subplots()
axes.plot(a,b,c='red')
axes.set_aspect(1)
plt.plot(0 , 0, '.')
plt.plot(xa ,ya, 'o')
plt.plot(xb ,yb, 'o')
plt.plot(xc ,yc, 'o')
plt.plot(line_abx , line_aby)
plt.plot(line_bcx , line_bcy)
plt.plot(line_cax , line_cay)
plt.show()
-can you spot the problem in my code?
The output must be similar to the diagram attached
Step by step
Solved in 2 steps with 1 images