Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/pslg-to-poly
Convert a planar straight line graph into a polygon
https://github.com/mikolalysenko/pslg-to-poly
Last synced: about 2 months ago
JSON representation
Convert a planar straight line graph into a polygon
- Host: GitHub
- URL: https://github.com/mikolalysenko/pslg-to-poly
- Owner: mikolalysenko
- License: mit
- Created: 2015-06-29T16:00:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-29T16:01:56.000Z (over 9 years ago)
- Last Synced: 2024-10-20T14:24:32.978Z (2 months ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pslg-to-poly
============
Converts a planar straight line graph into a polygon.# Example
```javascript
var pslg2poly = require('pslg-to-poly')var points = [
[-1, 1],
[ 1, 1],
[ 1,-1],
[-1,-1]
]var edges = [[0,1], [1,2], [2,3], [3,0]]
console.log(pslg2poly(points, edges))
```#### Output
```javascript
[ [ [ -1, 1 ], [ -1, -1 ], [ 1, -1 ], [ 1, 1 ] ] ]
```# Install
```
npm i pslg-to-poly
```# API
#### `require('pslg-to-poly')(points, edges)`
Converts a planar straight line graph into a complex polygon represented by a list of loops.* `points` are the vertices of the pslg
* `edges` are the edges of the pslg**Returns** an array of loops encoding the boundary of the interior of the input pslg
# License
(c) 2015 Mikola Lysenko. MIT License