#!/usr/local/bin/yabasic rem This program was coded by Hermang Mansilla rem and released under GPL license :-) rem This Program draws rotating polygons dim x(6),y(6), X(6),Y(6) R=90 rem origin coordinats OX=R+6:OY=R+6 rem size of Window SX=3*R:SY=3*R open window SX,SY kk=0.15 label inicio input "Number of sides (26 or N<3 then end fi clear window k=N-2 rem pone cordenad en x(), y() for i=0 to k+1 x(i)=R*sin(2*pi*i/(k+2)) y(i)=R*cos(2*pi*i/(k+2)) gosub transfcor rem The following print lines are for diagnostic, you can comment them print print "cordenadas (x,y)=",x(i),y(i),"-->(",X(i),",",Y(i),")" next i gosub dibuja goto inicio end label transfcor X(i)=x(i)+OX Y(i)=OY-y(i) if Y(i)<0 then Y(i)=-Y(i) endif return label dibuja for i=1 to 10+5*k X(k+2)=X(0):Y(k+2)=Y(0) for j=0 to k+1 X1=X(j):Y1=Y(j) X2=X(j+1):Y2=Y(j+1) line X1,Y1 to X2,Y2 X(j)=X(j)+kk*( X(j+1)-X(j) ) Y(j)=Y(j)+kk*( Y(j+1)-Y(j) ) next j next i return