Cool Fern

Do you have something to share with us? A tip for newbies, perhaps? Post it here.
Post Reply
peter
Active Member
Posts: 123
Joined: Mon Oct 22, 2007 2:31 pm

Cool Fern

Post by peter » Wed Jul 30, 2014 2:24 pm

Hi,
do you like fern ?

Code: Select all

SCREEN 640,500
DrawScreen 

Global a#, b#, c#, d#, e#, f#, newx#, newy# 
Dim xy#(3)

Function Fern()
r = Rand(1,100)
If r <= 10 
   a = 0
   b = 0
   c = 0
   d = 0.16
   e = 0
   f = 0
ElseIf r > 1 And r <=86 
   a = 0.85
   b = 0.04
   c = -.04
   d = 0.85
   e = 0
   f = 1.60
ElseIf r > 86 And r <=93 
   a = 0.2
   b = -.26
   c = 0.23
   d = 0.22
   e = 0
   f = 0.16
Else
   a = -.15
   b = 0.28
   c = 0.26
   d = 0.24
   e = 0
   f = 0.44
EndIf

newx = ((a * xy(1)) + (b * xy(2)) + e)
newy = ((c * xy(1)) + (d * xy(2)) + f)
xy(1) = newx
xy(2) = newy 
Color 0,210,55
Dot xy(1)*40+275, -xy(2)*40+450
End Function

For w=1 To 150000 
    Fern()
Next w

Color 255,255,255
Text 0,0,Str(w-1) + " Fern Points"
DrawScreen 
WaitKey

User avatar
CCE
Artist
Artist
Posts: 650
Joined: Mon Aug 27, 2007 9:53 pm

Re: Cool Fern

Post by CCE » Wed Aug 06, 2014 7:28 pm

Wow that's a great L-system you've got there! If it was realtime you could make some pretty nifty animations with it.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests