#![forbid(unsafe_code)]
#![doc = include_str!("../README.md")]
use use_archimedean::ArchimedeanSolid;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CatalanSolid {
TriakisTetrahedron,
RhombicDodecahedron,
TriakisOctahedron,
TetrakisHexahedron,
DeltoidalIcositetrahedron,
DisdyakisDodecahedron,
PentagonalIcositetrahedron,
RhombicTriacontahedron,
TriakisIcosahedron,
PentakisDodecahedron,
DeltoidalHexecontahedron,
DisdyakisTriacontahedron,
PentagonalHexecontahedron,
}
impl CatalanSolid {
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::TriakisTetrahedron => "triakis tetrahedron",
Self::RhombicDodecahedron => "rhombic dodecahedron",
Self::TriakisOctahedron => "triakis octahedron",
Self::TetrakisHexahedron => "tetrakis hexahedron",
Self::DeltoidalIcositetrahedron => "deltoidal icositetrahedron",
Self::DisdyakisDodecahedron => "disdyakis dodecahedron",
Self::PentagonalIcositetrahedron => "pentagonal icositetrahedron",
Self::RhombicTriacontahedron => "rhombic triacontahedron",
Self::TriakisIcosahedron => "triakis icosahedron",
Self::PentakisDodecahedron => "pentakis dodecahedron",
Self::DeltoidalHexecontahedron => "deltoidal hexecontahedron",
Self::DisdyakisTriacontahedron => "disdyakis triacontahedron",
Self::PentagonalHexecontahedron => "pentagonal hexecontahedron",
}
}
#[must_use]
pub const fn dual_archimedean(self) -> ArchimedeanSolid {
match self {
Self::TriakisTetrahedron => ArchimedeanSolid::TruncatedTetrahedron,
Self::RhombicDodecahedron => ArchimedeanSolid::Cuboctahedron,
Self::TriakisOctahedron => ArchimedeanSolid::TruncatedCube,
Self::TetrakisHexahedron => ArchimedeanSolid::TruncatedOctahedron,
Self::DeltoidalIcositetrahedron => ArchimedeanSolid::Rhombicuboctahedron,
Self::DisdyakisDodecahedron => ArchimedeanSolid::TruncatedCuboctahedron,
Self::PentagonalIcositetrahedron => ArchimedeanSolid::SnubCube,
Self::RhombicTriacontahedron => ArchimedeanSolid::Icosidodecahedron,
Self::TriakisIcosahedron => ArchimedeanSolid::TruncatedDodecahedron,
Self::PentakisDodecahedron => ArchimedeanSolid::TruncatedIcosahedron,
Self::DeltoidalHexecontahedron => ArchimedeanSolid::Rhombicosidodecahedron,
Self::DisdyakisTriacontahedron => ArchimedeanSolid::TruncatedIcosidodecahedron,
Self::PentagonalHexecontahedron => ArchimedeanSolid::SnubDodecahedron,
}
}
}
#[cfg(test)]
mod tests {
use super::CatalanSolid;
use use_archimedean::ArchimedeanSolid;
#[test]
fn exposes_dual_archimedean_metadata() {
let solid = CatalanSolid::RhombicDodecahedron;
assert_eq!(solid.name(), "rhombic dodecahedron");
assert_eq!(solid.dual_archimedean(), ArchimedeanSolid::Cuboctahedron);
}
}