#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InputSide {
Left,
Right,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum LinearIntersectionError {
NonFiniteInput {
side: InputSide,
},
DegenerateDirection {
side: InputSide,
},
ArithmeticOverflow,
}
impl core::fmt::Display for LinearIntersectionError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::NonFiniteInput { side } => write!(f, "{side:?} operand has non-finite input"),
Self::DegenerateDirection { side } => {
write!(f, "{side:?} operand has a zero-length direction")
}
Self::ArithmeticOverflow => {
f.write_str("intersection arithmetic left the finite range")
}
}
}
}
impl std::error::Error for LinearIntersectionError {}