{"id":16317696,"url":"https://github.com/zfletch/flatland-js","last_synced_at":"2025-05-13T16:33:00.779Z","repository":{"id":10007596,"uuid":"12043402","full_name":"zfletch/flatland-js","owner":"zfletch","description":"Flatland Simulator in JavaScript for HTML5 Canvas","archived":false,"fork":false,"pushed_at":"2015-10-10T23:06:35.000Z","size":292,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T20:20:58.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zfletch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-11T22:09:15.000Z","updated_at":"2023-08-06T16:07:59.000Z","dependencies_parsed_at":"2022-08-31T01:24:31.761Z","dependency_job_id":null,"html_url":"https://github.com/zfletch/flatland-js","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/zfletch%2Fflatland-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fflatland-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fflatland-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fflatland-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfletch","download_url":"https://codeload.github.com/zfletch/flatland-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981903,"owners_count":21994352,"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-10-10T22:09:03.038Z","updated_at":"2025-05-13T16:33:00.748Z","avatar_url":"https://github.com/zfletch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flatland Simulator\n==================\n\nFlatland Simulator in JavaScript and HTML5.\n\nFlatland\n-----------------\n\n*Flatland: A Romance of Many Dimensions*, written by Edwin A. Abbott and published\nin 1884 is a novel about a square who lives in an entirely two-dimensional world.\nThe book explains how he, and all two-dimensional creatures, see their two-dimensional\nworld in one dimension, similar to how we three-dimensional creatures see our world\nas a series of two-dimensional images.\n\nFlatland Simulator\n------------------\n\nI was curious about what it would be like to see the world like a Flatlander does\nand threw together this program with JavaScript and HTML5's canvas tag.\nYou control a little square in a world of randomly generating polygons and\nyou can move around and rotate. As you do so, you see your actions in two\ndifferent canvas tags, one showing a top-down view of the two-dimensional\nworld (a large square canvas on the bottom half of the page) and one showing what the\nworld would look like from the perspective of the square (a smaller rectangular canvas\nimmediately above the square canvas).\n\nPictures!\n---------\n![screenshot 1](https://raw.github.com/zfletch/flatland-js/master/images/20130811-screenshot1.png)\n![screenshot 2](https://raw.github.com/zfletch/flatland-js/master/images/20130811-screenshot2.png)\n\nHow to use\n----------\n\n - Download this git repo\n - Open a browser with HTML5 support (Chrome, for example) and open your/directory/flatland-js/Flatland.html\n - Try it [here](https://zfletch.github.io/flatland-js/)\n\nAlgorithm\n---------\n\nI'm calculating what the world would look like from a Flatlander's perspective\nby doing a simple two-dimensional version of ray casting. I create a bunch of\nof lines, or rays, coming out of the Flatlander, calculate what they\nintersect, and use the distance of the closest intersection to determine what\nthe Flatlander would see.\n\nNotes\n-----\n\nThis is a work in progress/a weekend project and there are a number of things I'm working on\nfixing. Tested on Chrome 28.0.1500.95 on OSX 10.8.4.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfletch%2Fflatland-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfletch%2Fflatland-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfletch%2Fflatland-js/lists"}