mirror of
https://github.com/hannobraun/Fornjot
synced 2025-11-08 16:10:06 +00:00
Implement Sub between two Vectors
This commit is contained in:
parent
7958712869
commit
a2cc0f7699
@ -101,3 +101,23 @@ where
|
|||||||
Self { components }
|
Self { components }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<V, const D: usize> ops::Sub<V> for Vector<D>
|
||||||
|
where
|
||||||
|
V: Into<Vector<D>>,
|
||||||
|
{
|
||||||
|
type Output = Self;
|
||||||
|
|
||||||
|
fn sub(self, other: V) -> Self::Output {
|
||||||
|
let other = other.into();
|
||||||
|
|
||||||
|
let components = self
|
||||||
|
.components
|
||||||
|
.into_iter_fixed()
|
||||||
|
.zip(other.components)
|
||||||
|
.map(|(a, b)| a - b)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Self { components }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user