Here's a solution using C #:
void DrawCirclePoints(int points, double radius, Point center) { double slice = 2 * Math.PI / points; for (int i = 0; i < points; i++) { double angle = slice * i; int newX = (int)(center.X + radius * Math.Cos(angle)); int newY = (int)(center.Y + radius * Math.Sin(angle)); Point p = new Point(newX, newY); Console.WriteLine(p); } }
Example output from DrawCirclePoints(8, 10, new Point(0,0)); :
{X=10,Y=0} {X=7,Y=7} {X=0,Y=10} {X=-7,Y=7} {X=-10,Y=0} {X=-7,Y=-7} {X=0,Y=-10} {X=7,Y=-7}
Good luck
Daniel Lidström Mar 14 2018-11-11T00: 00Z
source share