Skip to content

Instantly share code, notes, and snippets.

@bradparker
Last active January 3, 2016 13:29
Show Gist options
  • Save bradparker/8469991 to your computer and use it in GitHub Desktop.
Save bradparker/8469991 to your computer and use it in GitHub Desktop.
simple x and y cords for a circle
function circle (radius, x, y, nPoints) {
var circle = [];
var nPoints = nPoints || 360;
var wedge = 2 * Math.PI / nPoints;
for (var angle = wedge; angle < 2 * Math.PI; angle += wedge) {
circle.push({
x: x + radius * Math.cos(angle),
y: y + radius * Math.sin(angle)
});
}
return circle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment