use crate::lerp::Lerp;
pub type Position = [f32; 2];
pub type Rgb = [f32; 3];
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Point {
pub position: Position,
pub color: Rgb,
}
impl Point {
pub fn centered_blank() -> Self {
Point {
position: [0.0, 0.0],
color: [0.0, 0.0, 0.0],
}
}
pub fn blanked(&self) -> Self {
let mut blanked = *self;
blanked.color = [0.0, 0.0, 0.0];
blanked
}
pub fn is_blank(&self) -> bool {
let [r, g, b] = self.color;
r == 0.0 && g == 0.0 && b == 0.0
}
}
impl Lerp for Point {
type Scalar = f32;
fn lerp(&self, other: &Self, amt: f32) -> Self {
Point {
position: self.position.lerp(&other.position, amt),
color: self.color.lerp(&other.color, amt),
}
}
}