Checks if two rectangles intersect
Project description
Checks if two rectangles intersect
# Tested with:
# Python 3.9.13
# Windows 10
from rect_intersection import intersects
# Allowed formats for box1/box2
format_1x4 = (0, 0, 100, 200)
format_4x2 = [(0, 0), (100, 0), (100, 200), (0, 200)]
format_2x2 = [(0, 0), (100, 200)]
box1 = (0, 0, 100, 200)
box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))
box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))
box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))
False
True
True
True
False
True
True
True
False
True
True
True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rect_intersection-0.10.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for rect_intersection-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89cda676d5f8afa1367450653c2bc28c3ac30c8ca40001971ddcdc9238c8550f |
|
MD5 | 984deb4df99af1840125d42588b2d3c0 |
|
BLAKE2b-256 | 209714817a24a175c237a41c1a1d7fa493e625e55535a7d8629bff7f74ac10a3 |