A modern, object-oriented Python utility for computing geometric properties of rectangles and squares — including area, perimeter, diagonal length, ASCII drawings, and shape packing calculations.
Clean, simple, highly extensible, and fully documented.
- Compute area, perimeter, diagonal
- Generate ASCII pictures (
get_picture) - Measure how many shapes fit inside (
get_amount_inside) - Supports dynamic width & height updates
- Clean repr:
Rectangle(width=10, height=5)
- Inherits from
Rectangle - Always maintains equal sides
- Setter methods are overridden (
set_side,set_width,set_height) - Clean repr:
Square(side=5)
Clone the repository:
git clone https://github.com/TheComputationalCore/Polygon-Area-Calculator.git
cd Polygon-Area-Calculator
pip install .from polygon_calculator import Rectangle, Square
rect = Rectangle(10, 5)
print(rect.get_area()) # 50
print(rect.get_perimeter()) # 30
print(rect.get_diagonal()) # 11.18
print(rect.get_picture())
sq = Square(8)
print(sq.get_area()) # 64
sq.set_side(4)
print(sq.get_diagonal()) # 5.66
print(sq.get_picture())
rect.set_width(16)
rect.set_height(8)
print(rect.get_amount_inside(sq)) # 8**********
**********
**********
**********
**********
Run help:
polygon-calculator --helpExample:
polygon-calculator --rectangle 10 5
polygon-calculator --square 7Full documentation is available at:
👉 https://thecomputationalcore.github.io/Polygon-Area-Calculator/
Documentation includes:
- Usage Guide
- API Reference
- CLI Guide
- Examples
pytest -qContributions are welcome!
See CONTRIBUTING.md for full workflow and guidelines.
More details in SECURITY.md
This project is licensed under the MIT License.