mod impl_array;
#[cfg(feature = "cgmath")]
mod impl_cgmath;
#[cfg(feature = "glam")]
mod impl_glam;
#[cfg(feature = "mint")]
mod impl_mint;
#[cfg(feature = "nalgebra")]
mod impl_nalgebra;
pub trait Point: Sized + Copy + Sync + Send {
fn new(x: f32, y: f32, z: f32) -> Self;
fn x(&self) -> f32;
fn y(&self) -> f32;
fn z(&self) -> f32;
fn eq(&self, other: &Self) -> bool {
self.x() == other.x() && self.y() == other.y() && self.z() == other.z()
}
fn add(&self, other: &Self) -> Self {
Self::new(
self.x() + other.x(),
self.y() + other.y(),
self.z() + other.z(),
)
}
fn sub(&self, other: &Self) -> Self {
Self::new(
self.x() - other.x(),
self.y() - other.y(),
self.z() - other.z(),
)
}
fn dot(&self, other: &Self) -> f32 {
self.x() * other.x() + self.y() * other.y() + self.z() * other.z()
}
fn length(&self) -> f32 {
self.dot(self).sqrt()
}
fn dist(&self, other: &Self) -> f32 {
self.sub(other).length()
}
fn fmul(&self, other: f32) -> Self {
Self::new(self.x() * other, self.y() * other, self.z() * other)
}
fn comp_div(&self, other: &Self) -> Self {
Self::new(
self.x() / other.x(),
self.y() / other.y(),
self.z() / other.z(),
)
}
}