% A strange looking tree. beginfig(1); color woodc, leafc, branchc, skyc; woodc=(0.75, 0.1, 0.1); leafc=(0.1, 0.75, 0.1); branchc=black; skyc=(0.82, 0.97, 1); numeric wd, ht, marg; % Width, height and margin. wd=210mm; ht=297mm; marg=9.5mm; numeric nb; nb=10; % Number of brancheds. numeric bthk; bthk=(y6-y4)/46; % Thickness of branches. z0=(marg, marg); % bottom left corner. z1=(wd-marg, ht-marg); % top right corner. z2=(x0,y1); % top left corner. z3=(x1,y0); % bottom right corner. % The leaf triangle. z4=(1/2[x5,x6], 0.33[y1,y0]); % bottom corner. z5=0.08[z2,z1]; % left corner. z6=(0.7[x2,x1],y1); % right corner. fill z0--z2--z1--z3--cycle withcolor skyc; z7=1/3[z4,z5]; fill z0--z7--z4{z4-z6}..{right}z3--cycle withcolor woodc; fill z4--z5--z6--cycle withcolor leafc; % Draw the branchs. numeric bspc; bspc=(y6-y4-bthk)/(nb-1); for i=0 upto nb-1: numeric byt, byb; % Top and bottom. byt=y6-bspc*i; byb=byt-bthk; numeric bpr; bpr=i/(nb-1); numeric bxr; % right end, point. bxr=bpr[x1,(xpart (((x2,byt)--(x1,byt)) intersectionpoint (z4--z6)))*1.1]; pair bztl, bzbl; % Left top and bottom corners. bztl=((x2,byt)--(x1,byt)) intersectionpoint (z4--z5); bzbl=((x2,byb)--(x1,byb)) intersectionpoint (z4--z5); fill bztl--(x4,byt){right}..(bxr,byt)--(bxr,byt)..{left}(x4,byb)--bzbl--cycle withcolor branchc; endfor endfig; end