1 Star 0 Fork 0

余超/20189220余超 java

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Exercise04_28.py 508 Bytes
一键复制 编辑 原始数据 按行查看 历史
余超 提交于 2019-05-16 14:39 +08:00 . python的代码
x1, y1, w1, h1 = eval(input("Enter r1's center x-, y-coordinates, width, and height: "))
x2, y2, w2, h2 = eval(input("Enter r2's center x-, y-coordinates, width, and height: "))
xDistance = x1 - x2 if x1 - x2 >= 0 else x2 - x1
yDistance = y1 - y2 if y1 - y2 >= 0 else y2 - y1
if xDistance <= (w1 - w2) / 2 and yDistance <= (h1 - h2) / 2:
print("r2 is inside r1")
elif xDistance <= (w1 + w2) / 2 and yDistance <= (h1 + h2) / 2:
print("r2 overlaps r1")
else:
print("r2 does not overlap r1")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yuchao20189220/over_20189220java.git
git@gitee.com:yuchao20189220/over_20189220java.git
yuchao20189220
over_20189220java
20189220余超 java
master

搜索帮助