{"id":13815417,"url":"https://github.com/fogleman/Tiling","last_synced_at":"2025-05-15T09:31:45.345Z","repository":{"id":144926180,"uuid":"20817627","full_name":"fogleman/Tiling","owner":"fogleman","description":"Tilings of regular polygons.","archived":false,"fork":false,"pushed_at":"2014-06-24T13:31:26.000Z","size":339,"stargazers_count":483,"open_issues_count":2,"forks_count":32,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-07T07:15:56.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fogleman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-13T20:59:14.000Z","updated_at":"2025-03-10T07:00:25.000Z","dependencies_parsed_at":"2023-03-22T21:40:27.948Z","dependency_job_id":null,"html_url":"https://github.com/fogleman/Tiling","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FTiling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FTiling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FTiling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FTiling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fogleman","download_url":"https://codeload.github.com/fogleman/Tiling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254313749,"owners_count":22050092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T04:03:28.437Z","updated_at":"2025-05-15T09:31:44.965Z","avatar_url":"https://github.com/fogleman.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## Tiling\n\nQuickly construct tilings of regular polygons and their dual tilings using a\nsimple API.\n\nScroll down for a tutorial. Here are some examples.\n\n![Sample](http://i.imgur.com/gyoQnuG.gif)\n\n### Links\n\nhttp://en.wikipedia.org/wiki/Tiling_by_regular_polygons\n\nhttp://en.wikipedia.org/wiki/List_of_uniform_tilings\n\n### Motivation\n\n1. Write polygon tiling code.\n2. ???\n3. Profit!\n\n### Wallpaper\n\n* [16x9 Wallpaper](http://i.imgur.com/oerkmDS.png)\n* [16x10 Wallpaper](http://i.imgur.com/H28k39a.png)\n\n### How To\n\n[pycairo](http://cairographics.org/pycairo/) is used for rendering.\nInstallation on OS X is easy using Homebrew.\n\n    brew install py2cairo\n\nBefore creating a new pattern, set these flags to zoom in and label the\npolygons and their edges.\n\n    SCALE = 128\n    SHOW_LABELS = True\n\nThe first step is to create a Model that will hold our polygons.\n\n    model = Model()\n\nNext, we will place our first polygon at the origin. We need only specify its\nnumber of sides. Let's add a hexagon.\n\n    model.append(Shape(6))\n\nAt this point we can run the following code to render the model.\n\n    surface = model.render()\n    surface.write_to_png('output.png')\n\n![Image](http://i.imgur.com/OjV0HTb.png)\n\nNow, let's add squares adjacent to all of the hexagon's edges.\n\n    a = model.add(0, range(6), 4)\n\nThe first parameter, `0`, specifies which shape(s) we're attaching to. Here,\nwe're only attaching to one shape (the hexagon) and it was the first one\ncreated, so it's referred to by zero.\n\nThe second parameter, `range(6)`, specifies the edges we're attaching to. In this\ncase we want to attach to all six sides of the hexagon. You can see the edges\nlabeled in the output image.\n\nThe third parameter, `4`, specifies the number of sides for the new shapes. In\nthis case, squares.\n\nThe return value of `add` tracks the indexes of the newly created squares\nso we can refer to them later.\n\n![Image](http://i.imgur.com/D0zqHkA.png)\n\nNext comes the cool part. We can attach triangles to all of the squares we just\ncreated in one fell swoop by using the previous return value. Here, we are\nadding triangles to edge number 1 of each of those squares.\n\n    b = model.add(a, 1, 3)\n\n![Image](http://i.imgur.com/lfyfaC0.png)\n\nNow we'll add more hexagons which will represent the repeating positions of\nour template.\n\n    c = model.add(a, 2, 6)\n\n![Image](http://i.imgur.com/2HgeMRd.png)\n\nNow that we have positions for repeating the pattern, we can use the\nrepeat function to automatically fill in the rest of the surface\nwith our pattern.\n\n    model.repeat(c)\n\n![Image](http://i.imgur.com/JC2MSwH.png)\n\nHere's all the code needed for this pattern:\n\n    from tile import Model, Shape\n    \n    BLUE = 0x477984\n    ORANGE = 0xEEAA4D\n    RED = 0xC03C44\n    \n    model = Model()\n    model.append(Shape(6, fill=RED))\n    a = model.add(0, range(6), 4, fill=ORANGE)\n    b = model.add(a, 1, 3, fill=BLUE)\n    c = model.add(a, 2, 6, fill=RED)\n    model.repeat(c)\n    surface = model.render()\n    surface.write_to_png('output.png')\n\nOnce finished, you can turn off the helper labels and adjust the scale as\ndesired.\n\n![Image](http://i.imgur.com/cOrQsXW.png)\n\nDual tilings can be created with `model.render(dual=True)`. This setting\nrenders polygons such that the vertices of the original tiling correspond to\nthe faces of the dual tiling and vice-versa.\n\nHere is the dual of the above pattern.\n\n![Image](http://i.imgur.com/BnIdKV2.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2FTiling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffogleman%2FTiling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2FTiling/lists"}