#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Sign {
Negative,
Zero,
Positive,
}
impl Sign {
pub(crate) fn of(value: f64) -> Sign {
if value > 0.0 {
Sign::Positive
} else if value < 0.0 {
Sign::Negative
} else {
Sign::Zero
}
}
pub fn negate(self) -> Sign {
match self {
Sign::Negative => Sign::Positive,
Sign::Zero => Sign::Zero,
Sign::Positive => Sign::Negative,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Orientation {
Clockwise,
Collinear,
CounterClockwise,
}
impl From<Sign> for Orientation {
fn from(sign: Sign) -> Self {
match sign {
Sign::Negative => Orientation::Clockwise,
Sign::Zero => Orientation::Collinear,
Sign::Positive => Orientation::CounterClockwise,
}
}
}