Add Vector::normalize

This commit is contained in:
Hanno Braun 2025-01-08 21:27:48 +01:00
parent 30fbe3e2e9
commit 5778366e00

View File

@ -19,6 +19,11 @@ impl<const D: usize> Vector<D> {
.unwrap_or(Scalar::zero())
.sqrt()
}
#[allow(unused)] // code to use it is being worked on
pub fn normalize(self) -> Self {
self / self.magnitude()
}
}
impl Vector<3> {