{"id":32436861,"url":"https://github.com/phqb/martinez-rs","last_synced_at":"2025-10-25T23:55:33.399Z","repository":{"id":319958991,"uuid":"1072742974","full_name":"phqb/martinez-rs","owner":"phqb","description":"Rust port of w8r/martinez: Martinez-Rueda polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor","archived":false,"fork":false,"pushed_at":"2025-10-21T04:59:18.000Z","size":1627,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T06:25:58.537Z","etag":null,"topics":["computational-geometry","polygon","polygon-boolean","polygon-clipping","polygon-intersection","polygon-union"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/phqb.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":"2025-10-09T06:39:23.000Z","updated_at":"2025-10-10T18:59:13.000Z","dependencies_parsed_at":"2025-10-21T06:36:56.680Z","dependency_job_id":null,"html_url":"https://github.com/phqb/martinez-rs","commit_stats":null,"previous_names":["phqb/martinez-rs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/phqb/martinez-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phqb%2Fmartinez-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phqb%2Fmartinez-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phqb%2Fmartinez-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phqb%2Fmartinez-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phqb","download_url":"https://codeload.github.com/phqb/martinez-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phqb%2Fmartinez-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281038745,"owners_count":26433647,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"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":["computational-geometry","polygon","polygon-boolean","polygon-clipping","polygon-intersection","polygon-union"],"created_at":"2025-10-25T23:55:18.510Z","updated_at":"2025-10-25T23:55:33.394Z","avatar_url":"https://github.com/phqb.png","language":"Rust","readme":"# martinez-rs\n\nThis is a Rust port of [https://github.com/w8r/martinez@3d55204](https://github.com/w8r/martinez/tree/3d55204b7263977127a3b315c89f888e2484d319): Martinez-Rueda polygon clipping algorithm.\n\n## Features\n\n* Arena-based, no `Rc\u003cRefCell\u003c_\u003e\u003e` shenanigan.\n* Only 1 dependency `robust = \"1.2.0\"`.\n\n## API\n\n* `fn union(subject: \u0026[Polygon], clipping: \u0026[Polygon]) -\u003e Option\u003cMultiPolygon\u003e`\n* `fn diff(subject: \u0026[Polygon], clipping: \u0026[Polygon]) -\u003e Option\u003cMultiPolygon\u003e`\n* `fn xor(subject: \u0026[Polygon], clipping: \u0026[Polygon]) -\u003e Option\u003cMultiPolygon\u003e`\n* `fn intersection(subject: \u0026[Polygon], clipping: \u0026[Polygon]) -\u003e Option\u003cMultiPolygon\u003e`\n\nWhere\n\n* `type Point = [f64; 2]`\n* `type Polygon = Vec\u003cVec\u003cPoint\u003e\u003e`\n* `type MultiPolygon = Vec\u003cPolygon\u003e`\n\n## Benchmark\n\n```\ncargo bench --features bench\n```\n\nMy output (reduced) on Windows WSL on ThinkPad P14s Gen 5 Intel:\n```\n     Running benches/hole_hole.rs (target/release/deps/hole_hole-bf91b19cc9d77348)\nHole_Hole/martinez_rs::union\n                        time:   [8.8146 µs 8.9886 µs 9.1654 µs]\n                        thrpt:  [109.11 Kelem/s 111.25 Kelem/s 113.45 Kelem/s]\n\n     Running benches/asia_union.rs (target/release/deps/asia_union-ece3ccfc91b83d13)\nAsia union/martinez_rs::union\n                        time:   [20.450 ms 20.835 ms 21.231 ms]\n                        thrpt:  [47.101  elem/s 47.995  elem/s 48.899  elem/s]\n\n     Running benches/states_source.rs (target/release/deps/states_source-b47c8793cb4ecfec)\nState clip/martinez_rs::union\n                        time:   [1.2449 ms 1.2733 ms 1.3026 ms]\n                        thrpt:  [767.68  elem/s 785.36  elem/s 803.29  elem/s]\n```\n\n## Ported tests\n\n - [x] compare_events.test.js -\u003e compare_events::tests\n - [x] compare_segments.test.js -\u003e compare_segments::tests\n - [x] compute_fields.test.js\n    * There is no test\n - [x] divide_segment.test.js -\u003e divide_segment::tests\n - [x] featureTypes.test.js -\u003e feature_types_test\n - [x] genericTestCases.test.js -\u003e generic_test_cases\n - [x] index.test.js -\u003e tests\n - [x] segment_intersection.test.js -\u003e segment_intersection::tests\n - [x] signed_area.test.js -\u003e signed_area::tests\n - [x] sweep_event.test.js -\u003e sweep_event::tests\n - [x] sweep_line.test.js -\u003e sweep_line::tests\n - [x] types.ts -\u003e tests\n\n## TODO\n\n- [ ] no_std\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphqb%2Fmartinez-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphqb%2Fmartinez-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphqb%2Fmartinez-rs/lists"}