rgeometry/data/vector/
div.rs1use array_init::array_init;
2use num_traits::NumOps;
3use std::ops::Div;
4
5use super::Vector;
6use super::VectorView;
7
8impl<T, const N: usize> Div<T> for Vector<T, N>
9where
10 T: NumOps + Clone,
11{
12 type Output = Vector<T, N>;
13
14 fn div(self: Vector<T, N>, other: T) -> Self::Output {
15 Vector(array_init(|i| self.0[i].clone() / other.clone()))
16 }
17}
18
19impl<T, const N: usize> Div<T> for VectorView<'_, T, N>
20where
21 T: NumOps + Clone,
22{
23 type Output = Vector<T, N>;
24 fn div(self, other: T) -> Vector<T, N> {
25 Vector(array_init(|i| self.0[i].clone() / other.clone()))
26 }
27}