Skip to main content

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

This version

0.10

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

get_rectangle_infos-0.10.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

get_rectangle_infos-0.10-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file get_rectangle_infos-0.10.tar.gz.

File metadata

  • Download URL: get_rectangle_infos-0.10.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for get_rectangle_infos-0.10.tar.gz
Algorithm Hash digest
SHA256 155b53a236cba7d1ae86e4a654aba3d16439badb1d9d20b28ab6430363b2c7ac
MD5 f72faa39d8052810f6338586aaa65624
BLAKE2b-256 25ca721001fb78a1af21e69adf68f55369aa02c97369da49335ecb0b665f2464

See more details on using hashes here.

File details

Details for the file get_rectangle_infos-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for get_rectangle_infos-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e38596c1f55fcbd567bb7306a7d5218f5d3e74cb17db2807936b66da78e97031
MD5 d8925ed2085dab6e5f28aac22390dd6f
BLAKE2b-256 8a87e57b9bfe69899cf3bec56a11eeb226a79d26ee2e4e559af904d0ca6d85e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page