def polygon(centerX: float, centerY: float, radius: float, numCorners: int) ->Outline: angle = 1.5*math.pi points = [] incAngle = 2*math.pi/numCorners for i in range(numCorners): x = math.cos(angle+incAngle*i)*radius+centerX y = math.sin(angle+incAngle*i)*radius+centerY points.append(Point(x,y)) poly = Outline(None) poly.addLinesFromPoints(points) poly.closeShape() poly = poly.rotate(incAngle/2.0, Point(centerX, centerY)) return poly
def polygon(centerX: float, centerY: float, radius: float, numCorners: int) -> Outline: angle = 1.5 * math.pi points = [] incAngle = 2 * math.pi / numCorners for i in range(numCorners): x = math.cos(angle + incAngle * i) * radius + centerX y = math.sin(angle + incAngle * i) * radius + centerY points.append(Point(x, y)) poly = Outline(None) poly.addLinesFromPoints(points) poly.closeShape() poly = poly.rotate(incAngle / 2.0, Point(centerX, centerY)) return poly