{"id":13561942,"url":"https://github.com/yujota/elm-collision-detection","last_synced_at":"2026-02-28T22:31:45.180Z","repository":{"id":54300019,"uuid":"259789515","full_name":"yujota/elm-collision-detection","owner":"yujota","description":"Collision detection library for elm.","archived":false,"fork":false,"pushed_at":"2021-02-25T17:47:33.000Z","size":5576,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-20T00:33:18.195Z","etag":null,"topics":["collision-detection","elm"],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yujota.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":"2020-04-29T01:02:44.000Z","updated_at":"2023-01-11T11:35:30.000Z","dependencies_parsed_at":"2022-08-13T11:20:49.569Z","dependency_job_id":null,"html_url":"https://github.com/yujota/elm-collision-detection","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yujota/elm-collision-detection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujota%2Felm-collision-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujota%2Felm-collision-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujota%2Felm-collision-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujota%2Felm-collision-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yujota","download_url":"https://codeload.github.com/yujota/elm-collision-detection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujota%2Felm-collision-detection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29953284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["collision-detection","elm"],"created_at":"2024-08-01T13:01:02.819Z","updated_at":"2026-02-28T22:31:45.145Z","avatar_url":"https://github.com/yujota.png","language":"Elm","funding_links":[],"categories":["Elm"],"sub_categories":[],"readme":"# elm-collision-detection\n\nThis Elm library provides Quadtree space partitioning data structure for efficient collision detection on a 2D system.\n\n[Live demo](https://yujota.github.io/elm-collision-detection/)\n\n![example-demo-image](https://github.com/yujota/elm-collision-detection/blob/master/images/example-demo.gif?raw=true)\n\n## Overview\n\nLet's suppose there are six objects and you want to detect collisions. \nOn a naive approach which is the method to check all possible combinations, it needs to inspect `6C2 = 15` patterns.  \nAs the number of objects increases, this process takes much longer(`nC2 ≒ n^2`). \nSo, it is necessary to reduce the number of checks.\n\nOne solution is that check objects only nearby.\nFor example, space partitioning.\n\nIn the figure below there is a purple circle. \nIn a naive approach, we have to check all the other 5 objects to find collisions with the purple one\nbut these triangles are far away from it. \n \n![overview](https://github.com/yujota/elm-collision-detection/blob/master/images/overview.png?raw=true)\n![overview-with-grid](https://github.com/yujota/elm-collision-detection/blob/master/images/overview-with-grid.png?raw=true)\n\nInstead, we divide 2D space into small regions and check objects in each region.\nThis is how space partitioning works and this library adopts Quadtree as a data structure to store objects. \nThe implementation of Quadtree is capsulated and you don't have to aware of it.\n\n(If you're an expert on this topic and find some problems in this code, please pull-request :D)\n\n\n## Performance\n\nThis module has not completely optimized yet, \nbut it seems that `detectCollisions` for QuadTree container is faster than one for the naive approach. \nThe benchmark code is available on [elm-collision-detection/benchmarks/Benchmarks/DetectCollisionsWithSmallRectangle.elm](https://github.com/yujota/elm-collision-detection/blob/master/benchmarks/Benchmarks/DetectCollisionsWithSmallRectangle.elm).\n\n![performance-result](https://github.com/yujota/elm-collision-detection/blob/master/images/performance-result.png?raw=true)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyujota%2Felm-collision-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyujota%2Felm-collision-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyujota%2Felm-collision-detection/lists"}