I am trying to figure out how to dynamically place numbers around a circle (similar to a dial), but dynamically, so if the number of numbers around a circle is 5 or 27, they will be correctly selected.
I found the code (below) that looked as if it could help, but I had problems with its implementation. I donβt know how I tie this back to the circle and numbers.
Any help would be greatly appreciated. Thanks
function getNPointsOnCircle( center:Point, radius:Number, n:Number = 10 ) : Array
{
var alpha:Number = Math.PI * 2 / n;
var points:Array = new Array( n );
var i:int = -1;
while( ++i < n )
{
var theta:Number = alpha * i;
var pointOnCircle:Point = new Point( Math.cos( theta ) * radius, Math.sin( theta ) * radius );
points[ i ] = center.add( pointOnCircle );
}
return points;
}
source
share