There are 3 common rectangle formats, and converting them all the time really is a pain in the a**
Project description
There are 3 common rectangle formats, and converting them all the time really is a pain in the a**
Using this function, you get all 3 formats, center coordinates, height, width and the area
# Tested with:
# Python 3.9.13
# Windows 10
pip install get-rectangle-infos
from get_rectangle_infos import get_rectangle_information
format_1x4 = (0, 0, 100, 200)
format_4x2 = [(0, 0), (100, 0), (100, 200), (0, 200)]
format_2x2 = [(0, 0), (100, 200)]
print(get_rectangle_information(rect=(0, 0, 100, 200)))
# Rect(format_1x4=(0, 0, 100, 200), format_4x2=[(0, 0), (100, 0), (100, 200), (0, 200)], format_2x2=[(0, 0), (100, 200)], height=200, width=100, area=20000, center=(50, 100))
print(get_rectangle_information(rect=[(0, 0), (100, 0), (100, 200), (0, 200)]))
# Rect(format_1x4=(0, 0, 100, 200), format_4x2=[(0, 0), (100, 0), (100, 200), (0, 200)], format_2x2=[(0, 0), (100, 200)], height=200, width=100, area=20000, center=(50, 100))
print(get_rectangle_information(rect=[(0, 0), (100, 200)]))
# Rect(format_1x4=(0, 0, 100, 200), format_4x2=[(0, 0), (100, 0), (100, 200), (0, 200)], format_2x2=[(0, 0), (100, 200)], height=200, width=100, area=20000, center=(50, 100))
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
Close
Hashes for get_rectangle_infos-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e38596c1f55fcbd567bb7306a7d5218f5d3e74cb17db2807936b66da78e97031 |
|
MD5 | d8925ed2085dab6e5f28aac22390dd6f |
|
BLAKE2b-256 | 8a87e57b9bfe69899cf3bec56a11eeb226a79d26ee2e4e559af904d0ca6d85e9 |