Filling a polygon
问题 I created this function that draws a simple polygon with n number of vertexes: void polygon (int n) { double pI = 3.141592653589; double area = min(width / 2, height / 2); int X = 0, Y = area - 1; double offset = Y; int lastx, lasty; double radius = sqrt(X * X + Y * Y); double quadrant = atan2(Y, X); int i; for (i = 1; i <= n; i++) { lastx = X; lasty = Y; quadrant = quadrant + pI * 2.0 / n; X = round((double)radius * cos(quadrant)); Y = round((double)radius * sin(quadrant)); setpen((i * 255)