f[{x_,y_}]:= If[ x<y, Sin[x y - Cos[(y^2)]], Cos[y]]
Fred=DensityPlot[ 
f[{x,y}],
{x,0,3},
{y,0,3},
Mesh->All,
PlotPoints->5,
(*RegionFunction:>Function[{x,y,z}, (x^2)+(y^2)<9],*)
MaxRecursion->3]
Points=Fred[[1,1]];
Barney=Cases[Fred,Polygon[Triangle_]:>Triangle,∞];
Elements=Flatten[ Select[Barney, Dimensions[#][[2]]==3&],1];
Pretty=Show[
Graphics[{
EdgeForm[{Black}],
Table[
{p1,p2,p3}=Points[[Elements[[i]]]];
{Hue[RandomReal[]],Polygon[{p1,p2,p3}]},
{i, 1,Length[Elements],1}],
Table[{x,y}=Points[[i]];
Point[{x,y}],
{i, Length[Points]}]
}
],
Frame->False
]

SetDirectory["/home/campus03/struther/Desktop/Link to Courses/4620/ClassSampleMathematica"]
Export["StainedGlass.jpg", Pretty]