{"id":51063599,"url":"https://github.com/deblasis/ziocollide","last_synced_at":"2026-06-23T04:30:32.000Z","repository":{"id":355016084,"uuid":"1226236974","full_name":"deblasis/ziocollide","owner":"deblasis","description":"2D collision detection for Zig: AABB, circle, ray, SAT. Zero allocation. 40 tests.","archived":false,"fork":false,"pushed_at":"2026-05-01T12:27:39.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T13:27:53.272Z","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:13:38.000Z","updated_at":"2026-05-01T12:27:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/deblasis/ziocollide","commit_stats":null,"previous_names":["deblasis/ziocollide"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deblasis/ziocollide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziocollide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziocollide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziocollide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziocollide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deblasis","download_url":"https://codeload.github.com/deblasis/ziocollide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziocollide/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:29.324Z","updated_at":"2026-06-23T04:30:31.994Z","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":"# ziocollide\n\n\u003e 2D collision detection for Zig: AABB, circle, ray, point-in-polygon, SAT. Zero allocation.\n\nPart of the [zio-zig](https://github.com/deblasis/zio-zig) ecosystem.\n\n## Quick start\n\n```zig\nconst collide = @import(\"ziocollide\");\n\n// AABB vs AABB\nconst a = collide.AABB{ .x = 0, .y = 0, .w = 10, .h = 10 };\nconst b = collide.AABB{ .x = 5, .y = 5, .w = 10, .h = 10 };\nif (a.overlaps(b)) {\n    // resolve collision...\n}\n\n// AABB vs Circle\nconst circ = collide.Circle{ .x = 5, .y = 5, .r = 3 };\nif (collide.aabbVsCircle(a, circ)) { /* hit */ }\n\n// Point in polygon\nconst xs = [_]f32{ 0, 10, 5 };\nconst ys = [_]f32{ 0, 0, 10 };\nif (collide.pointInPolygon(5, 3, \u0026xs, \u0026ys)) { /* inside */ }\n\n// Ray casting\nconst ray = collide.Ray{ .ox = 0, .oy = 0, .dx = 1, .dy = 0 };\nif (ray.vsCircle(circ)) |hit| {\n    std.debug.print(\"hit at t={d}\\n\", .{hit.t});\n}\n\n// SAT overlap for convex polygons\nconst depth = collide.satOverlap(\u0026poly1_x, \u0026poly1_y, \u0026poly2_x, \u0026poly2_y);\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\nAABB overlaps: true\nAABB containsPoint(7,7): true\nAABB vs Circle: true\nCircle containsPoint(3,4): true\npointInPolygon(5,3): true\nRay hit AABB at t=0.00\nSAT overlap depth: 5.00\n```\n\n## API\n\n### Types\n\n| Type | Fields | Description |\n|------|--------|-------------|\n| `AABB` | `x, y, w, h` | Axis-aligned bounding box |\n| `Circle` | `x, y, r` | Circle |\n| `Ray` | `ox, oy, dx, dy` | Ray with origin and direction |\n| `RayHit` | `t, nx, ny` | Ray hit result (distance + normal) |\n\n### AABB methods\n- `overlaps(b)` — overlap test\n- `containsPoint(px, py)` — point containment\n- `minX/Y()`, `maxX/Y()` — boundary accessors\n\n### Circle methods\n- `overlaps(b)` — circle-circle overlap\n- `containsPoint(px, py)` — point in circle\n\n### Ray methods\n- `vsCircle(c)` — ray-circle intersection, returns `?RayHit`\n- `vsAABB(box)` — ray-AABB intersection, returns `?RayHit`\n\n### Free functions\n- `aabbVsCircle(box, circ)` — AABB-circle overlap\n- `pointInPolygon(px, py, poly_x, poly_y)` — point-in-polygon test\n- `satOverlap(ax, ay, bx, by)` — separating axis theorem overlap depth\n\n## License\n\nMIT. Copyright (c) 2026 Alessandro De Blasis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziocollide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeblasis%2Fziocollide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziocollide/lists"}