Allow writing matrix * scalar

This commit is contained in:
Pierre Krieger 2015-04-19 15:45:13 +02:00
parent 7916a14f70
commit d560242ed4

View file

@ -510,6 +510,13 @@ impl<S: BaseFloat> Mul for Matrix2<S> {
fn mul(self, other: Matrix2<S>) -> Matrix2<S> { self.mul_m(&other) }
}
impl<S: BaseFloat> Mul<S> for Matrix2<S> {
type Output = Matrix2<S>;
#[inline]
fn mul(self, other: S) -> Matrix2<S> { self.mul_s(other) }
}
impl<S: BaseFloat> Mul for Matrix3<S> {
type Output = Matrix3<S>;
@ -517,6 +524,13 @@ impl<S: BaseFloat> Mul for Matrix3<S> {
fn mul(self, other: Matrix3<S>) -> Matrix3<S> { self.mul_m(&other) }
}
impl<S: BaseFloat> Mul<S> for Matrix3<S> {
type Output = Matrix3<S>;
#[inline]
fn mul(self, other: S) -> Matrix3<S> { self.mul_s(other) }
}
impl<S: BaseFloat> Mul for Matrix4<S> {
type Output = Matrix4<S>;
@ -524,6 +538,13 @@ impl<S: BaseFloat> Mul for Matrix4<S> {
fn mul(self, other: Matrix4<S>) -> Matrix4<S> { self.mul_m(&other) }
}
impl<S: BaseFloat> Mul<S> for Matrix4<S> {
type Output = Matrix4<S>;
#[inline]
fn mul(self, other: S) -> Matrix4<S> { self.mul_s(other) }
}
impl<S: BaseFloat> One for Matrix2<S> {
#[inline]
fn one() -> Matrix2<S> { Matrix2::identity() }