{"id":15018000,"url":"https://github.com/virtualritz/polyhedron-ops","last_synced_at":"2025-04-04T13:12:40.544Z","repository":{"id":46122206,"uuid":"284503594","full_name":"virtualritz/polyhedron-ops","owner":"virtualritz","description":"Conway-Hart Polyhedron Notation in Rust","archived":false,"fork":false,"pushed_at":"2024-10-10T23:23:25.000Z","size":5739,"stargazers_count":77,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T12:09:35.292Z","etag":null,"topics":["3delight","bevy","geometry","nsi","polygon-mesh","polyhedra","polyhedron","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/virtualritz.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}},"created_at":"2020-08-02T16:55:20.000Z","updated_at":"2025-03-27T01:14:35.000Z","dependencies_parsed_at":"2025-01-11T05:11:48.005Z","dependency_job_id":"1f69d3c9-fbb5-4a44-a792-91feaba913bb","html_url":"https://github.com/virtualritz/polyhedron-ops","commit_stats":{"total_commits":121,"total_committers":5,"mean_commits":24.2,"dds":0.2975206611570248,"last_synced_commit":"537ea0f0973be1cfb77316008b7f0002aeac2016"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualritz%2Fpolyhedron-ops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualritz%2Fpolyhedron-ops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualritz%2Fpolyhedron-ops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualritz%2Fpolyhedron-ops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/virtualritz","download_url":"https://codeload.github.com/virtualritz/polyhedron-ops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182401,"owners_count":20897381,"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":["3delight","bevy","geometry","nsi","polygon-mesh","polyhedra","polyhedron","rust"],"created_at":"2024-09-24T19:51:18.263Z","updated_at":"2025-04-04T13:12:40.514Z","avatar_url":"https://github.com/virtualritz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polyhedron Operators\n\nThis crate implements the [Conway Polyhedron\nOperators](http://en.wikipedia.org/wiki/Conway_polyhedron_notation)\nand their extensions by [George W. Hart](http://www.georgehart.com/)\nand others.\n\n![Some brutalist Polyhedron, rendered with 3Delight|ɴsɪ](polyhedron.jpg)\n\n*Some brutalist polyhedron; rendered with\n[3Delight|ɴsɪ](https://www.3delight.com) and post processed in\n[Ansel](https://ansel.photos/).*\n\nThis is an experiment to improve my understanding of iterators in Rust.\nIt is based on [Kit Wallace](http://kitwallace.tumblr.com/tagged/conway)’s\nOpenSCAD code. As OpenSCAD Language is functional it lends itself well to\ntranslation into functional Rust.\n\n```rust\nuse polyhedron_ops::Polyhedron;\nuse std::path::Path;\n\n// Conway notation: gapcD\nlet polyhedron =\n    Polyhedron::dodecahedron()  // D\n        .chamfer(None, true)    // c\n        .propellor(None, true)  // p\n        .ambo(None, true)       // a\n        .gyro(None, None, true) // g\n        .finalize();\n\n// Export as ./polyhedron-gapcD.obj\npolyhedron.write_obj(\u0026Path::new(\".\"), false);\n```\n\nThe above code starts from a\n[dodecahedron](https://en.wikipedia.org/wiki/Dodecahedron) and\niteratively applies four operators.\n\nThe resulting shape is shown below.\n\n![A polyhedron](gapcD.jpg)\n\n## Caveat\n\nThis is in a semi-polised shape. Documentation could be better (open an issue\nif you feel something is particualrly lacking).\n\nIn short: use at your own risk.\n\n## Cargo Features\n\n* `bevy` – Adds support for converting a polyhedron into a\n  [`bevy`](https://bevyengine.org/)\n  [`Mesh`](https://docs.rs/bevy/latest/bevy/render/mesh/struct.Mesh.html).\n\n* `nsi`  – Adds support for sending a polyhedron to an offline renderer\n  via the [ɴsɪ](https://crates.io/crates/nsi/) crate.\n\n* `obj`  – Adds support for writing data out as\n  [Wavefront OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file).\n\n* `parser` – Add support for parsing strings in\n  [Conway Polyhedron Notation](https://en.wikipedia.org/wiki/Conway_polyhedron_notation).\n  This feature implements `Polyhedron::TryFrom\u003c\u0026str\u003e`.\n\n## Base Shapes\n\n* [x] Platonic solids\n* [x] Prisms\n* [x] Antiprisms\n* [ ] Pyramids\n* [ ] Johnson Solids\n\n## Supported Operators\n\n* [x] **a** – ambo\n* [x] **b** – bevel (equiv. to **ta**)\n* [x] **c** – chamfer\n* [x] **d** – dual\n* [x] **e** – expand (a.k.a. explode, equiv. to **aa**)\n* [x] **g** – gyro\n* [x] **i** – inset/loft (equiv. to **x,N**)\n* [x] **j** – join (equiv. to **dad**)\n* [x] **K** – Quick \u0026 dirty canonicalization\n* [x] **k** – kis\n* [x] **M** – medial (equiv. to **dta**)\n* [x] **m** – meta (equiv. to **k,,3j**)\n* [x] **n** – needle (equiv. to **dt**)\n* [x] **o** – ortho (equiv. to **jj**)\n* [x] **p** – propellor\n* [x] **q** – quinto\n* [x] **r** – reflect\n* [x] **S** – spherize\n* [x] **s** – snub (equiv. to **dgd**)\n* [x] **t** – truncate (equiv. to **dkd**)\n* [x] **v** – subdivide (Catmull-Clark)\n* [x] **w** – whirl\n* [x] **x** – extrude\n* [x] **z** – zip (equiv. to **dk**)\n\n### Other Operators\n\n* [ ] **H** – hollow (called ‘intrude’ in Wings3D)\n* [ ] **h** – hexpropellor\n* [ ] **l** – stellate\n* [ ] **?** – triangulate\n\n## Playing\n\nThere is a playground example app to test things \u0026 have fun:\n\n```text\ncargo run --release --example playground --features obj\n```\n\nIf you want to produce images like the ones above you need to\n[download the free version of the 3Delight renderer](https://www.3delight.com/download)\nand install that. After that, run the example with\n[ɴsɪ](https://crates.io/crates/nsi/) support:\n\n```text\ncargo run --release --example playground --features nsi,obj\n```\n\n### Keyboard Commands\n\nUse keys matching the operator name from the above list to apply.\n\nUse `Up` and `Down` to adjust the parameter of the the last operator.\nCombine with `Shift` for 10× the change.\n\n`Delete` undoes the last (and only the last) operation.\n\nPress `F1` to render with 3Delight (requires a [3Delight|ɴsɪ\ninstallation](https://www.3delight.com/download)).\nCombine with `Shift` to render with 3Delight Cloud (requires registration).\n\nPress `Space` to save as `$HOME/polyhedron-\u003ctype\u003e.obj`.\n\nExport \u0026 render will always yield a correct OBJ though. Which you can\nview in Wings, Blender or another DCC app.\n\n## Contributors\n\n[donbright](https://github.com/donbright)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualritz%2Fpolyhedron-ops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirtualritz%2Fpolyhedron-ops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualritz%2Fpolyhedron-ops/lists"}