BBC BASIC for Windows
« Christmas Fractal »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:19pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Christmas Fractal  (Read 411 times)
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Christmas Fractal
« Thread started on: Dec 25th, 2015, 11:43am »

Greetings All, and Merry Christmas!

I'm sure this isn't novel, but I've never seen it before. It's based on Koch's snowflake, where you convert each line segment into a smaller copy of the whole curve, but in this case each point of the polygon gets expanded.

It makes some quite nice "Christmas wreaths" - or if you choose different parameters you can make things like Sierpinski gaskets, etc. Have fun!

D

Code:
      REM A Christmas Fractal Drawing by David Marples
      REM Merry Christmas to you all!
      MODE 21
      REM Parameters: centre point (x and y),
      REM number of points of polygon,
      REM starting angle (to rotate whole pattern)
      REM Starting side length
      REM Ratio between sides of consecutive generations
      REM Starting colour
      PROCDraw(800,600,8,0,350,0.40,1)
      END
      :
      DEFPROCDraw(px%,py%,np%,sa,r,dr,c%)
      LOCAL p%(),x%
      DIM p%(np%,1)
      IF c%>15 THEN c%=1
      GCOL c%
      FOR x%=0 TO np%
        p%(x%,0)=px%+r*COSRAD(sa+x%*360/np%)
        p%(x%,1)=py%+r*SINRAD(sa+x%*360/np%)
        CIRCLE FILL p%(x%,0),p%(x%,1),r*dr
      NEXT x%
      FOR x%=0 TO np%-1
        LINE  p%(x%,0),p%(x%,1),p%(x%+1,0),p%(x%+1,1)
      NEXT x%
      IF r>16 THEN
        FOR x%=0 TO np%-1
          PROCDraw(p%(x%,0),p%(x%,1),np%,sa,r*dr,dr,c%+1)
        NEXT x%
      ENDIF
      ENDPROC
 

User IP Logged

KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Re: Christmas Fractal
« Reply #1 on: Oct 25th, 2016, 12:55pm »

Clever - and attractive.
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: Christmas Fractal
« Reply #2 on: Oct 25th, 2016, 3:58pm »

Wow, that was a blast from the past!
grin
D
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls