"""
A(ax,ay),B(px,py)为两个点 (x1,y1),(x2,y2)为矩形的左上角和右下角坐标 ,判断A,B两点是否和矩形相交
"""
def Judge(ax, ay, px, py, x1, y1, x2, y2):
#转换为真除法
ax, ay, px, py = float(ax), float(ay), float(px), float(py)
x1, y1, x2, y2 = float(x1), float(y1), float(x2), float(y2)
#判断矩形上边线和两点直线相交的点
sx = (y1 - ay) * (px - ax) / (py - ay) + ax
if sx >= x1 and sx <= x2:
return True
#判断矩形下边线和两点直线相交的点
xx = (y1 - ay) * (px - ax) / (py - ay) + ax
if sx >= x1 and sx <= x2:
return True
#判断矩形左边线和两点直线相交的点
zy = (y2 - ay) * (x2 - ax) / (px - ax) + ay
if zy >= y1 and zy <= y2:
return True
#判断矩形右边线和两点直线相交的点
yy = (y2 - ay) * (x2 - ax) / (px - ax) + ay
if yy <= y1 and yy >= y2:
return True
return False
ax = raw_input()
ay = input()
px = input()
py = input()
x1 = input()
y1 = input()
x2 = input()
y2 = input()
print Judge(ax, ay, px, py, x1, y1, x2, y2)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有