Generate coordinates on a circle's perimeter
- JavaScript 100%
|
|
||
|---|---|---|
| index.js | center circle point | |
| LICENSE | Add LICENSE | |
| package.json | update version | |
| README.md | update README.md | |
| visual.png | add visual.png | |
points-on-circle
Given the number of points returns an array of xy coordinates on the circle's perimeter. Optional: You can give the circle's radius and center point (x , y)
Usage
pointsOnCircle(NumberOfPoints, radius = 1, x = 0, y = 0)
Where x and y is the center of the circle
let pointsOnCircle = require('points-on-circle')
let numPoints = 4
let rad = 10
let x = width/2
let y = height/2
let points = pointsOnCircle(numPoints ,rad, x, y)
console.log(points)
License
MIT