!a=r*cos(theta), b= -s*sin(theta), c= r*sin(theta), d= s*cos(theta)

!e anf f are just translations in x and y respectively.

!PICTURE (NON RANDOM METHOD) DEFINITION USES 6 RULES OF THE FORM:

!DRAW OAK0 WITH SCALE(r,s)*ROTATE(theta)*SHIFT(e,f)

!RULE 1) DRAW OAK0 WITH SCALE(.7,.5)*SHIFT(0,1)

!RULE 2) DRAW OAK0 WITH SCALE(.8,.6)*SHIFT(0,.1)

!RULE 3) DRAW OAK0 WITH SCALE(.9,.6)*SHIFT(0,.45)

!RULE 4) DRAW OAK0 WITH SCALE(.25,.25)*ROTATE(35*pi/180)*SHIFT(-0.25,.85)

!RULE 5) DRAW OAK0 WITH SCALE(.25,.25)*ROTATE(-35*pi/180)*SHIFT(0.25,.85)

!RULE 6) DRAW OAK0 WITH SCALE(.015,-.25)*SHIFT(-.008,.20)

 

SET MODE "GRAPHICS"

SET WINDOW -1*1.33,1*1.33,0,2

READ a1,b1,c1,d1,e1,f1

READ a2,b2,c2,d2,e2,f2

READ a3,b3,c3,d3,e3,f3

READ a4,b4,c4,d4,e4,f4

READ a5,b5,c5,d5,e5,f5

READ a6,b6,c6,d6,e6,f6

!HERE INPUT YOUR OWN DATA:

DATA .7,0,0,0.5,0,1

DATA .8,0,0,.6,0,.1

DATA .9,0,0,.6,0,.45

DATA .2048,-.1434,.1434,.2048,-.25,.85

DATA .2048,.1434,-.1434,.2048,.25,.85

DATA .015,0,0,-.25,-.008,.2

 

LET det1=ABS(a1*d1-b1*c1)

LET det2=ABS(a2*d2-b2*c2)

LET det3=ABS(a3*d3-b3*c3)

LET det4=ABS(a4*d4-b4*c4)

LET det5=ABS(a5*d5-b5*c5)

LET det6=ABS(a6*d6-b6*c6)

LET dettotal=det1+det2+det3+det4+det5+det6

LET p1= det1/dettotal

LET p2= det2/dettotal

LET p3= det3/dettotal

LET p4= det4/dettotal

LET p5= det5/dettotal

LET p6= det6/dettotal

PRINT "p1=";p1

PRINT "p2=";p2

PRINT "p3=";p3

PRINT "p4=";p4

PRINT "p5=";p5

PRINT "p6=";p6

PLOT 0,0;0.01,.25;.5,.5;.25,.5;.6,1.2;.25,1.1;.4,1.7;.2,1.6;0,2;-.2,1.6;-.4,1.7;-.25,1.1;-.6,1.2;-.25,.5;-.5,.5;-.01,.25;0,0

FOR i = 1 to 100000

LET q = rnd

IF q<p1 THEN

LET x = a1*x + b1*y + e1

LET y = c1*x + d1*y + f1

SET COLOR "RED"

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 (p1+p2)<q AND q<(p1+p2+p3) THEN

LET x = a3*x + b3*y + e3

LET y = c3*x + d3*y + f3

SET COLOR "BLUE"

PLOT x,y

ELSE IF (p1+p2+p3)<q AND q<(p1+p2+p3+p4) THEN

LET x = a4*x + b4*y + e4

LET y = c4*x + d4*y + f4

SET COLOR "BLACK"

PLOT x,y

ELSE IF (p1+p2+p3+p4)<q AND q<(p1+p2+p3+p4+p5) THEN

LET x = a5*x + b5*y + e5

LET y = c5*x + d5*y + f5

SET COLOR "BLACK"

PLOT x,y

ELSE IF (p1+p2+p3+p4+p5)<q AND q<(p1+p2+p3+p4+p5+p6) THEN

LET x = a6*x + b6*y + e6

LET y = c6*x + d6*y + f6

SET COLOR "YELLOW"

PLOT x,y

END IF

NEXT i

END