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: 10 months 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 (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T20:00:00.000Z (over 8 years ago)
- Last Synced: 2025-03-14T23:24:27.680Z (over 1 year ago)
- Topics: geometry, math, n-gon, polygon
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- 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

## 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