mesh-geodesic
Approximate geodesic distance for triangulated meshes
npm install mesh-geodesic
Want to see pretty graphs? Log in now!
11 | downloads in the last month |
Last Published By | |
---|---|
Version | 0.0.0-a last updated 8 months ago |
License | MIT |
Keywords | mesh, geodesic, triangle, topology, riemannian, geometry, approximate, surface |
Repository | git://github.com/mikolalysenko/mesh-geodesic.git (git) |
Bugs | https://github.com/mikolalysenko/mesh-geodesic/issues |
Dependencies | heap, simplicial-complex |
Dependents | mikolalysenko-hoarders |
mesh-geodesic
Computes the geodesic distance to all vertices in a triangulated mesh from a given starting vertex.
Usage
First install using npm:
npm install mesh-geodesic
Then call it as follows:
var bunny = require("bunny")
console.log(require("mesh-geodesic")(bunny.cells, bunny.positions, 0))
require("mesh-geodesic")(cells, positions, initialVertex[, maxDistance, tolerance, dual])
Computes the geodesic distance to an initial vertex. Takes the following arguments:
cells
: The cells of the meshpositions
: The positions of the meshinitialVertex
: Index of the starting vertexmaxDistances
: (Optional) The total distance to travel to find all points. If not specified, is set to Infinitytolerance
: (Optional) Accuracy of distance field. (Default 1e-4)dual
: (Optional) Topological dual of mesh. Can be computed usingrequire("simplicial-complex").dual
Returns an object containing the distances to all vertices from initialVertex
Note
This package was written back when I first started learning JavaScript, and probably has several bugs. It is also very slow and uses the outdated vows test harness (whereas if I were to do it again today, I would use tap). Nonetheless, it still should compute geodesics for you to some (low) level of accuracy.
Credits
(c) 2013 Mikola Lysenko. MIT License