This is where the javascript implementation is executed, which also takes an optional center point.
function circlePoints (radius, numPoints, centerX, centerY) { centerX = centerX || 0; centerY = centerY || 0; var step = (Math.PI * 2) / numPoints, current = 0, i = 0, results = [], x, y; for (; i < numPoints; i += 1) { x = centerX + Math.sin(current) * radius; y = centerY + Math.cos(current) * radius; results.push([x,y]); console.log('point %d @ x:%d, y:%d', i, x, y); current += step; } return results; }
source share