REM Created in CorelPhotoPaint Version 9.397 REM Created On December 7, 1999 by linkaxdx REM nested2.csc REM 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 the number of polygon sides" uix$ = INPUTBOX(Msg$) n% = VAL(uix$) IF n = 0 THEN n = 5 Rv& = 250 ' 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 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 n% ' sizing/rotation loop tp = 0 ' starting polygon vertex angle to match orbit angle t = t + pi/n% ' rotate pentagram 1/2 angle FOR J = 1 TO n% Ax(J) = xa&*256 + 256*R&*COS(tp+za) Ay(J) = ya&*256 - 256*R&*SIN(tp+za) tp = J*ta NEXT J za = za+ta .PolygonTool 1, 0, 0, 4, TRUE, FALSE, FALSE .SetPaintColor 5, 0, 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 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