|
1 | | -# DCEL |
| 1 | +# pydcel: A Data Structure for Doubly-Connected Edge List (DCEL) |
2 | 2 |
|
3 | | -A python package for working with doubly-connected edge lists (DCELs). |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +`pydcel` is a Python library providing the implementation of the Doubly-Connected Edge List (DCEL) data structure. The doubly connected edge list (DCEL), also known as half-edge data structure, is a data structure to represent an embedding of a planar graph in the plane, and polytopes in 3D [[1]](https://en.wikipedia.org/wiki/Doubly_connected_edge_list). |
| 6 | + |
| 7 | +`pydcel` allows for efficient traversal and modification of the graph, making it ideal for applications such as geometric modeling, mesh processing, and algorithms related to computational geometry. By maintaining connectivity information for vertices, edges, and faces, the DCEL facilitates operations like edge flipping, face traversal, and vertex splitting, among others. This structure is particularly valuable in areas such as computer graphics, geographic information systems (GIS), and 3D modeling, where efficient representation and manipulation of geometric data are crucial. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +* **DCEL Data Structure:** A complete and efficient implementation of the DCEL data structure. |
| 12 | +* **Point and Vertex Handling:** Functions for creating, manipulating, and managing points and vertices within the DCEL. |
| 13 | +* **Edge and Face Operations:** Support for edge insertion, deletion, traversal, and finding twins, along with face manipulation. |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +To install the library, using `pip`, run the following command: |
| 18 | + |
| 19 | +```bash |
| 20 | +pip install pydcel |
| 21 | +``` |
| 22 | + |
| 23 | +If you prefer using `pipenv`, you can install the library using the following command: |
| 24 | + |
| 25 | +```bash |
| 26 | +pipenv install pydcel |
| 27 | +``` |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +The library provides classes for `Point`, `Vertex`, and `Edge` which can be used to construct a `DCEL`. |
| 32 | + |
| 33 | +The `Dcel` takes 2 arguments: |
| 34 | +- list containing touples of points as input. |
| 35 | +- list containing touples of edges as input. |
| 36 | + |
| 37 | +```python |
| 38 | +from dcel import Dcel |
| 39 | + |
| 40 | +# Define vertices for the polygon as a list of tuples |
| 41 | +vertex_coords = [ |
| 42 | + (0, 0), (2, 2), (4, 0), |
| 43 | + (3, -2), (1, -2) |
| 44 | +] |
| 45 | + |
| 46 | +# Define edges connecting the vertices |
| 47 | +edges = [ |
| 48 | + (0, 1), (1, 2), (2, 3), (3, 4), (4, 0) |
| 49 | +] |
| 50 | + |
| 51 | +# Create DCEL from vertices and edges |
| 52 | +dcel = Dcel(vertex_coords, edges) |
| 53 | + |
| 54 | +# Print DCEL Statistics |
| 55 | +print(dcel.statistics) |
| 56 | +``` |
| 57 | + |
| 58 | +More detailed usage examples can be found in the [examples](../examples/) directory. |
| 59 | + |
| 60 | + |
| 61 | +## Acknowledements |
| 62 | + |
| 63 | +`pydcel` builds upon the theoretical insights provided by [Dr. Sanjoy Pratihar](https://sites.google.com/site/sanjoypratihar/home) and takes inspiration from the work of [Angel Yanguas-Gil](https://scholar.google.com/citations?user=HKXeJ9cAAAAJ&hl=en) on the [DCEL](https://pypi.org/project/dcel/) data structure. |
| 64 | + |
| 65 | +## Contributing |
| 66 | + |
| 67 | +To contribute to `pydcel`, please follow the guidelines mentioned in the [CONTRIBUTING.md](../CONTRIBUTING.md) file. |
| 68 | + |
| 69 | +## License |
| 70 | + |
| 71 | +`pydcel` is distributed under the BSD 3-Clause License. For more information, please refer to the [LICENSE](../LICENSE) file. |
0 commit comments