{"id":17998951,"url":"https://github.com/albin-johansson/abby","last_synced_at":"2025-03-26T06:31:28.010Z","repository":{"id":56285673,"uuid":"277143933","full_name":"albin-johansson/abby","owner":"albin-johansson","description":"A header-only implementation of an AABB tree, written in C++17.","archived":true,"fork":false,"pushed_at":"2021-01-09T19:01:33.000Z","size":372,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T04:42:09.200Z","etag":null,"topics":["aabb","aabb-trees","axis-aligned-bounding-box","collision-detection","cpp17","cpp17-library","game-development","header-only","hitbox","mit-license"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albin-johansson.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-07-04T16:12:38.000Z","updated_at":"2024-11-17T18:23:56.000Z","dependencies_parsed_at":"2022-08-15T16:00:49.722Z","dependency_job_id":null,"html_url":"https://github.com/albin-johansson/abby","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fabby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fabby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fabby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fabby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albin-johansson","download_url":"https://codeload.github.com/albin-johansson/abby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245603734,"owners_count":20642871,"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":["aabb","aabb-trees","axis-aligned-bounding-box","collision-detection","cpp17","cpp17-library","game-development","header-only","hitbox","mit-license"],"created_at":"2024-10-29T22:09:20.974Z","updated_at":"2025-03-26T06:31:27.434Z","avatar_url":"https://github.com/albin-johansson.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# abby [![Build status](https://ci.appveyor.com/api/projects/status/p0ej0hg4cmemaeau?svg=true)](https://ci.appveyor.com/project/AlbinJohansson/abby) [![Build Status](https://travis-ci.org/albin-johansson/abby.svg?branch=dev)](https://travis-ci.org/albin-johansson/abby) ![version](https://img.shields.io/badge/version-0.2.0-blue.svg) [![Language](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA header-only implementation of an AABB tree.\n\n## Purpose\n\nCollision detection is common in many applications, especially games. Subsequently, collision\ndetection often require checking for potential collision between many different game objects, and\nas such it is important that the collision detection is efficient. A naive implementation will end\nup with quadratic complexity, which isn't very scalable. By using an AABB tree, bounding hitboxes\nare stored in a tree according to their position and size, which in turn enables logarithmic\ncomplexity for collision detection.\n\n## Example\n\n```C++\n\n  #include \u003cabby.hpp\u003e\n  #include \u003citerator\u003e // back_inserter\n  #include \u003cvector\u003e   // vector\n  #include \u003ciostream\u003e // clog\n\n  void foo()\n  {\n    // Constructs an AABB tree that uses integers as identifiers and AABBs with double precision\n    abby::tree\u003cint, double\u003e tree;\n\n    // Inserts a few AABBs, takes a lower and upper bound\n    tree.insert(1, {150.0, 165.0}, {50.0, 50.0});\n    tree.insert(2, {88.0, 63.0}, {150.0, 343.0});\n    tree.insert(3, {412.0, 132.0}, {566.0, 291.0});\n\n    // Could also use a stack buffer\n    std::vector\u003cint\u003e candidates;  \n\n    // Find collision candidates\n    tree.query(1, std::back_inserter(candidates));  \n    for (const auto candidate : candidates) {\n      // Obtains an AABB\n      const auto\u0026 aabb = tree.get_aabb(candidate);\n    }\n  \n    // Prints the tree using a stream\n    tree.print(std::clog);\n\n    // Updates an existing AABB\n    tree.update(2, {33.0, 76.0}, {123.0, 155.0});\n\n    // Sets the position of an AABB\n    tree.relocate(2, {12.0, 34.0});\n\n    // Removes an AABB from the tree\n    tree.erase(2);\n\n    // Rebuild as optimal tree\n    tree.rebuild();\n\n    // Clear the tree of all entries\n    tree.clear();\n  }\n```\n\n## Acknowledgements\n\nThis library is an adapted and improved version of the [AABBCC](https://github.com/lohedges/aabbcc)\nlibrary. Furthermore, the AABB tree in the [Simple Voxel Engine](https://github.com/JamesRandall/SimpleVoxelEngine)\nproject also influenced the design of this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbin-johansson%2Fabby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbin-johansson%2Fabby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbin-johansson%2Fabby/lists"}