临沂做四维和美家网站,兰州专业网站建设公司,wordpress 无法修改,做网站可以不做后端吗我试图在Python中找到两个圆之间的交集(使用Matplotlib)#xff0c;但是找不到任何值。在为此#xff0c;我为每个单独的圆创建X和Y的列表(Matplotlib在绘制圆时将第一个参数作为X值#xff0c;第二个参数作为Y值)#xff0c;然后相应地使列表相交(例如#xff0c;circle1…我试图在Python中找到两个圆之间的交集(使用Matplotlib)但是找不到任何值。在为此我为每个单独的圆创建X和Y的列表(Matplotlib在绘制圆时将第一个参数作为X值第二个参数作为Y值)然后相应地使列表相交(例如circle1x值与circle2x值)。在import numpyimport mathimport matplotlib.pyplot as pltimport randomdef origin_circle():global x_pointsglobal y_pointsglobal rglobal nr1n2**16x_points[(r*math.cos(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n1)]y_points[(r*math.sin(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n1)]def new_circle(x_offset, y_offset):global x_points1global y_points1x_points1[x_offset(r*math.cos(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n1)]y_points1[y_offset(r*math.sin(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n1)]origin_circle()new_center random.randint(0, len(x_points))x_offset x_points[new_center]y_offset y_points[new_center]new_circle(x_offset, y_offset)print(set(x_points1).intersection(set(x_points)))print(set(y_points1).intersection(set(y_points)))我希望返回值但返回的集合为空。在