Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semibran/n-gon
:stop_sign: create regular polygons with n sides
https://github.com/semibran/n-gon
geometry math n-gon polygon
Last synced: 16 days ago
JSON representation
:stop_sign: create regular polygons with n sides
- Host: GitHub
- URL: https://github.com/semibran/n-gon
- Owner: semibran
- License: mit
- Created: 2017-06-08T21:44:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T20:00:00.000Z (over 6 years ago)
- Last Synced: 2024-10-20T13:19:20.936Z (28 days ago)
- Topics: geometry, math, n-gon, polygon
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# n-gon
> create regular polygons with `n` sides![stop sign](stop.png "hmmm")
## usage
[![npm badge]][npm package]A "polygon" is just an array of `[ x, y ]` points, which allows you to map it to a new size and position.
```js
const gon = require('n-gon')let polygon = gon(7)
.map(([ x, y ]) => [
x * size + offset[0],
y * size + offset[1]
])
```[npm badge]: https://nodei.co/npm/n-gon.png?mini
[npm package]: https://www.npmjs.com/package/n-gon