Skip to main content

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))



	

Metadata

Release files for get-rectangle-infos 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for get-rectangle-infos 0.10
File Size Uploaded
get_rectangle_infos-0.10.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for get-rectangle-infos 0.10
File Interpreter ABI Platform
get_rectangle_infos-0.10-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / get_rectangle_infos-0.10.tar.gz

Download URL get_rectangle_infos-0.10.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
155b53a236cba7d1ae86e4a654aba3d16439badb1d9d20b28ab6430363b2c7ac
BLAKE2b-256 checksum
How to use checksums
25ca721001fb78a1af21e69adf68f55369aa02c97369da49335ecb0b665f2464
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / get_rectangle_infos-0.10-py3-none-any.whl

Download URL get_rectangle_infos-0.10-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e38596c1f55fcbd567bb7306a7d5218f5d3e74cb17db2807936b66da78e97031
BLAKE2b-256 checksum
How to use checksums
8a87e57b9bfe69899cf3bec56a11eeb226a79d26ee2e4e559af904d0ca6d85e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page