pub struct SimplicialComplex {
pub vertices: Vec<[f64; 3]>,
pub edges: Vec<[usize; 2]>,
pub triangles: Vec<[usize; 3]>,
pub tetrahedra: Vec<[usize; 4]>,
}Expand description
Simplicial complex: vertices, edges, triangles, tetrahedra.
A simplicial complex is a set of simplices that satisfies the condition that every face of a simplex is also a simplex in the complex.
Fields§
§vertices: Vec<[f64; 3]>Vertices (0-simplices) stored as [x, y, z]
edges: Vec<[usize; 2]>Edges (1-simplices) as pairs of vertex indices
triangles: Vec<[usize; 3]>Triangles (2-simplices) as triples of vertex indices
tetrahedra: Vec<[usize; 4]>Tetrahedra (3-simplices) as quadruples of vertex indices
Implementations§
Source§impl SimplicialComplex
impl SimplicialComplex
Sourcepub fn add_vertex(&mut self, pos: [f64; 3]) -> usize
pub fn add_vertex(&mut self, pos: [f64; 3]) -> usize
Adds a vertex and returns its index.
Sourcepub fn add_triangle(&mut self, i: usize, j: usize, k: usize)
pub fn add_triangle(&mut self, i: usize, j: usize, k: usize)
Adds a triangle.
Sourcepub fn euler_characteristic(&self) -> i64
pub fn euler_characteristic(&self) -> i64
Computes the Euler characteristic χ = V - E + F - T.
Sourcepub fn n_vertices(&self) -> usize
pub fn n_vertices(&self) -> usize
Returns the number of vertices V.
Sourcepub fn n_triangles(&self) -> usize
pub fn n_triangles(&self) -> usize
Returns the number of triangles F.
Sourcepub fn n_tetrahedra(&self) -> usize
pub fn n_tetrahedra(&self) -> usize
Returns the number of tetrahedra T.
Sourcepub fn boundary_1(&self) -> Vec<i32>
pub fn boundary_1(&self) -> Vec<i32>
Builds the boundary operator ∂_1: edges → vertices as incidence matrix.
Returns a |V| × |E| matrix (flat row-major).
Sourcepub fn boundary_2(&self) -> Vec<i32>
pub fn boundary_2(&self) -> Vec<i32>
Builds the boundary operator ∂_2: triangles → edges.
Returns a |E| × |F| matrix (flat row-major).
Sourcepub fn octahedral_sphere() -> Self
pub fn octahedral_sphere() -> Self
Creates the simplicial complex for a triangulated sphere (icosphere-like).
Uses an octahedral approximation: 6 vertices, 12 edges, 8 triangles. Euler characteristic = 6 - 12 + 8 = 2.
Sourcepub fn minimal_torus() -> Self
pub fn minimal_torus() -> Self
Creates a torus triangulation with Euler characteristic 0.
Minimal triangulation: V=7, E=21, F=14, χ=0. Uses the complete graph K_7 triangulation of the torus.
Trait Implementations§
Source§impl Clone for SimplicialComplex
impl Clone for SimplicialComplex
Source§fn clone(&self) -> SimplicialComplex
fn clone(&self) -> SimplicialComplex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SimplicialComplex
impl Debug for SimplicialComplex
Auto Trait Implementations§
impl Freeze for SimplicialComplex
impl RefUnwindSafe for SimplicialComplex
impl Send for SimplicialComplex
impl Sync for SimplicialComplex
impl Unpin for SimplicialComplex
impl UnsafeUnpin for SimplicialComplex
impl UnwindSafe for SimplicialComplex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.