REM Created in CorelPhotoPaint Version 9.397 REM Created On December 7, 1999 by Alex Link REM Nested Polygons ' nested2cn.csc ' Click the ENTER key to see the next cluster drawn WITHOBJECT "CorelPhotoPaint.Automation.9" .SetDocumentInfo 1200, 1200 ' 4 x 4 inch at 300 dpi cx& = 600 cy& = 600 GLOBAL CONST pi AS DOUBLE = 3.1415926535 BEGIN DIALOG OBJECT Dialog1 0, 0, "" OKBUTTON 0, 0, 0, 0, .OK1 END DIALOG Dialog1.SetStyle 18 Msg$ = "Enter number of polygon sides:" uix$ = INPUTBOX(Msg$) n% = VAL(uix$) IF n% = 0 THEN n% = 5 Rv& = 100 ' radius size of largest polygon R& = Rv& ' radius size of current polygon Rx& = Rv&*COS(pi/n%) ' radius of orbit xa& = cx& ' current polygon center ya& = cy& ' current polygon center za = pi/2 ' radial angle to orbiting polygon center z = COS(pi/n%) ' radial reduction for nesting polygons ta = 2*pi/n% ' radial angle to next vertex/center .ImageInvert .EndColorEffect DIM Ax(n%) AS DOUBLE DIM Ay(n%) AS DOUBLE FOR W = 1 TO n% xa& = cx& + Rx&*COS(za) ya& = cy& - Rx&*SIN(za) t = pi - pi ' reset polygon rotation angle FOR I = 1 TO 2*n% ' sizing/rotation loop tp = 0 ' starting polygon vertex angle to match orbit angle FOR J = 1 TO n% Ax(J) = xa&*256 + 256*R&*COS(tp+za+t) Ay(J) = ya&*256 - 256*R&*SIN(tp+za+t) tp = J*ta NEXT J za = za+ta .PolygonTool 2, 0, 0, 3, TRUE, FALSE, TRUE .SetPaintColor 5, 0, 0, 255, 0 .FillSolid 5, 255, 0, 0, 0 .StartDraw Ax(1), Ay(1), 0, 0, 0, 0 For K = 2 TO n% .ContinueDraw Ax(K), Ay(K), 0, 0, 0, 0 Next K .EndDraw t = t + pi/n% R& = R&*z ' reduce pentagram to fit NEXT I Dialog Dialog1 za = za + ta ' calculate new angle to next polygon center R& = Rv& ' reset largest pentagram size NEXT W END WITHOBJECT