use crate::Point;
use crate::utils::vec2_add;
use crate::widget::primitive::shape::triangles::ColoredPoint;
pub trait Vertex: Clone + Copy + PartialEq {
fn point(&self) -> Point;
fn add(self, other: Point) -> Self;
}
impl Vertex for Point {
fn point(&self) -> Point {
*self
}
fn add(self, add: Point) -> Self {
vec2_add(self, add)
}
}
impl Vertex for ColoredPoint {
fn point(&self) -> Point {
self.0
}
fn add(self, add: Point) -> Self {
let (p, c) = self;
(vec2_add(p, add), c)
}
}