Brainteaser: Tile a mesh with a set of distinct shapes

I’ve been noodling on this one for a few weeks, thought others might find it interesting, or maybe it’s been explored before.

I recall Gehry used K-clustering for Museo Soumaya to find a happy number of distinct hexagons to tile their shape without too much deviation. Could the same be done in Grasshopper?

Finding a set of face edge lengths which approximate an existing mesh edge lengths seems easy. In the image below and attached graph, each color represents rectangles which are ‘close enough’ in shape to eachother. The problem is adjacent shapes might have mis-matching edge lengths. Finding a set of shapes with matching edge lengths is much harder. And that’s not getting into rotational symmetry of faces where two faces might be the same but with different edge order. It feels a lot like the Wang tile problem.

I’ll spoil this a little by saying I don’t think they matched edge lengths. Instead, I think the gaps between panels allow for mismatching shapes to join. Thoughts?

K-Cluster Panel (25.3 KB)

Unique families in Museo Soumaya [Source: pg 68]

Well … I can’t open your file since I don’t work with add-ons (other than K2) … but a few things:

  1. There’s lot’s of stuff around related with the Wang puzzle. Like:

GitHub - Relfos/WangTiles: Wang Tiles algorithm applied to map generation.

  1. Hard to see why one needs K-Means hard flat Clustering (or in fact a “variation”) since a proper approach on 1 could cut the mustard. But if you insist … a Type that yields connectivity (like a Mesh for instance) can provide the Face data required. That said Frank … well … he’s not exactly a coding guru nor can steer the boat on that matter. But a few of his things are good, others are a total disaster [and rather kitsch - that includes that Museum] … for instance can you imagine I.M.Pei doing this atrocity?

  1. I could propose some sort of strategy … but that requires coding experience from your part (mid to pro level). If you are flirting with C# let me know.
1 Like

Thanks Peter, I am okay w C# but was hoping to approach this with a GH solution for now. I know thats not your style and have seen many of your clever C# scripts over the years.

your missing component is likely the kMeans clustering component. I appreciate the github link. If i go that way and get stuck I might reach out for help.

K means made sense because it gives me a distinct set of tiles which closely approximate the original rectangles. Even if I went w wang tiles i think I would still K cluster to provide a number of discrete edge lengths to solve for.

I have various // KM C#'s (done by yours truly) but are strictly internal (same for HAC Clustering etc etc).

Other than that … an orthodox KM means that you should mastermind an “override” of some sort:

Given the Mesh Faces write a C# that yields Face centers to Faces centers distances (using some Recursion on Face/Face connectivity: ie the paths nodes are the from/to Face centers nodes (exactly as we do in Graphs for Dikjstra routing and the likes).

In plain English: do a Graph using as nodes the Mesh Face centers and apply KM accordinly (hope dies last).

That way the paths - and thus the distances - are “draped” on the Mesh most notably for Topology cases like in this hideous Museum skin (what an ugly thing, mind).

Does it?

Anyway … if I was you > I would forget high science (it’s just kitsch module colors, you know) > thus > see attached (15 minutes work done some time ago for different purposes).

Read the code and get the gist of what it does (a Recursive collection grow based on rnd seed Face indices).

Obviouly you can modify the thing with various ways. In order to do a pro level solution you’ll need interactive pick of seed indices (swap volatile/persistent data stored in a named parameter: impossible without mid level coding). (189.2 KB)