diff options
Diffstat (limited to 'src/f32/vec3.rs')
-rw-r--r-- | src/f32/vec3.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/f32/vec3.rs b/src/f32/vec3.rs index b049ed8..2838a63 100644 --- a/src/f32/vec3.rs +++ b/src/f32/vec3.rs @@ -306,6 +306,16 @@ impl Vec3 { } } + /// 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), + z: self.z.copysign(rhs.z), + } + } + /// Returns a bitmask with the lowest 3 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 |