pub trait OtRound<U, T = Self> {
fn ot_round(self) -> U;
}
impl OtRound<i16> for f64 {
#[inline]
fn ot_round(self) -> i16 {
(self + 0.5).floor() as i16
}
}
impl OtRound<i16> for f32 {
#[inline]
fn ot_round(self) -> i16 {
(self + 0.5).floor() as i16
}
}
impl OtRound<u16> for f64 {
#[inline]
fn ot_round(self) -> u16 {
(self + 0.5).floor() as u16
}
}
impl OtRound<u16> for f32 {
#[inline]
fn ot_round(self) -> u16 {
(self + 0.5).floor() as u16
}
}
impl OtRound<f64> for f64 {
#[inline]
fn ot_round(self) -> f64 {
(self + 0.5).floor()
}
}
impl OtRound<f32> for f32 {
#[inline]
fn ot_round(self) -> f32 {
(self + 0.5).floor()
}
}
impl OtRound<(i16, i16)> for kurbo::Point {
#[inline]
fn ot_round(self) -> (i16, i16) {
(self.x.ot_round(), self.y.ot_round())
}
}
impl OtRound<kurbo::Vec2> for kurbo::Vec2 {
#[inline]
fn ot_round(self) -> kurbo::Vec2 {
kurbo::Vec2::new((self.x + 0.5).floor(), (self.y + 0.5).floor())
}
}