Skip to main content

SimplicialComplex

Struct SimplicialComplex 

Source
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

Source

pub fn new() -> Self

Creates an empty simplicial complex.

Source

pub fn add_vertex(&mut self, pos: [f64; 3]) -> usize

Adds a vertex and returns its index.

Source

pub fn add_edge(&mut self, i: usize, j: usize)

Adds an edge if it is not already present.

Source

pub fn add_triangle(&mut self, i: usize, j: usize, k: usize)

Adds a triangle.

Source

pub fn add_tetrahedron(&mut self, i: usize, j: usize, k: usize, l: usize)

Adds a tetrahedron.

Source

pub fn euler_characteristic(&self) -> i64

Computes the Euler characteristic χ = V - E + F - T.

Source

pub fn n_vertices(&self) -> usize

Returns the number of vertices V.

Source

pub fn n_edges(&self) -> usize

Returns the number of edges E.

Source

pub fn n_triangles(&self) -> usize

Returns the number of triangles F.

Source

pub fn n_tetrahedra(&self) -> usize

Returns the number of tetrahedra T.

Source

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).

Source

pub fn boundary_2(&self) -> Vec<i32>

Builds the boundary operator ∂_2: triangles → edges.

Returns a |E| × |F| matrix (flat row-major).

Source

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.

Source

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

Source§

fn clone(&self) -> SimplicialComplex

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimplicialComplex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SimplicialComplex

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.