The Library of Babel is a story about a universe whose contents are every possible 410-page book that could possibly exist. After a conversation with someone about doing this with images, and coming to the conclusion that even the smallest constraints produce infeasible results (e.g. a 2x2 pixel RGB image has 4,195,020,000 possibilities) I moved on to thinking about polygons instead.
The more I thought about it, the more complex the maths became to me. Let's assume we've got a grid of $x$ by $y$ points, so the total number of points on the grid is $p = xy$. Let's also assume that each polygon can be one of $c$ different colours. If we assume that the corners of each polygon must occupy three distinct points on that grid, how would we go about calculating the number of possible images? Note that two different polygons may use the same points, but one individual polygon must not use the same point twice.
My first thought is that for one polygon, it's a case of computing combinations, and then permutations based on colour. But when we add more polygons, I get confused.
How would I go about calculating this?