{"id":16126780,"url":"https://github.com/mikolalysenko/red-blue-line-segment-intersect","last_synced_at":"2025-04-15T02:52:41.602Z","repository":{"id":17694691,"uuid":"20500692","full_name":"mikolalysenko/red-blue-line-segment-intersect","owner":"mikolalysenko","description":"Find all intersections between two sets of line segments","archived":false,"fork":false,"pushed_at":"2014-06-04T21:44:16.000Z","size":148,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T14:42:55.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mikolalysenko.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":"2014-06-04T21:03:47.000Z","updated_at":"2021-06-14T02:05:35.000Z","dependencies_parsed_at":"2022-06-29T20:44:02.787Z","dependency_job_id":null,"html_url":"https://github.com/mikolalysenko/red-blue-line-segment-intersect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Fred-blue-line-segment-intersect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Fred-blue-line-segment-intersect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Fred-blue-line-segment-intersect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Fred-blue-line-segment-intersect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikolalysenko","download_url":"https://codeload.github.com/mikolalysenko/red-blue-line-segment-intersect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525139,"owners_count":21118620,"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":[],"created_at":"2024-10-09T21:40:21.017Z","updated_at":"2025-04-15T02:52:41.580Z","avatar_url":"https://github.com/mikolalysenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"red-blue-line-segment-intersect\n===============================\nGiven two sets of line segments, find all pairs of intersections between the two of them.\n\n[![testling badge](https://ci.testling.com/mikolalysenko/red-blue-line-segment-intersect.png)](https://ci.testling.com/mikolalysenko/red-blue-line-segment-intersect)\n\n[![build status](https://secure.travis-ci.org/mikolalysenko/red-blue-line-segment-intersect.png)](http://travis-ci.org/mikolalysenko/red-blue-line-segment-intersect)\n\n# Example\n\n```javascript\nvar findIntersections = require(\"red-blue-line-segment-intersect\")\n\nvar red = [\n  [[0, 0], [10, 10]],\n  [[10, 10], [10, 0]]\n]\n\nvar blue = [\n  [[1,0], [1, 8]]\n]\n\nfindIntersections(red, blue, function(r, b) {\n  console.log(\"segments\", red[r], blue[b], \"intersect\")\n})\n```\n\nOutput:\n\n```\nsegments [ [ 0, 0 ], [ 10, 10 ] ] [ [ 1, 0 ], [ 1, 8 ] ] intersect\n```\n\n# Install\n\n```\nnpm install red-blue-line-segment-intersect\n```\n\n# API\n\n#### `require(\"red-blue-line-segment-intersect\")(red, blue, visit)`\nFinds all pair of segments between `red` and `blue` which intersect.\n\n* `red` is a list of line segments encoded as pairs of length 2 arrays\n* `blue` is a second list of line segments\n* `visit(r,b)` is a function which is called once for each pair of line segments that intersect.  If `visit` returns truthy value, then iteration is terminated and that value is returned from the traversal.\n\n**Returns** The return value of the last call to `visit`, or `undefined` otherwise.\n\n# Credits\n(c) 2013-2014 Mikola Lysenko. MIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikolalysenko%2Fred-blue-line-segment-intersect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikolalysenko%2Fred-blue-line-segment-intersect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikolalysenko%2Fred-blue-line-segment-intersect/lists"}