pub struct Cube {
pub vertices: Vec<usize>,
pub dimension: usize,
pub id: Option<usize>,
}Expand description
Represents an individual cube in a cubical complex.
A $k$-cube is represented by its $2^k$ vertices and its dimension. The vertices are ordered according to a binary coordinate system where each vertex corresponds to a corner of the hypercube.
§Fields
vertices: AVec<usize>containing the vertex indices that define the cube. For a $k$-cube, this contains $2^k$ vertices ordered systematically.dimension: The intrinsic dimension of the cube (e.g., 0 for a point, 1 for an edge).id: An optional unique identifier assigned when the cube is added to a complex.
Fields§
§vertices: Vec<usize>The vertex indices that define this cube.
dimension: usizeThe dimension of this cube (e.g., 0 for a point, 1 for an edge, 2 for a face).
id: Option<usize>An optional unique identifier assigned when the cube is added to a complex.
Implementations§
Source§impl Cube
impl Cube
Sourcepub fn square(vertices: [usize; 4]) -> Self
pub fn square(vertices: [usize; 4]) -> Self
Creates a new 2-cube (square) from four vertex indices. The vertices should be ordered as: [bottom-left, bottom-right, top-left, top-right] corresponding to binary coordinates (0,0), (1,0), (0,1), (1,1).
Sourcepub fn vertices(&self) -> &[usize]
pub fn vertices(&self) -> &[usize]
Returns a slice reference to the vertex indices of the cube.
Sourcepub const fn id(&self) -> Option<usize>
pub const fn id(&self) -> Option<usize>
Returns the ID of the cube if it has been assigned to a complex.
Sourcepub fn same_content(&self, other: &Self) -> bool
pub fn same_content(&self, other: &Self) -> bool
Checks if this cube has the same mathematical content as another.
Trait Implementations§
Source§impl ComplexElement for Cube
impl ComplexElement for Cube
Source§fn boundary_with_orientations(&self) -> Vec<(Self, i32)>
fn boundary_with_orientations(&self) -> Vec<(Self, i32)>
Source§fn id(&self) -> Option<usize>
fn id(&self) -> Option<usize>
None otherwise. Read moreSource§fn same_content(&self, other: &Self) -> bool
fn same_content(&self, other: &Self) -> bool
Source§impl Ord for Cube
impl Ord for Cube
Source§impl PartialOrd for Cube
impl PartialOrd for Cube
impl Eq for Cube
impl StructuralPartialEq for Cube
Auto Trait Implementations§
impl Freeze for Cube
impl RefUnwindSafe for Cube
impl Send for Cube
impl Sync for Cube
impl Unpin for Cube
impl UnwindSafe for Cube
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more