{"id":20854352,"url":"https://github.com/w8r/bezier-intersect","last_synced_at":"2025-05-12T05:31:53.626Z","repository":{"id":50088164,"uuid":"118019852","full_name":"w8r/bezier-intersect","owner":"w8r","description":"Set of functions to find intersections between lines and rectangles and Bezier curves of order 2 and 3","archived":false,"fork":false,"pushed_at":"2018-05-18T14:23:42.000Z","size":18,"stargazers_count":44,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T01:29:52.728Z","etag":null,"topics":["algorithm","bezier","curves","geometry","geometry2d","intersection"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/w8r.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-18T18:12:00.000Z","updated_at":"2025-03-18T13:55:37.000Z","dependencies_parsed_at":"2022-09-17T14:12:07.465Z","dependency_job_id":null,"html_url":"https://github.com/w8r/bezier-intersect","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/w8r%2Fbezier-intersect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2Fbezier-intersect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2Fbezier-intersect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2Fbezier-intersect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w8r","download_url":"https://codeload.github.com/w8r/bezier-intersect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253682365,"owners_count":21946920,"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":["algorithm","bezier","curves","geometry","geometry2d","intersection"],"created_at":"2024-11-18T03:25:26.798Z","updated_at":"2025-05-12T05:31:53.308Z","avatar_url":"https://github.com/w8r.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bezier-intersect [![npm version](https://badge.fury.io/js/bezier-intersect.svg)](https://badge.fury.io/js/bezier-intersect) [![build](https://travis-ci.org/w8r/bezier-intersect.svg?branch=master)](https://travis-ci.org/w8r/bezier-intersect)\n\nSet of functions to find intersections between lines and rectangles and Bezier curves of order 2 and 3. Based on [thelonious/js-intersections](https://github.com/thelonious/js-intersections/), but with the abstractions removed and some performance tweaking.\n\n## Install\n\n```\nnpm i -S bezier-intersect\n```\n\n```js\nimport {\n  quadBezierLine,\n  cubicBezierLine,\n  quadBezierAABB,\n  cubicBezierAABB\n} from 'bezier-intersect';\n```\n\n```html\n\u003cscript src=\"https://unpkg.com/bezier-intersect\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nvar res = [];\nbezierIntersect.quadBezierLine(..., res);\nconsole.log(res);\n\u003c/script\u003e\n```\n\n## API\n\n### `quadBezierLine(ax, ay, cx, cy, bx, by, l1x, l1y, l2x, l2y, [result:Array\u003cnumber\u003e]):number`\n\nCalculates the intersection points between the quadratic Bezier curve and line segment. If `result` is passed, returns the exact number of intersections, and stores them in `result` as `[x, y, x, y]`. If not - stops at the first intersection and returns `1` or `0` if there are no intersections.\n\n### `quadBezierAABB(ax, ay, cx, cy, bx, by, minx, miny, maxx, maxy, [result:Array\u003cnumber\u003e]):number`\n\nCalculates the intersection points between the quadratic Bezier curve and axis-aligned box. If `result` is passed, returns the exact number of intersections, and stores them in `result` as `[x, y, x, y]`. If not - stops at the first intersection and returns `1` or `0` if there are no intersections.\n\n### `cubicBezierLine(ax, ay, c1x, c1y, c2x, c2y, bx, by, l1x, l1y, l2x, l2y, [result:Array\u003cnumber\u003e]):number`\n\nCalculates the intersection points between the cubic Bezier curve and line segment. If `result` is passed, returns the exact number of intersections, and stores them in `result` as `[x, y, x, y]`. If not - stops at the first intersection and returns `1` or `0` if there are no intersections.\n\n### `cubicBezierAABB(ax, ay, c1x, c1y, c2x, c2y, bx, by, minx, miny, maxx, maxy, [result:Array\u003cnumber\u003e]):number`\n\nCalculates the intersection points between the cubic Bezier curve and axis-aligned box. If `result` is passed, returns the exact number of intersections, and stores them in `result` as `[x, y, x, y]`. If not - stops at the first intersection and returns `1` or `0` if there are no intersections.\n\n## TODO\n\n- [ ] More tests\n- [ ] Bezier/Polygon\n- [ ] Bezier/Ellipse/Circle\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8r%2Fbezier-intersect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw8r%2Fbezier-intersect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8r%2Fbezier-intersect/lists"}