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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rect_intersection-0.10.tar.gz.
File metadata
- Download URL: rect_intersection-0.10.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c16628c24ad12c9e2a407a5f96ce8ff28279770cd844141b8b5f21bb9d84b8e8
|
|
| MD5 |
8ff637d20be69c2672981c53e41ff4ee
|
|
| BLAKE2b-256 |
37906ad4b48b463375fe1bb41454884f3711b3b2908a14ca30cb04fbd7747cbf
|
File details
Details for the file rect_intersection-0.10-py3-none-any.whl.
File metadata
- Download URL: rect_intersection-0.10-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89cda676d5f8afa1367450653c2bc28c3ac30c8ca40001971ddcdc9238c8550f
|
|
| MD5 |
984deb4df99af1840125d42588b2d3c0
|
|
| BLAKE2b-256 |
209714817a24a175c237a41c1a1d7fa493e625e55535a7d8629bff7f74ac10a3
|