{"id":26798099,"url":"https://github.com/olson-sean-k/plexus","last_synced_at":"2025-05-15T23:05:00.086Z","repository":{"id":23227561,"uuid":"98477799","full_name":"olson-sean-k/plexus","owner":"olson-sean-k","description":"Polygonal mesh processing.","archived":false,"fork":false,"pushed_at":"2025-05-01T18:35:03.000Z","size":2171,"stargazers_count":178,"open_issues_count":16,"forks_count":15,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-13T14:17:17.447Z","etag":null,"topics":["geometry","graphics","half-edge","mesh","polygon","rust","topology"],"latest_commit_sha":null,"homepage":"https://plexus.rs","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/olson-sean-k.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":"2017-07-27T00:48:30.000Z","updated_at":"2025-05-09T20:27:05.000Z","dependencies_parsed_at":"2025-01-06T19:51:50.905Z","dependency_job_id":"b16fa3cc-29e9-4d7b-8ab4-253370fef4e2","html_url":"https://github.com/olson-sean-k/plexus","commit_stats":{"total_commits":830,"total_committers":3,"mean_commits":276.6666666666667,"dds":"0.012048192771084376","last_synced_commit":"3a6649b7cfa79fb7568e86841529d60af1af1709"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fplexus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fplexus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fplexus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fplexus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olson-sean-k","download_url":"https://codeload.github.com/olson-sean-k/plexus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436944,"owners_count":22070946,"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":["geometry","graphics","half-edge","mesh","polygon","rust","topology"],"created_at":"2025-03-29T19:17:05.770Z","updated_at":"2025-05-15T23:05:00.030Z","avatar_url":"https://github.com/olson-sean-k.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg alt=\"Plexus\" src=\"https://raw.githubusercontent.com/olson-sean-k/plexus/master/doc/plexus.svg?sanitize=true\" width=\"320\"/\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\n**Plexus** is a highly composable Rust library for polygonal mesh processing.\nSee [the website][website] for the most recent [API documentation][rustdoc] and\nthe [user guide][guide].\n\n[![GitHub](https://img.shields.io/badge/GitHub-olson--sean--k/plexus-8da0cb?logo=github\u0026style=for-the-badge)](https://github.com/olson-sean-k/plexus)\n[![docs.rs](https://img.shields.io/badge/docs.rs-plexus-66c2a5?logo=rust\u0026style=for-the-badge)](https://docs.rs/plexus)\n[![crates.io](https://img.shields.io/crates/v/plexus.svg?logo=rust\u0026style=for-the-badge)](https://crates.io/crates/plexus)\n[![Gitter](https://img.shields.io/badge/Gitter-plexus--rs-c266a5?logo=gitter\u0026style=for-the-badge)](https://gitter.im/plexus-rs/community)\n\n## Primitives\n\nPlexus provides primitive topological structures that can be composed using\ngenerators and iterator expressions. Iterator expressions operate over a\nsequence of polygons with arbitrary vertex data. These polygons can be\ndecomposed, tessellated, indexed, and collected into mesh data structures.\n\n```rust\nuse decorum::R64; // See \"Integrations\".\nuse nalgebra::Point3;\nuse plexus::buffer::MeshBuffer;\nuse plexus::index::Flat3;\nuse plexus::prelude::*;\nuse plexus::primitive::generate::Position;\nuse plexus::primitive::sphere::UvSphere;\n\nuse crate::render::pipeline::{Color4, Vertex};\n\ntype E3 = Point3\u003cR64\u003e;\n\n// Create a buffer of index and vertex data from a uv-sphere.\nlet buffer: MeshBuffer\u003cFlat3, Vertex\u003e = UvSphere::new(16, 8)\n    .polygons::\u003cPosition\u003cE3\u003e\u003e()\n    .map_vertices(|position| Vertex::new(position, Color4::white()))\n    .triangulate()\n    .collect();\n```\n\nThe above example uses a generator and iterator expression to transform the\npositional data of a sphere into a linear buffer for indexed drawing. See [the\nsphere example][example-sphere] for a rendered demonstration.\n\n## Half-Edge Graphs\n\nThe `MeshGraph` type represents polygonal meshes as an ergonomic [half-edge\ngraph][dcel] that supports arbitrary data in vertices, arcs (half-edges), edges,\nand faces. Graphs can be traversed and manipulated in many ways that iterator\nexpressions and linear buffers cannot.\n\n```rust\nuse plexus::graph::MeshGraph;\nuse plexus::prelude::*;\nuse plexus::primitive::Tetragon;\nuse ultraviolet::vec::Vec3;\n\ntype E3 = Vec3;\n\n// Create a graph of a tetragon.\nlet mut graph = MeshGraph::\u003cE3\u003e::from(Tetragon::from([\n    (1.0, 1.0, 0.0),\n    (-1.0, 1.0, 0.0),\n    (-1.0, -1.0, 0.0),\n    (1.0, -1.0, 0.0),\n]));\n// Extrude the face of the tetragon.\nlet key = graph.faces().next().unwrap().key();\nlet face = graph.face_mut(key).unwrap().extrude_with_offset(1.0).unwrap();\n```\n\nPlexus avoids exposing very basic topological operations like inserting\nindividual vertices into a graph, because they can easily be done incorrectly.\nInstead, graphs are typically manipulated with more abstract operations like\nmerging and splitting.\n\nSee [the user guide][guide-graphs] for more details about graphs.\n\n## Geometric Traits\n\nPlexus provides optional traits to support spatial operations by exposing\npositional data in vertices. If the data exposed by the `AsPosition` trait\nsupports these geometric traits, then geometric operations become available in\nprimitive and mesh data structure APIs.\n\n```rust\nuse glam::Vec3A;\nuse plexus::geometry::{AsPosition, Vector};\nuse plexus::graph::GraphData;\nuse plexus::prelude::*;\n\ntype E3 = Vec3A;\n\n#[derive(Clone, Copy, PartialEq)]\npub struct Vertex {\n    pub position: E3,\n    pub normal: Vector\u003cE3\u003e,\n}\n\nimpl GraphData for Vertex {\n    type Vertex = Self;\n    type Arc = ();\n    type Edge = ();\n    type Face = ();\n}\n\nimpl AsPosition for Vertex {\n    type Position = E3;\n\n    fn as_position(\u0026self) -\u003e \u0026Self::Position {\n        \u0026self.position\n    }\n}\n```\n\nData structures like `MeshGraph` also provide functions that allow user code to\ncompute geometry without requiring any of these traits; the data in these\nstructures may be arbitrary, including no data at all.\n\n## Integrations\n\nPlexus integrates with the [`theon`] crate to provide geometric traits and\nsupport various mathematics crates in the Rust ecosystem. Any mathematics crate\ncan be used and, if it is supported by Theon, Plexus provides geometric APIs by\nenabling Cargo features.\n\n| Feature                | Default | Crate           |\n|------------------------|---------|-----------------|\n| `geometry-cgmath`      | No      | [`cgmath`]      |\n| `geometry-glam`        | No      | [`glam`]        |\n| `geometry-mint`        | No      | [`mint`]        |\n| `geometry-nalgebra`    | No      | [`nalgebra`]    |\n| `geometry-ultraviolet` | No      | [`ultraviolet`] |\n\nEnabling the corresponding feature is recommended if using one of these\nsupported crates.\n\nPlexus also integrates with the [`decorum`] crate for floating-point\nrepresentations that can be hashed for fast indexing. The `R64` type is a\n(totally ordered) real number with an `f64` representation that cannot be `NaN`\nnor infinity, for example. Geometric conversion traits are implemented for\nsupported types to allow for implicit conversions of scalar types.\n\n## Encodings\n\nPlexus provides support for polygonal mesh encodings. This allows mesh data\nstructures like `MeshGraph` and `MeshBuffer` to be serialized and deserialized\nto and from various formats.\n\n```rust\nuse nalgebra::Point3;\nuse plexus::encoding::ply::{FromPly, PositionEncoding};\nuse plexus::graph::MeshGraph;\nuse plexus::prelude::*;\nuse std::fs::File;\n\ntype E3 = Point3\u003cf64\u003e;\n\nlet ply = File::open(\"cube.ply\").unwrap();\nlet encoding = PositionEncoding::\u003cE3\u003e::default();\nlet (graph, _) = MeshGraph::\u003cE3\u003e::from_ply(encoding, ply).unwrap();\n```\n\nEncoding support is optional and enabled via Cargo features.\n\n| Feature        | Default | Encoding | Read | Write |\n|----------------|---------|----------|------|-------|\n| `encoding-ply` | No      | PLY      | Yes  | No    |\n\nSee [the teapot example][example-teapot] for a rendered demonstration of reading\na mesh from the file system.\n\n[dcel]: https://en.wikipedia.org/wiki/doubly_connected_edge_list\n\n[guide]: https://plexus.rs/user-guide/getting-started\n[guide-graphs]: https://plexus.rs/user-guide/graphs\n[rustdoc]: https://plexus.rs/rustdoc/plexus\n[website]: https://plexus.rs\n\n[example-sphere]: https://github.com/olson-sean-k/plexus/tree/master/examples/sphere/src/main.rs\n[example-teapot]: https://github.com/olson-sean-k/plexus/tree/master/examples/teapot/src/main.rs\n\n[`cgmath`]: https://crates.io/crates/cgmath\n[`decorum`]: https://crates.io/crates/decorum\n[`glam`]: https://crates.io/crates/glam\n[`mint`]: https://crates.io/crates/mint\n[`nalgebra`]: https://crates.io/crates/nalgebra\n[`theon`]: https://crates.io/crates/theon\n[`ultraviolet`]: https://crates.io/crates/ultraviolet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folson-sean-k%2Fplexus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folson-sean-k%2Fplexus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folson-sean-k%2Fplexus/lists"}