Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erasta/three-halfedge-dcel
Doubly-Connected-Edge-List (DCEL) implementation for three.js
https://github.com/erasta/three-halfedge-dcel
3d dcel halfedge javascript threejs
Last synced: about 24 hours ago
JSON representation
Doubly-Connected-Edge-List (DCEL) implementation for three.js
- Host: GitHub
- URL: https://github.com/erasta/three-halfedge-dcel
- Owner: erasta
- License: mit
- Created: 2022-09-03T10:19:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-11T20:05:18.000Z (over 2 years ago)
- Last Synced: 2024-12-16T19:44:47.123Z (9 days ago)
- Topics: 3d, dcel, halfedge, javascript, threejs
- Language: JavaScript
- Homepage: https://erasta.github.io/three-halfedge-dcel/index.html
- Size: 9.37 MB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# three-halfedge-dcel
Doubly-Connected-Edge-List (DCEL) or Half-Edge data structure implementation for three.js[![npm](https://img.shields.io/npm/v/three-halfedge-dcel?style=plastic)](https://www.npmjs.com/package/three-halfedge-dcel)
The Doubly-Connected-Edge-List (DCEL) or Half-Edge data structure is a compact and efficient representation of all faces, edges and vertices in a mesh, allowing fast spatial travel and queries.
DCEL Contains a list of faces in a geometry, each holding a cyclic linked-list of half-edges. Each half-edge is composed of two vertices and its twin half-edge on the adjacent face.
For more information [wikipedia](https://en.wikipedia.org/wiki/Doubly_connected_edge_list). Illustration:## Demo
This demo color the face pointed by the user, and color all its adjacent faces and their adjacent faces, upto the k-th steps distance, with color according to its adjacency steps distance from the pointed face.
https://erasta.github.io/three-halfedge-dcel
![Preview of the demo](files/halfedge-small.gif)## Install
```sh
npm install --save three-halfedge-dcel
```## Usage
```js
import { Dcel } from 'three-halfedge-dcel';
const mesh = new THREE.Mesh(...); // get your mesh from somewhere
const dcel = new Dcel(mesh.geometry, {
mergeVerticesThreshold: identical_vertices_max_dist // default: 1e-4
});
dcel.forAdjacentFaces(faceIndex, (adjacentFaceIndex) => {
... // do something with adjacent faces
})
```