This question already has an answer here:
Consider a regular polygon with n-sides ith radius 1. I want to construct an equation in polar coordinates for this polygon.
On the internet, I found this:
(first part) Consider the equation of just one half of one side of the $n$-gon. It's the side of a right triangle opposite angle $A = π/n$. The hypotenuse of this triangle is $1$ (the radius of the $n$-gon), so the equation of this one side is $\cos(π/n)/\cos(θ)$, where $θ$ goes from $0$ to $π/n$. The other half of this side has the same equation, so we're already at the point where we know the equation of one side of the $n$-gon: $r = \cos(π/n) / \cos(θ), -π/n ≤ θ ≤ π/n .$
(second part)Next, we will need to develop a function of θ that "normalizes" θ to be within plus or minus $π/n$. This is accomplished by the "floor" function, as follows: $B = θ - 2 π/n \lfloor(n θ + π)/(2 π)\rfloor $
Putting it together, the equation of an n-gon is $r = \cos(A)/\cos(B)$, which is $r = \cos(π/n)/\cos(θ - 2 π/n \lfloor(n θ + π)/(2 π)\rfloor) $
Someone can give me a help to understand the second part or show me an another solution?
Thanks in advance.