From 8fc40594a7c75e5d3f63708ddc51954545869cbe Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 15 Feb 2023 11:57:38 +0100 Subject: [PATCH 1/3] Implement `AddAssign` for `Point` --- crates/fj-math/src/point.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/fj-math/src/point.rs b/crates/fj-math/src/point.rs index d52997974..83b06f63a 100644 --- a/crates/fj-math/src/point.rs +++ b/crates/fj-math/src/point.rs @@ -164,6 +164,15 @@ where } } +impl ops::AddAssign for Point +where + V: Into>, +{ + fn add_assign(&mut self, rhs: V) { + *self = *self + rhs; + } +} + impl ops::Sub for Point where V: Into>, From f00be2b29002c12fe7606b4e112281e244de8419 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 15 Feb 2023 11:57:55 +0100 Subject: [PATCH 2/3] Update `Line::reverse` to reverse "in-place" --- crates/fj-math/src/line.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fj-math/src/line.rs b/crates/fj-math/src/line.rs index c2a6c513f..c46821983 100644 --- a/crates/fj-math/src/line.rs +++ b/crates/fj-math/src/line.rs @@ -115,6 +115,7 @@ impl Line { /// Create a new instance that is reversed #[must_use] pub fn reverse(mut self) -> Self { + self.origin += self.direction; self.direction = -self.direction; self } From b4c1775234a206015fd692bb713fc50bdc275bd6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 15 Feb 2023 14:39:36 +0100 Subject: [PATCH 3/3] Implement `MulAssign` for `Vector` --- crates/fj-math/src/vector.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/fj-math/src/vector.rs b/crates/fj-math/src/vector.rs index 9dd6d57ce..d30bd745f 100644 --- a/crates/fj-math/src/vector.rs +++ b/crates/fj-math/src/vector.rs @@ -323,6 +323,15 @@ where } } +impl ops::MulAssign for Vector +where + S: Into, +{ + fn mul_assign(&mut self, rhs: S) { + *self = *self * rhs; + } +} + impl ops::Div for Vector where S: Into,