implement Mul of PointN and ExtentN
use crate::{point::point_traits::*, PointN};
-use core::ops::{Add, AddAssign, Sub, SubAssign};
+use core::ops::{Add, AddAssign, Mul, Sub, SubAssign};
use num::Zero;
use serde::{Deserialize, Serialize};
@@ -223,6 +223,21 @@ where
}
}
+impl<T> Mul<PointN<T>> for ExtentN<T>
+where
+ PointN<T>: Copy + Mul<Output = PointN<T>>,
+{
+ type Output = Self;
+
+ #[inline]
+ fn mul(self, rhs: PointN<T>) -> Self::Output {
+ ExtentN {
+ minimum: self.minimum * rhs,
+ shape: self.shape * rhs,
+ }
+ }
+}
+
impl<T> AddAssign<PointN<T>> for ExtentN<T>
where
Self: Copy + Add<PointN<T>, Output = ExtentN<T>>,
