{"id":51063580,"url":"https://github.com/deblasis/zioquadtree","last_synced_at":"2026-06-23T04:30:28.838Z","repository":{"id":355020413,"uuid":"1226237213","full_name":"deblasis/zioquadtree","owner":"deblasis","description":"Quadtree for 2D spatial partitioning in Zig. Broad-phase collision. 40 tests.","archived":false,"fork":false,"pushed_at":"2026-05-01T12:28:00.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T14:14:07.274Z","etag":null,"topics":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deblasis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"deblasis","ko_fi":"deblasis","custom":["https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"]}},"created_at":"2026-05-01T06:14:06.000Z","updated_at":"2026-05-01T12:28:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/deblasis/zioquadtree","commit_stats":null,"previous_names":["deblasis/zioquadtree"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deblasis/zioquadtree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fzioquadtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fzioquadtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fzioquadtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fzioquadtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deblasis","download_url":"https://codeload.github.com/deblasis/zioquadtree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fzioquadtree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34675970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"created_at":"2026-06-23T04:30:26.624Z","updated_at":"2026-06-23T04:30:28.826Z","avatar_url":"https://github.com/deblasis.png","language":"Zig","funding_links":["https://github.com/sponsors/deblasis","https://ko-fi.com/deblasis","https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"],"categories":[],"sub_categories":[],"readme":"# zioquadtree\n\n\u003e Quadtree for 2D spatial partitioning in Zig. Broad-phase collision, spatial queries.\n\nPart of the [zio-zig](https://github.com/deblasis/zio-zig) ecosystem.\n\n## Quick start\n\n```zig\nconst qtree = @import(\"zioquadtree\");\n\n// Create a quadtree covering the game world\nconst bounds = qtree.Bounds{ .x = 0, .y = 0, .w = 1000, .h = 1000 };\nvar tree = try qtree.QuadNode.init(allocator, bounds, 8, 0);\n//                                       alloc  bounds  capacity  depth\ndefer tree.deinit();\n\n// Insert items (enemies, bullets, etc.)\ntry tree.insert(.{ .x = 100, .y = 200, .w = 32, .h = 32 }, enemy_id_1);\ntry tree.insert(.{ .x = 500, .y = 300, .w = 16, .h = 16 }, bullet_id_1);\ntry tree.insert(.{ .x = 105, .y = 195, .w = 32, .h = 32 }, enemy_id_2);\n\n// Query for nearby items\nvar result: [64]qtree.Item = undefined;\nvar count: usize = 0;\ntree.query(.{ .x = 90, .y = 190, .w = 60, .h = 60 }, \u0026result, \u0026count);\n// count = 2 (both enemies, but not the bullet)\n\n// Clear and reuse\ntree.clear();\n```\n\n```bash\nzig build test          # Run 40 tests\nzig build run-example   # Run example\n```\n\n## Example output\n\n```\n$ zig build run-example\nTotal items: 3\nQuery near (100,200): 2 items\n  item data=1 at (100,200)\n  item data=3 at (105,195)\nAfter clear: 0 items\n```\n\n## API\n\n### Types\n\n| Type | Fields | Description |\n|------|--------|-------------|\n| `Bounds` | `x, y, w, h` | Axis-aligned rectangle |\n| `Item` | `bounds: Bounds`, `id: usize` | Insertable item |\n\n### Bounds methods\n- `contains(px, py)` — point containment\n- `intersects(b)` — overlap test\n\n### QuadNode\n\n| Method | Description |\n|--------|-------------|\n| `init(allocator, bounds, capacity, depth)` | Create node |\n| `deinit()` | Free memory |\n| `insert(item_bounds, id)` | Insert item (may subdivide) |\n| `query(region, results, count)` | Find items overlapping region |\n| `count()` | Total items in tree |\n| `clear()` | Remove all items (keep structure) |\n\n## License\n\nMIT. Copyright (c) 2026 Alessandro De Blasis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fzioquadtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeblasis%2Fzioquadtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fzioquadtree/lists"}