Skip to content

Latest commit

 

History

History
139 lines (92 loc) · 2.47 KB

File metadata and controls

139 lines (92 loc) · 2.47 KB

📐 Polygon Area Calculator

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.


🔖 Badges

Tests Docs Deployed License


🚀 Features

🟦 Rectangle Class

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

🟥 Square Class

  • Inherits from Rectangle
  • Always maintains equal sides
  • Setter methods are overridden (set_side, set_width, set_height)
  • Clean repr: Square(side=5)

📦 Installation

Clone the repository:

git clone https://github.com/TheComputationalCore/Polygon-Area-Calculator.git
cd Polygon-Area-Calculator
pip install .

📘 Usage Example

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

📊 Example Picture Output

**********
**********
**********
**********
**********

🖥️ Command Line Interface (CLI)

Run help:

polygon-calculator --help

Example:

polygon-calculator --rectangle 10 5
polygon-calculator --square 7

📚 Documentation

Full documentation is available at:

👉 https://thecomputationalcore.github.io/Polygon-Area-Calculator/

Documentation includes:

  • Usage Guide
  • API Reference
  • CLI Guide
  • Examples

🧪 Running Tests

pytest -q

🤝 Contributing

Contributions are welcome!
See CONTRIBUTING.md for full workflow and guidelines.


🔐 Security

More details in SECURITY.md


📄 License

This project is licensed under the MIT License