\startMPpage


linejoin := mitered ;


path triangle ; % triangles
triangle = ( % we're on an 2 step grid
       (0,0) --
       (1/2,1/4) --
       (1/4,1/2) --
       (0,0)
		-- cycle
   )
	scaled 2;

% a four-triangle group
picture trisquare;
	trisquare :=
		image (
			fill triangle ;
			fill triangle rotatedaround ((1,1),90);
			fill triangle rotatedaround ((1,1),180) ;
			fill triangle rotatedaround ((1,1),270) ;
			);
%draw trisquare;


% tiling four squares into a mosaic andadding the frame around it
picture trimosaic;
	trimosaic :=
		image (
			draw trisquare;
			draw trisquare shifted (2,2);
			draw trisquare shifted (2,0);
			draw trisquare shifted (0,2);
 			draw boundingbox currentpicture
 				enlarged 1/24
				withpen pencircle scaled (1/12) ;			
			);


draw trimosaic ;


% draw trimosaic shifted (1+1/6,0) ;
 



% frame

currentpicture := currentpicture xsized 5cm ;



\stopMPpage