A Python implementation of the Doubly-Connected Edge List (DCEL) data structure.
Project description
pydcel: A Data Structure for Doubly-Connected Edge List (DCEL)
Project Overview
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].
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.
Features
- DCEL Data Structure: A complete and efficient implementation of the DCEL data structure.
- Point and Vertex Handling: Functions for creating, manipulating, and managing points and vertices within the DCEL.
- Edge and Face Operations: Support for edge insertion, deletion, traversal, and finding twins, along with face manipulation.
Installation
To install the library, using pip
, run the following command:
pip install pydcel
If you prefer using pipenv
, you can install the library using the following command:
pipenv install pydcel
Usage
The library provides classes for Point
, Vertex
, and Edge
which can be used to construct a DCEL
.
The Dcel
takes 2 arguments:
- list containing touples of points as input.
- list containing touples of edges as input.
from dcel import Dcel
# Define vertices for the polygon as a list of tuples
vertex_coords = [
(0, 0), (2, 2), (4, 0),
(3, -2), (1, -2)
]
# Define edges connecting the vertices
edges = [
(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)
]
# Create DCEL from vertices and edges
dcel = Dcel(vertex_coords, edges)
# Print DCEL Statistics
print(dcel.statistics)
More detailed usage examples can be found in the examples directory.
Acknowledements
pydcel
builds upon the theoretical insights provided by Dr. Sanjoy Pratihar and takes inspiration from the work of Angel Yanguas-Gil on the DCEL data structure.
Contributing
To contribute to pydcel
, please follow the guidelines mentioned in the CONTRIBUTING.md file.
License
pydcel
is distributed under the BSD 3-Clause License. For more information, please refer to the LICENSE file.
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
File details
Details for the file pydcel-1.0.1.tar.gz
.
File metadata
- Download URL: pydcel-1.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa6896ff4a32988ec99772509fb5711c86e52e18b49b22759703dcb58e148be3 |
|
MD5 | 340a67207e7752a31fe3f63834a09216 |
|
BLAKE2b-256 | d869d4d208c5dfca9965da66fcfcf428e1d268f2ec44f59be8d0bfd7908e861a |
File details
Details for the file pydcel-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pydcel-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa4fa9cea10d6530fb1817065c2ddf5c8d9b09a98cbd63acab89f854f62bea16 |
|
MD5 | 1f4747c59e75c1eb94f8b383d38edbba |
|
BLAKE2b-256 | e36a16abb14eac3775bb2657c4112f9fd24fb933d2b48b49f79dd05040873b20 |