mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-21 14:45:51 +00:00
Merge pull request #1590 from hannobraun/math
Make various improvements to `fj-math`
This commit is contained in:
commit
bf4ca75a6a
@ -115,6 +115,7 @@ impl<const D: usize> Line<D> {
|
||||
/// Create a new instance that is reversed
|
||||
#[must_use]
|
||||
pub fn reverse(mut self) -> Self {
|
||||
self.origin += self.direction;
|
||||
self.direction = -self.direction;
|
||||
self
|
||||
}
|
||||
|
@ -164,6 +164,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<V, const D: usize> ops::AddAssign<V> for Point<D>
|
||||
where
|
||||
V: Into<Vector<D>>,
|
||||
{
|
||||
fn add_assign(&mut self, rhs: V) {
|
||||
*self = *self + rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl<V, const D: usize> ops::Sub<V> for Point<D>
|
||||
where
|
||||
V: Into<Vector<D>>,
|
||||
|
@ -323,6 +323,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, const D: usize> ops::MulAssign<S> for Vector<D>
|
||||
where
|
||||
S: Into<Scalar>,
|
||||
{
|
||||
fn mul_assign(&mut self, rhs: S) {
|
||||
*self = *self * rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, const D: usize> ops::Div<S> for Vector<D>
|
||||
where
|
||||
S: Into<Scalar>,
|
||||
|
Loading…
Reference in New Issue
Block a user