Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/mesh-geodesic
Approximate geodesic distance for triangulated meshes
https://github.com/mikolalysenko/mesh-geodesic
Last synced: about 2 months ago
JSON representation
Approximate geodesic distance for triangulated meshes
- Host: GitHub
- URL: https://github.com/mikolalysenko/mesh-geodesic
- Owner: mikolalysenko
- License: mit
- Created: 2013-04-10T15:41:05.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-09T16:51:11.000Z (over 11 years ago)
- Last Synced: 2024-10-20T14:27:14.010Z (2 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mesh-geodesic
=============
Computes the [geodesic](http://en.wikipedia.org/wiki/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:```javascript
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 mesh
* `positions`: The positions of the mesh
* `initialVertex`: Index of the starting vertex
* `maxDistances`: (Optional) The total distance to travel to find all points. If not specified, is set to Infinity
* `tolerance`: (Optional) Accuracy of distance field. (Default 1e-4)
* `dual`: (Optional) Topological dual of mesh. Can be computed using [`require("simplicial-complex").dual`](https://github.com/mikolalysenko/simplicial-complex)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