#[cfg(doc)]
use crate::Extent;
use crate::{_impl_init, Sign};
_impl_init![ConstInit: Self::Left => Boundary1d, Boundary2d, Boundary3d];
#[doc = crate::_tags!(geom_dir)]
#[doc = crate::_doc_location!("geom/dir")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Boundary1d {
Lower,
Upper,
}
#[allow(missing_docs, non_upper_case_globals)]
impl Boundary1d {
pub const Left: Self = Self::Lower;
pub const Right: Self = Self::Upper;
pub const Start: Self = Self::Lower;
pub const End: Self = Self::Upper;
pub const Before: Self = Self::Lower;
pub const After: Self = Self::Upper;
pub const fn opposite(self) -> Self {
match self {
Self::Lower => Self::Upper,
Self::Upper => Self::Lower,
}
}
pub const fn sign(self) -> Sign {
match self {
Self::Lower => Sign::Negative,
Self::Upper => Sign::Positive,
}
}
}
#[doc = crate::_tags!(geom_dir)]
#[doc = crate::_doc_location!("geom/dir")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Boundary2d {
Left,
Right,
Bottom,
Top,
}
#[allow(missing_docs, non_upper_case_globals)]
impl Boundary2d {
pub const Above: Self = Self::Top;
pub const Below: Self = Self::Bottom;
pub const fn opposite(self) -> Self {
match self {
Self::Left => Self::Right,
Self::Right => Self::Left,
Self::Bottom => Self::Top,
Self::Top => Self::Bottom,
}
}
}
#[doc = crate::_tags!(geom_dir)]
#[doc = crate::_doc_location!("geom/dir")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Boundary3d {
Left,
Right,
Bottom,
Top,
Front,
Back,
}
#[allow(missing_docs, non_upper_case_globals)]
impl Boundary3d {
pub const Above: Self = Self::Top;
pub const Below: Self = Self::Bottom;
pub const Near: Self = Self::Front;
pub const Far: Self = Self::Back;
pub const fn opposite(self) -> Self {
match self {
Self::Left => Self::Right,
Self::Right => Self::Left,
Self::Bottom => Self::Top,
Self::Top => Self::Bottom,
Self::Front => Self::Back,
Self::Back => Self::Front,
}
}
}