aboutsummaryrefslogtreecommitdiff
path: root/src/f64/dvec2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/f64/dvec2.rs')
-rw-r--r--src/f64/dvec2.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/f64/dvec2.rs b/src/f64/dvec2.rs
index c20404b..c52356e 100644
--- a/src/f64/dvec2.rs
+++ b/src/f64/dvec2.rs
@@ -264,6 +264,15 @@ impl DVec2 {
}
}
+ /// Returns a vector with signs of `rhs` and the magnitudes of `self`.
+ #[inline]
+ pub fn copysign(self, rhs: Self) -> Self {
+ Self {
+ x: self.x.copysign(rhs.x),
+ y: self.y.copysign(rhs.y),
+ }
+ }
+
/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`.
///
/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes