use crate::{angle::Angle, geonum_mod::Geonum};
pub trait Projection: Sized {
fn view<T>(&self, data: &T, path_encoder: fn(&T) -> Angle) -> Self;
fn compose(&self, other: &Self) -> Self;
}
impl Projection for Geonum {
fn view<T>(&self, data: &T, path_encoder: fn(&T) -> Angle) -> Self {
let path_angle = path_encoder(data);
Geonum::new_with_angle(self.mag, self.angle + path_angle)
}
fn compose(&self, other: &Self) -> Self {
Geonum::new_with_angle(self.mag * other.mag, self.angle + other.angle)
}
}