use super::scalar::lerp_scalar;
#[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub struct Inset {
top: f32,
right: f32,
bottom: f32,
left: f32,
}
impl Inset {
#[must_use]
pub const fn new(top: f32, right: f32, bottom: f32, left: f32) -> Self {
Self {
top,
right,
bottom,
left,
}
}
#[must_use]
pub const fn top(&self) -> f32 {
self.top
}
#[must_use]
pub const fn right(&self) -> f32 {
self.right
}
#[must_use]
pub const fn bottom(&self) -> f32 {
self.bottom
}
#[must_use]
pub const fn left(&self) -> f32 {
self.left
}
}
#[must_use]
pub const fn interp_inset(from: Inset, to: Inset, mix: f32) -> Inset {
Inset::new(
lerp_scalar(from.top, to.top, mix),
lerp_scalar(from.right, to.right, mix),
lerp_scalar(from.bottom, to.bottom, mix),
lerp_scalar(from.left, to.left, mix),
)
}