!IFS for Spleewort Fern
!x' = a*x + b* y+ e
!y' = c*x + d*y + f
!
!Four affine transformations:
!1) Scaling of 0.16 in y direction only (stem)
!2) Scaling of 0.85 in x and y + Translation of 1.6 in y + Rotation of -2.5 deg.
!3) Scaling of .3 in x & and .34 in y + Translation of 1.6 in y + Rotation of 49 deg.
!4) Scaling of .3 in x & and .37 in y + Translation of .44 in y + Rotation of -50 deg. + Reflexion about y.
!This affine map must be a CONTRACTION so the following conditions must verify:
!a^2 + c^2 >1
!c^2 + d^2 >1
!a^2 + c^2 + b^2 + d^2 > (a*d-b*c)^2
LET a1=0
LET b1=0
LET c1=0
LET d1=.16
LET e1=0
LET f1=0
LET p1=.03
LET a2=.85
LET b2=.04
LET c2=-.04
LET d2=.85
LET e2=0
LET f2=1.6
LET p2=.73
LET a3=.2
LET b3=-.26
LET c3=-.23
LET d3=.22
LET e3=0
LET f3=1.6
LET p3=.13
LET a4=-.15
LET b4=.28
LET c4=.26
LET d4=.24
LET e4=0
LET f4=.44
LET p4=.11
SET MODE "graphics"
SET WINDOW -6*1.33,6*1.33,-1,11
LET x = 1
LET y = 1
FOR i = 1 to 10000
LET q = rnd
IF q<p1 THEN
LET x=a1*x+b1*y+e1
LET y=c1*x+d1*y+f1
SET COLOR "BLACK"
PLOT x,y
ELSE IF q>p1 and q<(p1+p2) THEN
LET x=a2*x+b2*y+e2
LET y=c2*x+d2*y+f2
SET COLOR "GREEN"
PLOT x,y
ELSE IF q>(p1+p2) and q<(p1+p2+p3) THEN
LET x=a3*x+b3*y+e3
LET y=c3*x+d3*y+f3
SET COLOR "RED"
PLOT x,y
ELSE IF q>(p1+p2+p3) THEN
LET x=a4*x+b4*y+e4
LET y=c4*x+d4*y+f4
SET COLOR "BLUE"
PLOT x,y
END IF
NEXT i
END