As I see it the parameters are:

a/ Cutter diameter

b/ Angular increment of chuck position

c/ Distance of flat from axis of rotation

d/ Length of flat

At the beginning, simplify the problem and forget cutter diameter (or assume it is zero). Work out the x-coordinate of the polygon side as it rotates from vertical to having its vertex aligned with x-axis.

Then add in correction for cutter diameter.

Your last two (c & d) are not independent parameters; one is derived from the other.

(1) Call number of polygon sides n. Hence interior angle subtended by the chord (polygon side) is 360/n and interior half angle is 180/n (e.g. 90 and 45 degrees for a square). Call radius of circumscribed circle of polygon r. As we will see later, this does not necessarily have to be your stock diameter.

(2) With stock rotational axis at (0,0), when one side of polygon is vertical, edge of polygon has x-coord = r cos(180/n). Call this m. When vertex of polygon lies along x-axis, 'side' of polygon has x-coord = r.

So that gives you two (three, due to symmetry) points along the side of the polygon. The challenge is to work out the intermediate points.

(3) Rotate your polygon side clockwise about (0,0) some angle a (limits/bounds of a are + or - 180/n as above). Draw the perpendicular bisector of your rotated polygon side, which should pass through (0,0). The distance from the midpoint of your polygon side to your rotational axis is m as above. The (horizontal) distance x from the rotational centre to the intersection of the polygon side with the x-axis is x = m/cos a.

This is the general formula for the intersection of the polygon side with the x-axis. Check it works by putting in a = 0 [x = m = r cos (180/n)] and a = 180/n [x = r].

(4) Now you have to add in an additional dx to cater for cutter diameter. Draw a circle centred on the x-axis of radius c (cutter radius). Draw a tangent to that circle on the left hand side of the circle, such that the angle between the tangent and the x-axis is acute above the axis. Call this angle 90 - a. Now draw a line from the centre of the circle to the point of tangency (of length c). The angle of this line with the x-axis is a.

The extra offset required due to the cutter is dx = c / cos a.

So for any angle a, the x-coord of the cutter (of radius c) is x + dx.

(5) This works up to the point where the vertex of the polygon is tangent to the cutter. This will always be at an angle a less than 180/n. If your stock diameter is bigger than the circumscribed circle of your polygon, you now have to roll the cutter around the vertex of the polygon in order to complete its shape. The maths here becomes more involved, so we will leave it there just for now and assume our stock diameter equals the circumscribed circle of the polygon.

(6) I think you can show that the vertex of the polygon is tangent to the cutter when tan a = (r sin (180/n))/ (m + C). This means that if your stock is exactly the diameter of the circumscribed circle of the polygon, you can stop at this point (i.e. you do not have to keep incrementing a until it reaches 180/n) as any further angular increment of the rotational axis will only cut air.

The bigger the cutter diameter, the less the scallops will be.

Could I ask you a favour in return? Please work out a formula relating cutter diameter, cut spacing and scallop height.

Other homework: consider what happens for n < 3. Consider what happens when n is not an integer.

Doing maths like this is how I imagine long division was in Roman times. I can send diagrams if you pm me your email address.