This is not a homework problem. It is meant as a challenge for people who really enjoy math and have time to spare.
Background Info
Suppose you have a 2D Cartesian coordinate system. There are three shapes: R, C, and P.
R is a large rectangle. Its left side is along the vertical axis, and its bottom side is along the horizontal axis, such that its bottom-left corner is at the origin (0, 0).
C is a small circle that is located somewhere inside of R. The center of C is not necessarily at R's geometric center. C's border cannot intersect with any part of R's border.
P is an irregular polygon of N sides. It is a simple, convex polygon (not self-intersecting, all angles under 180 degrees). R surrounds P, and P surrounds C. In other words, P's corners and sides exist in the region between C's border and R's border. The corners of P do not necessarily touch the sides of R. Any of P's sides may be tangent to C, but none of P's sides may overlap inside of C.
Objective
Design an algorithm that generates a random variation of P's corners. The corners of P are placed at random distances and random angles relative to C's center. The algorithm's output is an ordered set of Cartesian coordinates, arranged by counter-clockwise position around C.
You are given the following constant values:
- the width and height of the bounding rectangle R
- the radius and center of the circle C
- the number N of corners for polygon P
- the maximum distance between the center of C and any of P's corners
If this is solvable, how would you implement this algorithm?
Or if this is not solvable, can you explain why not? What would need to change so that it becomes solvable?



