home *** CD-ROM | disk | FTP | other *** search
- SCREEN 9
-
- DIM Points%(13, 2)
-
- FOR NumPoints% = 3 TO 13 STEP 2
-
- ' Calculate length of side and angle for polygon
-
- CLS
- Angle% = 180 - INT((NumPoints% - 2) * 180 / NumPoints%)
- Side% = 1450 / NumPoints%
-
- ' Draw the polygon (invisibly)
-
- DRAW "BM" + STR$(320 - INT(Side% / 2)) + ",340"
-
- FOR iter% = 1 TO NumPoints%
-
- Points%(iter%, 1) = POINT(0)
- Points%(iter%, 2) = POINT(1)
-
- DRAW "TA" + STR$(Angle% * (iter% - 1)) + "BR" + STR$(Side%)
-
- NEXT
-
- ' Take a point at random
-
- x% = INT(RND * 640)
- y% = INT(RND * 350)
-
- ' Fill in polygon with repeated algorithm
-
- FOR iter% = 1 TO 30000
- Dir% = INT(RND * NumPoints%) + 1
- xx% = Points%(Dir%, 1)
- yy% = Points%(Dir%, 2)
- x% = (xx% + x%) / 2
- y% = (yy% + y%) / 2
- PSET (x%, y%), 14
- NEXT
-
-
- ' Wait and repeat with another polygon
-
-
- x$ = ""
- WHILE LEN(x$) = 0
- x$ = INKEY$
- WEND
-
- NEXT
-
-
-