I am trying to extract points of the circumference of a circle

asked 2017-08-11 04:33:41 -0500

Santhosh1 gravatar image

updated 2017-08-11 05:38:16 -0500

berak gravatar image

Here I have created two arrays to store X and Y coordinates of the circumference (full 360 degrees)

#360 degree points of the circle
x_Pos = np.array(360)
y_Pos = np.array(360)

loop to to draw the circle and store the points on the circumference

for i in circles[0,:]:
# draw the outer circle
for j in range(0,360):
        x_Pos[j] = r*np.cos(np.radians(j)) + x
        y_Pos[j] = r*np.sin(np.radians(j)) + y
# draw the center of the circle

I have this error show up when I try complying the code

IndexError                                Traceback (most recent call last)
<ipython-input-151-3241c5884c93> in <module>()
 26     r=i[2]
 27     for j in range(0,360):
 ---> 28             x_Pos[j] = r*np.cos(np.radians(j)) + x
 29             y_Pos[j] = r*np.sin(np.radians(j)) + y
 30     # draw the center of the circle

 IndexError: too many indices for array
edit retag flag offensive close merge delete