python两个同切圆_求两个圆的交点

我试图在Python中找到两个圆之间的交集(使用Matplotlib),但是找不到任何值。在

为此,我为每个单独的圆创建X和Y的列表(Matplotlib在绘制圆时将第一个参数作为X值,第二个参数作为Y值),然后相应地使列表相交(例如,circle1x值与circle2x值)。在import numpy

import math

import matplotlib.pyplot as plt

import random

def origin_circle():

global x_points

global y_points

global r

global n

r=1

n=2**16

x_points=[(r*math.cos(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n+1)]

y_points=[(r*math.sin(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n+1)]

def new_circle(x_offset, y_offset):

global x_points1

global y_points1

x_points1=[x_offset+(r*math.cos(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n+1)]

y_points1=[y_offset+(r*math.sin(t)) for t in numpy.linspace(0, 2*numpy.pi*r, n+1)]

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)))

我希望返回值,但返回的集合为空。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值