diff options
Diffstat (limited to 'src/f32/vec2.rs')
-rw-r--r-- | src/f32/vec2.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/f32/vec2.rs b/src/f32/vec2.rs index 16bd17d..fc92447 100644 --- a/src/f32/vec2.rs +++ b/src/f32/vec2.rs @@ -264,6 +264,15 @@ impl Vec2 { } } + /// 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 |