Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Last active December 14, 2015 06:09
Show Gist options
  • Save jasonblanchard/5040071 to your computer and use it in GitHub Desktop.
Save jasonblanchard/5040071 to your computer and use it in GitHub Desktop.
I need a function that will take a number of outer circles and the x, y coordinates of the inner circle and returns x, y values for each outer circle such that they will be evenly spaced around the inner circle. Something like this:
function placeCircles(inner-circle-x, inner-circle-y, number-of-outter-outter-circles) {
/* Some math-ey stuff */
/* The math-ey stuff returns an array of arrays with x, y coordinates for each outer circle */
}
placeCircles(50, 50, 5) // Returns [ [50, 10], [75, 35], [75, 75], [35, 75], [35, 35] ] (or something)

So it looks like this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment