Metadata-Version: 2.4
Name: pygeometry2d
Version: 1.1.3
Summary: 2D Geometry Library
Home-page: https://github.com/leonardopbatista/pygeometry2d
Author: Leonardo Pires Batista
Author-email: leonardopbatista98@gmail.com
License: MIT License
Project-URL: Documentation, https://pygeometry2d.readthedocs.io/
Project-URL: Source code, https://github.com/leonardopbatista/pygeometry2d
Project-URL: Download, https://github.com/leonardopbatista/pygeometry2d
Keywords: geometry 2d
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: summary

# 2D Geometry Library in Python
[![en](https://img.shields.io/badge/lang-en-red.svg)](https://github.com/leonardopbatista/pygeometry2d/blob/master/README.md)
[![pt-br](https://img.shields.io/badge/lang-pt--br-green.svg)](https://github.com/leonardopbatista/pygeometry2d/blob/master/README.pt-br.md)

This is a lightweight and simple library for handling 2D geometries using only Python's native libraries. It allows performing common geometric operations such as distance calculations, intersections, rotations, and other geometric transformations.

## Main Features

- Point manipulation (`XY` class).
- Creation and operations with lines (`Line`).
- Support for arcs (`Arc`) and circles (`Circle`).
- Bounding box generation (`BoundingBox`).
- Handling polylines (`Polyline`) and rectangles (`Rectangle`).
- Geometric utilities such as angle normalization, orthogonality checking, and shape intersections.

## Installation

Install the library via pip:

```sh
pip install pygeometry2d
```

Then, import it into your project:

```python
from pygeometry2d import XY, Line, Circle, Polyline
```

## Usage Examples

### Creating and Manipulating Points

```python
p1 = XY(3, 4)
p2 = XY(6, 8)
distance = p1.distance(p2)
print(distance)  # 5.0
```

### Creating and Manipulating Lines

```python
line = Line(XY(0, 0), XY(3, 4))
print(line.length)  # Line length
```

### Creating a Circle and Checking Intersections

```python
circle = Circle(XY(0, 0), 10)
line = Line(XY(-10, 0), XY(10, 0))
intersections = circle.intersection(line)
print(intersections)  # List of intersection points
```

### Working with Polylines

```python
polyline = Polyline([XY(0, 0), XY(3, 4), XY(6, 0)])
print(polyline.length)  # Total polyline length
```

## Documentation

Full documentation is available on [readthedocs](https://pygeometry2d.readthedocs.io/).

## Contribution

If you would like to contribute with improvements or suggest new features, feel free to open a PR or create an issue on the GitHub repository.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

