Welcome,
Share Files

POLYGONS - Circle construction

Here's a new version of polygon.
I say hello to Francisco ;-)

Please, switch off Auto Window and change \pi with the symbol pi at lines 8 and 31.
----------------------------------------------
CheckBox(Circle,1)
CheckBox(Points,1)
CheckBox(Lines,1)
Scroll(l,2,100)
s=List(l)
c=List(l)
Line=list(l)
i=2*\pi/l
Line(1)=[1+(cos(i)-1)*u,sin(i)*u]
n=0
loop(j,1,l)
s(j)=sin(n)
c(j)=cos(n)
if(j>1&Lines)
Line(j-1)=[c(j-1)+(c(j)-c(j-1))*u,s(j-1)+(s(j)-s(j-1))*u]
Line(j)=[c(j)+(1-c(j))*u,s(j)-s(j)*u]
end
n=n+i
end
if(Points)
PointsP=ListPlot(c,s,color=blue,points=12)
else
clear("PointsP")
end
if(Lines)
LineP=ParametricPlot(Line,u=[0,1],color=red,lines=3)
else
clear("LineP")
end
if(Circle)
CircleP=ParametricPlot(cos(u),sin(u),u=[0,2*\pi,500],color=deepSkyBlue)
else
clear("CircleP")
end
MultiPlot(CircleP,LineP,PointsP,x=[-1.3,1.3],y=[-1.1,1.1],gridLines=0,backgroundColor=beige)
----------------------------------------------

Best Regards, Frederic