检查两行是否重叠
cf-lines-overlap的Python项目详细描述
ormuco代码挑战
此项目仅为演示目的而创建。
The challenge
Your goal for this question is to write a program that accepts two lines (x1,x2) and (x3,x4) on the x-axis and returns whether they overlap. As an example, (1,5) and (2,6) overlaps but not (1,5) and (6,8).
答案
源目录:./overlap
用法:
- 运行
pip3 install cf_lines_overlap
from overlap.overlap import overlap
result = overlap((1,5), (4,25))
# It will return True if the lines overlap, False otherwise