{"id":41530229,"url":"https://github.com/nenjack/check2d","last_synced_at":"2026-02-02T12:00:45.153Z","repository":{"id":41358877,"uuid":"123184521","full_name":"nenjack/check2d","owner":"nenjack","description":"Points, Lines, Boxes, Polygons (also hollow), Ellipses, Circles. RayCasting, offsets, rotation, scaling, bounding box padding, flags for static and ghost/trigger bodies","archived":false,"fork":false,"pushed_at":"2025-12-19T18:17:34.000Z","size":11869,"stargazers_count":249,"open_issues_count":0,"forks_count":27,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-23T01:59:53.507Z","etag":null,"topics":["alghorithm","collision-checking","collisions","computational-geometry","computational-geometry-algorithms","javascript","library","typescript"],"latest_commit_sha":null,"homepage":"https://nenjack.github.io/check2d/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nenjack.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-02-27T20:29:28.000Z","updated_at":"2025-12-19T18:17:37.000Z","dependencies_parsed_at":"2024-03-01T16:24:41.771Z","dependency_job_id":"c76fe05c-0908-479a-937a-0ffe1683b6af","html_url":"https://github.com/nenjack/check2d","commit_stats":{"total_commits":423,"total_committers":13,"mean_commits":32.53846153846154,"dds":0.508274231678487,"last_synced_commit":"1f3b58dc4fb3efba97317e8fca211eabe04551c2"},"previous_names":["jackie-aniki/detect-collisions","prozi/detect-collisions","nenjack/check2d"],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/nenjack/check2d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nenjack%2Fcheck2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nenjack%2Fcheck2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nenjack%2Fcheck2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nenjack%2Fcheck2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nenjack","download_url":"https://codeload.github.com/nenjack/check2d/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nenjack%2Fcheck2d/sbom","scorecard":{"id":114781,"data":{"date":"2025-08-11","repo":{"name":"github.com/Prozi/detect-collisions","commit":"82ae2a7b986ece95ec32704b06aaf0f4a9b50cb5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":5,"reason":"1 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/benchmark.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/Prozi/detect-collisions/benchmark.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/Prozi/detect-collisions/benchmark.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/benchmark.yml:36","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T00:52:23.457Z","repository_id":41358877,"created_at":"2025-08-16T00:52:23.457Z","updated_at":"2025-08-16T00:52:23.457Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29012185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T10:37:29.253Z","status":"ssl_error","status_checked_at":"2026-02-02T10:37:28.644Z","response_time":58,"last_error":"SSL_read: 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":["alghorithm","collision-checking","collisions","computational-geometry","computational-geometry-algorithms","javascript","library","typescript"],"created_at":"2026-01-23T23:00:24.034Z","updated_at":"2026-02-02T12:00:45.088Z","avatar_url":"https://github.com/nenjack.png","language":"TypeScript","readme":"# check2d\n\n## [\u003cimg valign=\"middle\" src=\"https://img.shields.io/npm/dw/check2d.svg?style=for-the-badge\u0026color=success\" alt=\"npm downloads per week\" /\u003e](https://www.npmjs.com/package/check2d) + [\u003cimg valign=\"middle\" src=\"https://img.shields.io/npm/dw/detect-collisions.svg?style=for-the-badge\u0026color=success\" alt=\"npm downloads per week\" /\u003e](https://www.npmjs.com/package/detect-collisions) @ [\u003cimg valign=\"middle\" src=\"https://img.shields.io/npm/v/check2d?style=for-the-badge\u0026color=success\" alt=\"npm version\" /\u003e](https://www.npmjs.com/package/check2d?activeTab=versions)\n\n**check2d** is a **feature-complete 2D collision detection library** for JavaScript, designed for **real-time games and simulations**.\n\nIt combines a **Bounding Volume Hierarchy (BVH)** broad phase with **Separating Axis Theorem (SAT)** narrow phase detection, providing fast and accurate collision checks across many shape types.\n\n### highlights\n\n- BVH-based broad phase for high performance\n- SAT-based precise collision detection\n- supports boxes, circles, ellipses, polygons, lines, points\n- raycasting, offsets, rotation, scaling\n- group-based collision filtering\n- visual debugging helpers\n- browser and Node.js support\n- battle-tested and well benchmarked\n\n---\n\n## demos\n\n- Stress test  \n  https://nenjack.github.io/check2d/demo/?stress\n- Tank demo  \n  https://nenjack.github.io/check2d/demo/\n- StackBlitz  \n  https://stackblitz.com/edit/check2d\n- CodePan  \n  https://nenjack.github.io/codepan/#/boilerplate/check2d?pans=console,html\n\n---\n\n## quick start\n\n```ts\nconst { System } = require('check2d')\n\nconst system = new System()\n````\n\n### creating bodies\n\n```ts\nconst { Box, Circle, Polygon } = require('check2d')\n\nconst box = system.createBox({ x: 0, y: 0 }, 10, 10)\nconst circle = new Circle({ x: 5, y: 0 }, 5)\n\nsystem.insert(circle)\n```\n\n---\n\n## body manipulation\n\nBodies can be transformed freely. Changes are batched and applied once.\n\n```ts\nbox.setPosition(10, 5, false)\nbox.setAngle(Math.PI / 4, false)\nbox.setScale(2, 1, false)\nbox.move(1, false)\n\nbox.updateBody()\n```\n\nSupported features include:\n\n* position, rotation, scale\n* movement in facing direction\n* offsets relative to body center\n* AABB access\n* padding to reduce BVH reinserts\n* group-based collision filtering\n\n---\n\n## collision checks\n\n```ts\nsystem.checkAll((result) =\u003e {\n  console.log(result)\n})\n\nsystem.checkOne(box, (result) =\u003e {\n  console.log(result)\n})\n\n// optional automatic separation\nsystem.separate()\n```\n\n### collision points\n\n```ts\nconst points = system.getCollisionPoints(result.a, result.b)\n```\n\n---\n\n## raycasting\n\n```ts\nconst hit = system.raycast(\n  { x: 0, y: 0 },\n  { x: 0, y: -10 },\n  (body) =\u003e true\n)\n\nif (hit) {\n  const { point, body } = hit\n  console.log(point, body)\n}\n```\n\n---\n\n## visual debugging\n\nDraw bodies directly to a `\u003ccanvas\u003e` context:\n\n```ts\ncontext.beginPath()\nsystem.draw(context)\ncontext.stroke()\n```\n\nDraw BVH bounding boxes:\n\n```ts\ncontext.beginPath()\nsystem.drawBVH(context)\ncontext.stroke()\n```\n\n---\n\n## browser usage\n\n```js\nimport { System } from 'https://esm.sh/check2d'\n```\n\n---\n\n## testing \u0026 benchmark\n\n```bash\nTest Suites: 12 passed, 12 total\nTests:       84 passed, 84 total\n```\n\nRun benchmarks and stress tests:\n\n```bash\ngit clone https://github.com/nenjack/check2d.git\ncd check2d\nnpm i\nnpm run benchmark\n```\n\n---\n\n## installation\n\n```bash\nyarn add check2d\n```\n\n---\n\n## documentation\n\nAPI reference and guides:\n[https://nenjack.github.io/check2d/](https://nenjack.github.io/check2d/)\n\n---\n\n## why not a physics engine?\n\nPhysics engines like Matter.js or Planck.js are excellent when full simulation is required, but they often introduce unnecessary overhead when **only collision detection is needed**.\n\n**check2d** focuses purely on collision detection:\n\n* no gravity\n* no forces\n* no assumptions about movement\n\nThis makes it ideal as a **standalone collision system** or as the foundation of a custom physics engine.\n\n---\n\n## contributing\n\nContributions are welcome.\n\n* run `npm run precommit`\n* follow conventional commits\n* avoid using `any`\n\n---\n\n## license\n\nMIT\n","funding_links":[],"categories":["javascript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnenjack%2Fcheck2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnenjack%2Fcheck2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnenjack%2Fcheck2d/lists"}