# How to draw the curve of a point on a regular polygon

A point is on one side of a regular polygon, and the regular polygon rotates at a constant speed. How can I draw the change curve of the vertical coordinate of the point with time?

• I think the equation of each closed curve (well, each polygon) in the planar polar coordinate system $\rho = \rho(\phi)$ will help much. Commented Feb 24, 2020 at 8:20
• related: this and this
– kglr
Commented Feb 24, 2020 at 10:31
• @Αλέξ, luckily this has been done. Commented Apr 25, 2020 at 11:00
• @J.M. Thx for the information! Commented Apr 25, 2020 at 11:03

How it exactly should rotate is not clear to me (still image), but here is my interpretation of doing it:

ClearAll[func,regpolygon]
func[θ_]:={Cos[θ],Sin[θ]}
regpolygon[n_][θ_]:=func[θ] Cos[Pi/n]/Cos[(2Pi)/n ((θ n)/(2Pi)-Floor[(θ n)/(2Pi)])-Pi/n]
MakeScene[θ_,f_]:=Module[{plog,t,p1,pt0,pt1,pt2},
plog=ParametricPlot[f[t]-{1,0},{t,0,2Pi},PlotStyle->Red];
pt0={-1,0};
pt1=f[θ]-{1,0};
pt2={0,f[θ][[2]]};
p1=Plot[f[t+θ][[2]],{t,0,2Pi},PlotRange->{{-2.1,2Pi},{-1.05,1.05}},AspectRatio->Automatic,Epilog->{Red,Line[{pt0,pt1,pt2}],Point[{pt0,pt1,pt2}]},PlotStyle->Red];
Show[{p1,plog}]
]
Manipulate[MakeScene[t,regpolygon[n]],{{n,5},3,10,1},{t,0,2Pi}]