Code Monkey home page Code Monkey logo

three-halfedge-dcel's Introduction

three-halfedge-dcel

Doubly-Connected-Edge-List (DCEL) or Half-Edge data structure implementation for three.js

npm

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. Illustration:

Dcel-halfedge-connectivity

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

Install

npm install --save three-halfedge-dcel

Usage

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
})

three-halfedge-dcel's People

Contributors

erasta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

three-halfedge-dcel's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.