mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-08 20:08:30 +00:00
Implement Vector
/Scalar
multiplication
This commit is contained in:
parent
b01ebd326a
commit
a6b1bbfdcb
@ -39,3 +39,22 @@ where
|
|||||||
Self { components }
|
Self { components }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S, const D: usize> ops::Mul<S> for Vector<D>
|
||||||
|
where
|
||||||
|
S: Into<Scalar>,
|
||||||
|
{
|
||||||
|
type Output = Self;
|
||||||
|
|
||||||
|
fn mul(self, scalar: S) -> Self::Output {
|
||||||
|
let scalar = scalar.into();
|
||||||
|
|
||||||
|
let components = self
|
||||||
|
.components
|
||||||
|
.into_iter_fixed()
|
||||||
|
.map(|v| v * scalar)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Self { components }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user