1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4use use_archimedean::ArchimedeanSolid;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum CatalanSolid {
9 TriakisTetrahedron,
11 RhombicDodecahedron,
13 TriakisOctahedron,
15 TetrakisHexahedron,
17 DeltoidalIcositetrahedron,
19 DisdyakisDodecahedron,
21 PentagonalIcositetrahedron,
23 RhombicTriacontahedron,
25 TriakisIcosahedron,
27 PentakisDodecahedron,
29 DeltoidalHexecontahedron,
31 DisdyakisTriacontahedron,
33 PentagonalHexecontahedron,
35}
36
37impl CatalanSolid {
38 #[must_use]
40 pub const fn name(self) -> &'static str {
41 match self {
42 Self::TriakisTetrahedron => "triakis tetrahedron",
43 Self::RhombicDodecahedron => "rhombic dodecahedron",
44 Self::TriakisOctahedron => "triakis octahedron",
45 Self::TetrakisHexahedron => "tetrakis hexahedron",
46 Self::DeltoidalIcositetrahedron => "deltoidal icositetrahedron",
47 Self::DisdyakisDodecahedron => "disdyakis dodecahedron",
48 Self::PentagonalIcositetrahedron => "pentagonal icositetrahedron",
49 Self::RhombicTriacontahedron => "rhombic triacontahedron",
50 Self::TriakisIcosahedron => "triakis icosahedron",
51 Self::PentakisDodecahedron => "pentakis dodecahedron",
52 Self::DeltoidalHexecontahedron => "deltoidal hexecontahedron",
53 Self::DisdyakisTriacontahedron => "disdyakis triacontahedron",
54 Self::PentagonalHexecontahedron => "pentagonal hexecontahedron",
55 }
56 }
57
58 #[must_use]
60 pub const fn dual_archimedean(self) -> ArchimedeanSolid {
61 match self {
62 Self::TriakisTetrahedron => ArchimedeanSolid::TruncatedTetrahedron,
63 Self::RhombicDodecahedron => ArchimedeanSolid::Cuboctahedron,
64 Self::TriakisOctahedron => ArchimedeanSolid::TruncatedCube,
65 Self::TetrakisHexahedron => ArchimedeanSolid::TruncatedOctahedron,
66 Self::DeltoidalIcositetrahedron => ArchimedeanSolid::Rhombicuboctahedron,
67 Self::DisdyakisDodecahedron => ArchimedeanSolid::TruncatedCuboctahedron,
68 Self::PentagonalIcositetrahedron => ArchimedeanSolid::SnubCube,
69 Self::RhombicTriacontahedron => ArchimedeanSolid::Icosidodecahedron,
70 Self::TriakisIcosahedron => ArchimedeanSolid::TruncatedDodecahedron,
71 Self::PentakisDodecahedron => ArchimedeanSolid::TruncatedIcosahedron,
72 Self::DeltoidalHexecontahedron => ArchimedeanSolid::Rhombicosidodecahedron,
73 Self::DisdyakisTriacontahedron => ArchimedeanSolid::TruncatedIcosidodecahedron,
74 Self::PentagonalHexecontahedron => ArchimedeanSolid::SnubDodecahedron,
75 }
76 }
77}
78
79#[cfg(test)]
80mod tests {
81 use super::CatalanSolid;
82 use use_archimedean::ArchimedeanSolid;
83
84 #[test]
85 fn exposes_dual_archimedean_metadata() {
86 let solid = CatalanSolid::RhombicDodecahedron;
87
88 assert_eq!(solid.name(), "rhombic dodecahedron");
89 assert_eq!(solid.dual_archimedean(), ArchimedeanSolid::Cuboctahedron);
90 }
91}