No project description provided
Project description
LIRPy
Largest Interior Rectangle for Python
This was originally made for a stupid Minecraft project for the purpose of making as few Baritone selections as possible when designating a cylinder, but it should work in any other context as well.
I also hate numpy with a passion for mysterious reasons I can't even explain to myself. Therefore, this project doesn't use it.
Background
When I'm not breaking games for work, I tend to play engineering games, and one of the first such games I got into was Minecraft. I play it off and on, and I tend to get into mega-projects, which often end up with me getting bored and having a bot called Baritone do most of the work.
I needed a tool to generate Baritone selection AABBs (which are defined by opposing corner coordinates) for cylinders of arbitrary radius and depth. The easiest possible way would be to generate selections for every single voxel column. This would not be practical due to the sheer number of selections needing to be made.
So, after doing some research, I determined what I needed was an axis-aligned largest interior rectangle library.
Other Options
Other solutions I've looked at:
- largestinteriorrectangle uses numba, which is so outdated it won't compile with LLVM 14. It's also unfortunately spammed all over stackoverflow, which makes it harder to find background information.
- https://www.evryway.com/largest-interior/ - Never worked properly for me.
- https://pypi.org/project/maxrect/ - GIS-specific, so it requires weird inputs and works on polygons rather than grids. Their GitHub is also missing.
- Various things in other languages, like C, MATLAB, and C# - no
So I made my own system, with blackjack and classy sex workers.
Caveats
I am no mathematician, so this is nowhere within ten light-years of optimized, and there are probably a dozen papers dense with calculus describing new and exciting ways of doing that. I didn't take calculus in uni.
This works well enough for my purposes, but PRs with improvements are absolutely welcome.
Installation
Requires Python >= 3.10
pip install lirpy
Development
Requires Python >= 3.10 and poetry
Example:
$ python -m lirpy -472 58 570 -r 7 -d 1 --dump-steps
Center: -472 58 570
Radius: 7
Depth: 0
Along axis: -Y
Step 0:
█
███████
█████████
███████████
█████████████
█████████████
█████████████
███████████████
█████████████
█████████████
█████████████
███████████
█████████
███████
█
Step 1:
█
███████
█ █
██ ██
██ ██
██ ██
███ ███
██ ██
██ ██
██ ██
█ █
███████
█
Step 2:
█
███████
█ █
██
██
██
█ ███
██
██
██
█ █
███████
█
Step 3:
█
███████
█ █
█ █
█ █
███████
█
Step 4:
█
█ █
█ █
█ █
███████
█
Step 5:
█
█ █
█ █
█ █
█
Step 6:
█ █
█ █
█ █
█
Step 7:
█
█ █
█ █
█
Step 8:
█ █
█ █
█
Step 9:
█
█ █
█
Step 10:
█ █
█
Step 11:
█
█
Step 12:
█
Step 13:
#sel clear
#sel 1 -462 58 579
#sel 2 -454 58 589
#sel 1 -464 58 581
#sel 2 -463 58 587
#sel 1 -453 58 581
#sel 2 -452 58 587
#sel 1 -461 58 578
#sel 2 -455 58 578
#sel 1 -461 58 590
#sel 2 -455 58 590
#sel 1 -458 58 577
#sel 2 -458 58 577
#sel 1 -463 58 580
#sel 2 -463 58 580
#sel 1 -453 58 580
#sel 2 -453 58 580
#sel 1 -465 58 584
#sel 2 -465 58 584
#sel 1 -451 58 584
#sel 2 -451 58 584
#sel 1 -463 58 588
#sel 2 -463 58 588
#sel 1 -453 58 588
#sel 2 -453 58 588
#sel 1 -458 58 591
#sel 2 -458 58 591
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
File details
Details for the file lirpy-0.0.1.tar.gz
.
File metadata
- Download URL: lirpy-0.0.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d7ff52f00c95d1fe132ab5257fe415dd85df5b69591853f9b7a93aae727ea22 |
|
MD5 | f6cba86109bf39fe6b2c461e4537b91c |
|
BLAKE2b-256 | bc23456d8d39e74e015248d1de6092299ecc4b6bbbb652c18512cedc4cb6750f |
File details
Details for the file lirpy-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: lirpy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26653752b813b28562d25957e613fa13a957770ad3c1e44c34a43aecc5c7bfe2 |
|
MD5 | ed6925d3db4b71364271751aebcfd35e |
|
BLAKE2b-256 | 4183cab981b5f808aaefb96326491f8991f0f16deb11b5544de59a9c5e7386fe |