use std::fmt;
use crate::geometry::brep::BrepError;
#[derive(Debug, Clone, PartialEq)]
pub enum CutError {
Brep(BrepError),
OverConstrained {
untouched_count: usize,
plane_count: usize,
untouched: Vec<usize>,
},
}
impl fmt::Display for CutError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Brep(e) => write!(f, "{e}"),
Self::OverConstrained {
untouched_count,
plane_count,
untouched,
} => write!(
f,
"{untouched_count} of {plane_count} planes from the .asc schedule contribute no facet (untouched indices: \
{untouched:?}); the schedule is over-constrained -- most often a near-duplicate tier revision \
left in the source file (e.g. the same facet listed twice at slightly different masts), \
occasionally a crown/pavilion sign misclassification on a zero-angle tier"
),
}
}
}
impl std::error::Error for CutError {}
impl From<BrepError> for CutError {
fn from(e: BrepError) -> Self {
Self::Brep(e)
}
}