Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/weighted-delaunay
Constructs a weighted Delaunay triangulation of a point set
https://github.com/mikolalysenko/weighted-delaunay
Last synced: about 2 months ago
JSON representation
Constructs a weighted Delaunay triangulation of a point set
- Host: GitHub
- URL: https://github.com/mikolalysenko/weighted-delaunay
- Owner: mikolalysenko
- License: mit
- Created: 2015-07-02T18:25:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-03T11:13:31.000Z (over 9 years ago)
- Last Synced: 2024-10-19T00:19:15.873Z (2 months ago)
- Language: JavaScript
- Homepage: https://mikolalysenko.github.io/weighted-delaunay
- Size: 254 KB
- Stars: 18
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
weighted-delaunay
=================
Constructs the weighted Delaunay triangulation of a set of points. This is equivalent to constructing a Delaunay triangulation of a set of spheres whose radii are the same as the weights for each point.# [Demo](https://mikolalysenko.github.io/weighted-delaunay)
[](https://mikolalysenko.github.io/weighted-delaunay)
# Example
```javascript
var wdt = require('weighted-delaunay')var points = new Array(10)
var weights = new Array(10)
for(var i=0; i<10; ++i) {
points[i] = [ Math.random(), Math.random() ]
weights[i] = Math.random()
}var cells = wdt(points, weights)
console.log(cells)
```### Output
Example output:
```javascript
[ [ 1, 0, 5 ],
[ 1, 4, 6 ],
[ 0, 7, 5 ],
[ 1, 7, 4 ],
[ 7, 1, 5 ],
[ 7, 0, 8 ] ]
```# Install
```
npm i weighted-delaunay
```# API
#### `require('weighted-delaunay')(points, cells[, pointAtInfinity])`
Constructs a weighted Delaunay triangulation.* `points` - the points of the weighted delaunay triangulation
* `weights` the weights for each points
* `pointAtInfinity` an optional flag, which if set to `true` adds the point at infinity to the triangulation. (Default `false`)**Returns** The cells of the resulting weighted Delaunay triangulation.
# License
(c) 2015 Mikola Lysenko. MIT License