mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-22 15:15:52 +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
|
/// Create a new instance that is reversed
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn reverse(mut self) -> Self {
|
pub fn reverse(mut self) -> Self {
|
||||||
|
self.origin += self.direction;
|
||||||
self.direction = -self.direction;
|
self.direction = -self.direction;
|
||||||
self
|
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>
|
impl<V, const D: usize> ops::Sub<V> for Point<D>
|
||||||
where
|
where
|
||||||
V: Into<Vector<D>>,
|
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>
|
impl<S, const D: usize> ops::Div<S> for Vector<D>
|
||||||
where
|
where
|
||||||
S: Into<Scalar>,
|
S: Into<Scalar>,
|
||||||
|
Loading…
Reference in New Issue
Block a user