A library for geometric computations (for didactic purposes only).
Project description
Geometry Library
A modern Python library for geometric calculations, providing an object-oriented interface for manipulating geometric shapes.
Overview
Geometry Library provides an elegant and extensible way to perform geometric calculations in Python. Using solid object-oriented design principles and design patterns, the library allows you to create and manipulate various geometric shapes in a consistent manner.
Features
- Unified interface for all geometric shapes
- Support for circles, rectangles, triangles, and regular polygons
- Precise area and perimeter calculations
- Robust input validation
- Factory pattern implementation for object creation
- Static typing for enhanced safety and better documentation
Installation
To install the library, use pip:
pip install geometry-lib-pca
Usage
from geometry_lib import ShapeFactory, ShapeType
from geometry_lib.shapes.base import Polygon
# Create a circle
circle = ShapeFactory.create(ShapeType.CIRCLE, 5)
print(f"Circle area: {circle.compute_area():.2f}")
print(f"Circle circumference: {circle.compute_perimeter():.2f}")
# Create a rectangle
rectangle = ShapeFactory.create(ShapeType.RECTANGLE, 4, 6, 4, 6)
print(f"Rectangle area: {rectangle.compute_area():.2f}")
print(f"Rectangle perimeter: {rectangle.compute_perimeter():.2f}")
# Create a triangle
triangle = ShapeFactory.create(ShapeType.TRIANGLE, 3, 4, 5)
print(f"Triangle area: {triangle.compute_area():.2f}")
print(f"Triangle perimeter: {triangle.compute_perimeter():.2f}")
Requirements
- Python 3.9 or higher
Development
To set up the development environment:
# Clone the repository
git clone https://github.com/UNIFESO-Gabriel/geometry-lib-pca.git
cd geometry-lib
# Install development dependencies
poetry install
To run tests:
poetry run pytest -v ./tests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geometry_lib_pca-1.0.4.tar.gz.
File metadata
- Download URL: geometry_lib_pca-1.0.4.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.0 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2e804f7431e1c0c2e936d46a5bca9ed5c6fd51898e463ea239ad2a7468098ef
|
|
| MD5 |
4267c443b2d426a5d371f082887b20c6
|
|
| BLAKE2b-256 |
eddc3dd7fb0ed089a535dac816cbc001a94866ddbba9e38b1989792c54440fd1
|
File details
Details for the file geometry_lib_pca-1.0.4-py3-none-any.whl.
File metadata
- Download URL: geometry_lib_pca-1.0.4-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.0 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4249e733fd0ed08cb54f7b7f415655f680779a44a01ce8501b5e9a91c6226835
|
|
| MD5 |
466acd9b8d395666559fb01ee820d836
|
|
| BLAKE2b-256 |
c73a9ab0e1a60e008396a5a095c3764be4f37b6f8f964483b3374182e6daa7f1
|