Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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