Skip to content

Geometry

Plexus uses theon to abstract Euclidean spaces and support various types in the Rust ecosystem. theon provides traits used to support spatial queries and operations in iterator expressions and graphs.

While geometric traits are not required, it is recommended to implement them for types used to represent geometry. For example, computing the normals of faces in a graph or subdividing polygons in an iterator expression can be done easily if these traits are implemented.

Note

Enabling geometry Cargo features provides implementations of these traits for types from commonly used crates like nalgebra. It is highly recommended to enable these features.

Conversions

Plexus provides conversions for geometric types to enable more ergonomic and flexible APIs. The FromGeometry and IntoGeometry traits are analogous to the standard From and Into traits and perform a similar function, but are used exclusively for geometric types.

Conversions are optionally implemented via geometry Cargo features and include support for proxy types from the decorum crate.

The AsPosition trait is re-exported from theon and allows vertex data to expose positional data. When this positional data implements geometric traits, spatial operations become available. For example, this allows graphs to support splitting composite edges at midpoints, extruding faces, and flattening faces to a best-fit plane.