| 1 | // Generated from quat.rs.tera template. Edit the template, not the generated file. |
| 2 | |
| 3 | use craterust-analyzer cargo glam 0.27.0 crate/::{ |
| 4 | eulerrust-analyzer cargo glam 0.27.0 euler/::{EulerFromQuaternionrust-analyzer cargo glam 0.27.0 euler/EulerFromQuaternion#, EulerRotrust-analyzer cargo glam 0.27.0 euler/EulerRot#, EulerToQuaternionrust-analyzer cargo glam 0.27.0 euler/EulerToQuaternion#}, |
| 5 | f32rust-analyzer cargo glam 0.27.0 f32/::mathrust-analyzer cargo glam 0.27.0 f32/math/, |
| 6 | sse2rust-analyzer cargo glam 0.27.0 sse2/::*, |
| 7 | DQuatrust-analyzer cargo glam 0.27.0 f64/dquat/DQuat#, Mat3rust-analyzer cargo glam 0.27.0 f32/mat3/Mat3#, Mat3Arust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#, Mat4rust-analyzer cargo glam 0.27.0 f32/sse2/mat4/Mat4#, Vec2rust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#, Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#, Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#, |
| 8 | }; |
| 9 | |
| 10 | #[cfg(target_arch = "x86")] |
| 11 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86::*; |
| 12 | #[cfg(target_arch = "x86_64")] |
| 13 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86_64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/arch/x86_64/::*; |
| 14 | |
| 15 | #[cfg(not(target_arch = "spirv"))] |
| 16 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/; |
| 17 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{Productrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Product#, Sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Sum#}; |
| 18 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#, DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut#, Divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#, Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#}; |
| 19 | |
| 20 | #[repr(C)] |
| 21 | union UnionCastrust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast# { |
| 22 | arust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast#a.: [f32; 4], |
| 23 | vrust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast#v.: Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#, |
| 24 | } |
| 25 | |
| 26 | /// Creates a quaternion from `x`, `y`, `z` and `w` values. |
| 27 | /// |
| 28 | /// This should generally not be called manually unless you know what you are doing. Use |
| 29 | /// one of the other constructors instead such as `identity` or `from_axis_angle`. |
| 30 | #[inline] |
| 31 | #[must_use] |
| 32 | pub const fn quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/quat().(x: f32, y: f32, z: f32, w: f32) -> Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 33 | Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(x, y, z, w) |
| 34 | } |
| 35 | |
| 36 | /// A quaternion representing an orientation. |
| 37 | /// |
| 38 | /// This quaternion is intended to be of unit length but may denormalize due to |
| 39 | /// floating point "error creep" which can occur when successive quaternion |
| 40 | /// operations are applied. |
| 41 | /// |
| 42 | /// SIMD vector types are used for storage on supported platforms. |
| 43 | /// |
| 44 | /// This type is 16 byte aligned. |
| 45 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 46 | #[repr(transparent)] |
| 47 | pub struct Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#(pub(craterust-analyzer cargo glam 0.27.0 crate/) __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128#); |
| 48 | |
| 49 | impl Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 50 | /// All zeros. |
| 51 | const ZEROrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]ZERO.: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_arrayrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_array().([0.0; 4]); |
| 52 | |
| 53 | /// The identity quaternion. Corresponds to no rotation. |
| 54 | pub const IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY.: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(0.0, 0.0, 0.0, 1.0); |
| 55 | |
| 56 | /// All NANs. |
| 57 | pub const NANrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]NAN.: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_arrayrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_array().([f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN.; 4]); |
| 58 | |
| 59 | /// Creates a new rotation quaternion. |
| 60 | /// |
| 61 | /// This should generally not be called manually unless you know what you are doing. |
| 62 | /// Use one of the other constructors instead such as `identity` or `from_axis_angle`. |
| 63 | /// |
| 64 | /// `from_xyzw` is mostly used by unit tests and `serde` deserialization. |
| 65 | /// |
| 66 | /// # Preconditions |
| 67 | /// |
| 68 | /// This function does not check if the input is normalized, it is up to the user to |
| 69 | /// provide normalized input or to normalized the resulting quaternion. |
| 70 | #[inline(always)] |
| 71 | #[must_use] |
| 72 | pub const fn from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(x: f32, y: f32, z: f32, w: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 73 | unsafe { UnionCastrust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast# { arust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast#a.: [x, y, z, w] }.vrust-analyzer cargo glam 0.27.0 f32/sse2/quat/UnionCast#v. } |
| 74 | } |
| 75 | |
| 76 | /// Creates a rotation quaternion from an array. |
| 77 | /// |
| 78 | /// # Preconditions |
| 79 | /// |
| 80 | /// This function does not check if the input is normalized, it is up to the user to |
| 81 | /// provide normalized input or to normalized the resulting quaternion. |
| 82 | #[inline] |
| 83 | #[must_use] |
| 84 | pub const fn from_arrayrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_array().(a: [f32; 4]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 85 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 86 | } |
| 87 | |
| 88 | /// Creates a new rotation quaternion from a 4D vector. |
| 89 | /// |
| 90 | /// # Preconditions |
| 91 | /// |
| 92 | /// This function does not check if the input is normalized, it is up to the user to |
| 93 | /// provide normalized input or to normalized the resulting quaternion. |
| 94 | #[inline] |
| 95 | #[must_use] |
| 96 | pub const fn from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(v: Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 97 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat](v.0rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#0.) |
| 98 | } |
| 99 | |
| 100 | /// Creates a rotation quaternion from a slice. |
| 101 | /// |
| 102 | /// # Preconditions |
| 103 | /// |
| 104 | /// This function does not check if the input is normalized, it is up to the user to |
| 105 | /// provide normalized input or to normalized the resulting quaternion. |
| 106 | /// |
| 107 | /// # Panics |
| 108 | /// |
| 109 | /// Panics if `slice` length is less than 4. |
| 110 | #[inline] |
| 111 | #[must_use] |
| 112 | pub fn from_slicerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_slice().(slice: &[f32]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 113 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >= 4); |
| 114 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat](unsafe { _mm_loadu_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_loadu_ps().(slice.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().()) }) |
| 115 | } |
| 116 | |
| 117 | /// Writes the quaternion to an unaligned slice. |
| 118 | /// |
| 119 | /// # Panics |
| 120 | /// |
| 121 | /// Panics if `slice` length is less than 4. |
| 122 | #[inline] |
| 123 | pub fn write_to_slicerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]write_to_slice().(self, slice: &mut [f32]) { |
| 124 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >= 4); |
| 125 | unsafe { _mm_storeu_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_storeu_ps().(slice.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().(), self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.) } |
| 126 | } |
| 127 | |
| 128 | /// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). |
| 129 | /// |
| 130 | /// The axis must be a unit vector. |
| 131 | /// |
| 132 | /// # Panics |
| 133 | /// |
| 134 | /// Will panic if `axis` is not normalized when `glam_assert` is enabled. |
| 135 | #[inline] |
| 136 | #[must_use] |
| 137 | pub fn from_axis_anglerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_axis_angle().(axis: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, angle: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 138 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(axis.is_normalized()); |
| 139 | let (s, c) = mathrust-analyzer cargo glam 0.27.0 f32/math/::sin_cosrust-analyzer cargo glam 0.27.0 f32/math/std_math/sin_cos().(angle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().0.5); |
| 140 | let v = axis rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul().*rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul(). rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul().s; |
| 141 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(v.xrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#x., v.yrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#y., v.zrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#z., c) |
| 142 | } |
| 143 | |
| 144 | /// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. |
| 145 | /// |
| 146 | /// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. |
| 147 | #[inline] |
| 148 | #[must_use] |
| 149 | pub fn from_scaled_axisrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_scaled_axis().(v: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 150 | let length = v.lengthrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]length().(); |
| 151 | if length rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().0.0 { |
| 152 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY. |
| 153 | } else { |
| 154 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_axis_anglerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_axis_angle().(v rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div()./rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div(). rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div().length, length) |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// Creates a quaternion from the `angle` (in radians) around the x axis. |
| 159 | #[inline] |
| 160 | #[must_use] |
| 161 | pub fn from_rotation_xrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_x().(angle: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 162 | let (s, c) = mathrust-analyzer cargo glam 0.27.0 f32/math/::sin_cosrust-analyzer cargo glam 0.27.0 f32/math/std_math/sin_cos().(angle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().0.5); |
| 163 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(s, 0.0, 0.0, c) |
| 164 | } |
| 165 | |
| 166 | /// Creates a quaternion from the `angle` (in radians) around the y axis. |
| 167 | #[inline] |
| 168 | #[must_use] |
| 169 | pub fn from_rotation_yrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_y().(angle: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 170 | let (s, c) = mathrust-analyzer cargo glam 0.27.0 f32/math/::sin_cosrust-analyzer cargo glam 0.27.0 f32/math/std_math/sin_cos().(angle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().0.5); |
| 171 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(0.0, s, 0.0, c) |
| 172 | } |
| 173 | |
| 174 | /// Creates a quaternion from the `angle` (in radians) around the z axis. |
| 175 | #[inline] |
| 176 | #[must_use] |
| 177 | pub fn from_rotation_zrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_z().(angle: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 178 | let (s, c) = mathrust-analyzer cargo glam 0.27.0 f32/math/::sin_cosrust-analyzer cargo glam 0.27.0 f32/math/std_math/sin_cos().(angle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().0.5); |
| 179 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(0.0, 0.0, s, c) |
| 180 | } |
| 181 | |
| 182 | /// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). |
| 183 | #[inline] |
| 184 | #[must_use] |
| 185 | pub fn from_eulerrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_euler().(euler: EulerRotrust-analyzer cargo glam 0.27.0 euler/EulerRot#, a: f32, b: f32, c: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 186 | euler.new_quatrust-analyzer cargo glam 0.27.0 euler/impl#[EulerRot][`EulerToQuaternion<f32>`]new_quat().(a, b, c) |
| 187 | } |
| 188 | |
| 189 | /// From the columns of a 3x3 rotation matrix. |
| 190 | #[inline] |
| 191 | #[must_use] |
| 192 | pub(craterust-analyzer cargo glam 0.27.0 crate/) fn from_rotation_axesrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_axes().(x_axis: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, y_axis: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, z_axis: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 193 | // Based on https://github.com/microsoft/DirectXMath `XM$quaternionRotationMatrix` |
| 194 | let (m00, m01, m02) = x_axis.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 195 | let (m10, m11, m12) = y_axis.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 196 | let (m20, m21, m22) = z_axis.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 197 | if m22 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().0.0 { |
| 198 | // x^2 + y^2 >= z^2 + w^2 |
| 199 | let dif10 = m11 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m00; |
| 200 | let omm22 = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m22; |
| 201 | if dif10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().0.0 { |
| 202 | // x^2 >= y^2 |
| 203 | let four_xsq = omm22 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().dif10; |
| 204 | let inv4x = 0.5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().mathrust-analyzer cargo glam 0.27.0 f32/math/::sqrtrust-analyzer cargo glam 0.27.0 f32/math/std_math/sqrt().(four_xsq); |
| 205 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().( |
| 206 | four_xsq rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4x, |
| 207 | (m01 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m10) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4x, |
| 208 | (m02 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m20) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4x, |
| 209 | (m12 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m21) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4x, |
| 210 | ) |
| 211 | } else { |
| 212 | // y^2 >= x^2 |
| 213 | let four_ysq = omm22 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().dif10; |
| 214 | let inv4y = 0.5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().mathrust-analyzer cargo glam 0.27.0 f32/math/::sqrtrust-analyzer cargo glam 0.27.0 f32/math/std_math/sqrt().(four_ysq); |
| 215 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().( |
| 216 | (m01 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m10) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4y, |
| 217 | four_ysq rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4y, |
| 218 | (m12 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m21) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4y, |
| 219 | (m20 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m02) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4y, |
| 220 | ) |
| 221 | } |
| 222 | } else { |
| 223 | // z^2 + w^2 >= x^2 + y^2 |
| 224 | let sum10 = m11 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m00; |
| 225 | let opm22 = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m22; |
| 226 | if sum10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().0.0 { |
| 227 | // z^2 >= w^2 |
| 228 | let four_zsq = opm22 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().sum10; |
| 229 | let inv4z = 0.5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().mathrust-analyzer cargo glam 0.27.0 f32/math/::sqrtrust-analyzer cargo glam 0.27.0 f32/math/std_math/sqrt().(four_zsq); |
| 230 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().( |
| 231 | (m02 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m20) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4z, |
| 232 | (m12 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().m21) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4z, |
| 233 | four_zsq rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4z, |
| 234 | (m01 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m10) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4z, |
| 235 | ) |
| 236 | } else { |
| 237 | // w^2 >= z^2 |
| 238 | let four_wsq = opm22 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().sum10; |
| 239 | let inv4w = 0.5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().mathrust-analyzer cargo glam 0.27.0 f32/math/::sqrtrust-analyzer cargo glam 0.27.0 f32/math/std_math/sqrt().(four_wsq); |
| 240 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().( |
| 241 | (m12 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m21) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4w, |
| 242 | (m20 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m02) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4w, |
| 243 | (m01 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().m10) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4w, |
| 244 | four_wsq rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().inv4w, |
| 245 | ) |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /// Creates a quaternion from a 3x3 rotation matrix. |
| 251 | #[inline] |
| 252 | #[must_use] |
| 253 | pub fn from_mat3rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_mat3().(mat: &Mat3rust-analyzer cargo glam 0.27.0 f32/mat3/Mat3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 254 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_axesrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_axes().(mat.x_axisrust-analyzer cargo glam 0.27.0 f32/mat3/Mat3#x_axis., mat.y_axisrust-analyzer cargo glam 0.27.0 f32/mat3/Mat3#y_axis., mat.z_axisrust-analyzer cargo glam 0.27.0 f32/mat3/Mat3#z_axis.) |
| 255 | } |
| 256 | |
| 257 | /// Creates a quaternion from a 3x3 SIMD aligned rotation matrix. |
| 258 | #[inline] |
| 259 | #[must_use] |
| 260 | pub fn from_mat3arust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_mat3a().(mat: &Mat3Arust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 261 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_axesrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_axes().(mat.x_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#x_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), mat.y_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#y_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), mat.z_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#z_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 262 | } |
| 263 | |
| 264 | /// Creates a quaternion from a 3x3 rotation matrix inside a homogeneous 4x4 matrix. |
| 265 | #[inline] |
| 266 | #[must_use] |
| 267 | pub fn from_mat4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_mat4().(mat: &Mat4rust-analyzer cargo glam 0.27.0 f32/sse2/mat4/Mat4#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 268 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_axesrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_axes().( |
| 269 | mat.x_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat4/Mat4#x_axis..truncaterust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]truncate().(), |
| 270 | mat.y_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat4/Mat4#y_axis..truncaterust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]truncate().(), |
| 271 | mat.z_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat4/Mat4#z_axis..truncaterust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]truncate().(), |
| 272 | ) |
| 273 | } |
| 274 | |
| 275 | /// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the |
| 276 | /// plane spanned by the two vectors. Will rotate at most 180 degrees. |
| 277 | /// |
| 278 | /// The inputs must be unit vectors. |
| 279 | /// |
| 280 | /// `from_rotation_arc(from, to) * from ≈ to`. |
| 281 | /// |
| 282 | /// For near-singular cases (from≈to and from≈-to) the current implementation |
| 283 | /// is only accurate to about 0.001 (for `f32`). |
| 284 | /// |
| 285 | /// # Panics |
| 286 | /// |
| 287 | /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. |
| 288 | #[must_use] |
| 289 | pub fn from_rotation_arcrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_arc().(from: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, to: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 290 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(from.is_normalized()); |
| 291 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(to.is_normalized()); |
| 292 | |
| 293 | const ONE_MINUS_EPSrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPS.: f32 = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::f32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/::EPSILONrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/EPSILON.; |
| 294 | let dot = from.dotrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]dot().(to); |
| 295 | if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().ONE_MINUS_EPSrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPS. { |
| 296 | // 0° singularity: from ≈ to |
| 297 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY. |
| 298 | } else if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().ONE_MINUS_EPSrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPS. { |
| 299 | // 180° singularity: from ≈ -to |
| 300 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::f32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/::constsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/::PIrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/PI.; // half a turn = 𝛕/2 = 180° |
| 301 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_axis_anglerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_axis_angle().(from.any_orthonormal_vectorrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]any_orthonormal_vector().(), PIrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/PI.) |
| 302 | } else { |
| 303 | let c = from.crossrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]cross().(to); |
| 304 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(c.xrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#x., c.yrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#y., c.zrust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#z., 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().dot).normalizerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]normalize().() |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means |
| 309 | /// that the resulting quaternion will rotate `from` so that it is colinear with `to`. |
| 310 | /// |
| 311 | /// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 |
| 312 | /// degrees. |
| 313 | /// |
| 314 | /// The inputs must be unit vectors. |
| 315 | /// |
| 316 | /// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. |
| 317 | /// |
| 318 | /// # Panics |
| 319 | /// |
| 320 | /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. |
| 321 | #[inline] |
| 322 | #[must_use] |
| 323 | pub fn from_rotation_arc_colinearrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_arc_colinear().(from: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, to: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 324 | if from.dotrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]dot().(to) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().0.0 { |
| 325 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_arcrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_arc().(from, -rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][Neg]neg().to) |
| 326 | } else { |
| 327 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_arcrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_arc().(from, to) |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | /// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is |
| 332 | /// around the z axis. Will rotate at most 180 degrees. |
| 333 | /// |
| 334 | /// The inputs must be unit vectors. |
| 335 | /// |
| 336 | /// `from_rotation_arc_2d(from, to) * from ≈ to`. |
| 337 | /// |
| 338 | /// For near-singular cases (from≈to and from≈-to) the current implementation |
| 339 | /// is only accurate to about 0.001 (for `f32`). |
| 340 | /// |
| 341 | /// # Panics |
| 342 | /// |
| 343 | /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. |
| 344 | #[must_use] |
| 345 | pub fn from_rotation_arc_2drust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_arc_2d().(from: Vec2rust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#, to: Vec2rust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 346 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(from.is_normalized()); |
| 347 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(to.is_normalized()); |
| 348 | |
| 349 | const ONE_MINUS_EPSILONrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPSILON.: f32 = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::f32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/::EPSILONrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/EPSILON.; |
| 350 | let dot = from.dotrust-analyzer cargo glam 0.27.0 f32/vec2/impl#[Vec2]dot().(to); |
| 351 | if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().ONE_MINUS_EPSILONrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPSILON. { |
| 352 | // 0° singularity: from ≈ to |
| 353 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY. |
| 354 | } else if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().ONE_MINUS_EPSILONrust-analyzer cargo glam 0.27.0 f32/sse2/quat/ONE_MINUS_EPSILON. { |
| 355 | // 180° singularity: from ≈ -to |
| 356 | const COS_FRAC_PI_2rust-analyzer cargo glam 0.27.0 f32/sse2/quat/COS_FRAC_PI_2.: f32 = 0.0; |
| 357 | const SIN_FRAC_PI_2rust-analyzer cargo glam 0.27.0 f32/sse2/quat/SIN_FRAC_PI_2.: f32 = 1.0; |
| 358 | // rotation around z by PI radians |
| 359 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(0.0, 0.0, SIN_FRAC_PI_2rust-analyzer cargo glam 0.27.0 f32/sse2/quat/SIN_FRAC_PI_2., COS_FRAC_PI_2rust-analyzer cargo glam 0.27.0 f32/sse2/quat/COS_FRAC_PI_2.) |
| 360 | } else { |
| 361 | // vector3 cross where z=0 |
| 362 | let z = from.xrust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().to.yrust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().to.xrust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().from.yrust-analyzer cargo glam 0.27.0 f32/vec2/Vec2#y.; |
| 363 | let w = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().dot; |
| 364 | // calculate length with x=0 and y=0 to normalize |
| 365 | let len_rcp = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().mathrust-analyzer cargo glam 0.27.0 f32/math/::sqrtrust-analyzer cargo glam 0.27.0 f32/math/std_math/sqrt().(z rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().w); |
| 366 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_xyzwrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_xyzw().(0.0, 0.0, z rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().len_rcp, w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().len_rcp) |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /// Returns the rotation axis (normalized) and angle (in radians) of `self`. |
| 371 | #[inline] |
| 372 | #[must_use] |
| 373 | pub fn to_axis_anglerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]to_axis_angle().(self) -> (Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#, f32) { |
| 374 | const EPSILONrust-analyzer cargo glam 0.27.0 f32/sse2/quat/EPSILON.: f32 = 1.0e-8; |
| 375 | let v = Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#::newrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]new().(self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x., self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y., self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z.); |
| 376 | let length = v.lengthrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]length().(); |
| 377 | if length rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]ge().EPSILONrust-analyzer cargo glam 0.27.0 f32/sse2/quat/EPSILON. { |
| 378 | let angle = 2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().mathrust-analyzer cargo glam 0.27.0 f32/math/::atan2rust-analyzer cargo glam 0.27.0 f32/math/std_math/atan2().(length, self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w.); |
| 379 | let axis = v rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div()./rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div(). rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Div<f32>`]div().length; |
| 380 | (axis, angle) |
| 381 | } else { |
| 382 | (Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#::Xrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]X., 0.0) |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | /// Returns the rotation axis scaled by the rotation in radians. |
| 387 | #[inline] |
| 388 | #[must_use] |
| 389 | pub fn to_scaled_axisrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]to_scaled_axis().(self) -> Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3# { |
| 390 | let (axis, angle) = self.to_axis_anglerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]to_axis_angle().(); |
| 391 | axis rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul().*rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul(). rust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3][`Mul<f32>`]mul().angle |
| 392 | } |
| 393 | |
| 394 | /// Returns the rotation angles for the given euler rotation sequence. |
| 395 | #[inline] |
| 396 | #[must_use] |
| 397 | pub fn to_eulerrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]to_euler().(self, euler: EulerRotrust-analyzer cargo glam 0.27.0 euler/EulerRot#) -> (f32, f32, f32) { |
| 398 | euler.convert_quatrust-analyzer cargo glam 0.27.0 euler/impl#[EulerRot][`EulerFromQuaternion<Quat>`]convert_quat().(self) |
| 399 | } |
| 400 | |
| 401 | /// `[x, y, z, w]` |
| 402 | #[inline] |
| 403 | #[must_use] |
| 404 | pub fn to_arrayrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]to_array().(&self) -> [f32; 4] { |
| 405 | [self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x., self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y., self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z., self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w.] |
| 406 | } |
| 407 | |
| 408 | /// Returns the vector part of the quaternion. |
| 409 | #[inline] |
| 410 | #[must_use] |
| 411 | pub fn xyzrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]xyz().(self) -> Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3# { |
| 412 | Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#::newrust-analyzer cargo glam 0.27.0 f32/vec3/impl#[Vec3]new().(self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x., self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y., self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z.) |
| 413 | } |
| 414 | |
| 415 | /// Returns the quaternion conjugate of `self`. For a unit quaternion the |
| 416 | /// conjugate is also the inverse. |
| 417 | #[inline] |
| 418 | #[must_use] |
| 419 | pub fn conjugaterust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]conjugate().(self) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 420 | const SIGNrust-analyzer cargo glam 0.27.0 f32/sse2/quat/SIGN.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0, 0.0]); |
| 421 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat](unsafe { _mm_xor_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_xor_ps().(self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0., SIGNrust-analyzer cargo glam 0.27.0 f32/sse2/quat/SIGN.) }) |
| 422 | } |
| 423 | |
| 424 | /// Returns the inverse of a normalized quaternion. |
| 425 | /// |
| 426 | /// Typically quaternion inverse returns the conjugate of a normalized quaternion. |
| 427 | /// Because `self` is assumed to already be unit length this method *does not* normalize |
| 428 | /// before returning the conjugate. |
| 429 | /// |
| 430 | /// # Panics |
| 431 | /// |
| 432 | /// Will panic if `self` is not normalized when `glam_assert` is enabled. |
| 433 | #[inline] |
| 434 | #[must_use] |
| 435 | pub fn inverserust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]inverse().(self) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 436 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized()); |
| 437 | self.conjugaterust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]conjugate().() |
| 438 | } |
| 439 | |
| 440 | /// Computes the dot product of `self` and `rhs`. The dot product is |
| 441 | /// equal to the cosine of the angle between two quaternion rotations. |
| 442 | #[inline] |
| 443 | #[must_use] |
| 444 | pub fn dotrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]dot().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]) -> f32 { |
| 445 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).dotrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]dot().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(rhs)) |
| 446 | } |
| 447 | |
| 448 | /// Computes the length of `self`. |
| 449 | #[doc(alias = "magnitude")] |
| 450 | #[inline] |
| 451 | #[must_use] |
| 452 | pub fn lengthrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]length().(self) -> f32 { |
| 453 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).lengthrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]length().() |
| 454 | } |
| 455 | |
| 456 | /// Computes the squared length of `self`. |
| 457 | /// |
| 458 | /// This is generally faster than `length()` as it avoids a square |
| 459 | /// root operation. |
| 460 | #[doc(alias = "magnitude2")] |
| 461 | #[inline] |
| 462 | #[must_use] |
| 463 | pub fn length_squaredrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]length_squared().(self) -> f32 { |
| 464 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).length_squaredrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]length_squared().() |
| 465 | } |
| 466 | |
| 467 | /// Computes `1.0 / length()`. |
| 468 | /// |
| 469 | /// For valid results, `self` must _not_ be of length zero. |
| 470 | #[inline] |
| 471 | #[must_use] |
| 472 | pub fn length_reciprust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]length_recip().(self) -> f32 { |
| 473 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).length_reciprust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]length_recip().() |
| 474 | } |
| 475 | |
| 476 | /// Returns `self` normalized to length 1.0. |
| 477 | /// |
| 478 | /// For valid results, `self` must _not_ be of length zero. |
| 479 | /// |
| 480 | /// Panics |
| 481 | /// |
| 482 | /// Will panic if `self` is zero length when `glam_assert` is enabled. |
| 483 | #[inline] |
| 484 | #[must_use] |
| 485 | pub fn normalizerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]normalize().(self) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 486 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).normalizerust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]normalize().()) |
| 487 | } |
| 488 | |
| 489 | /// Returns `true` if, and only if, all elements are finite. |
| 490 | /// If any element is either `NaN`, positive or negative infinity, this will return `false`. |
| 491 | #[inline] |
| 492 | #[must_use] |
| 493 | pub fn is_finiterust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]is_finite().(self) -> bool { |
| 494 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).is_finiterust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]is_finite().() |
| 495 | } |
| 496 | |
| 497 | #[inline] |
| 498 | #[must_use] |
| 499 | pub fn is_nanrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]is_nan().(self) -> bool { |
| 500 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).is_nanrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]is_nan().() |
| 501 | } |
| 502 | |
| 503 | /// Returns whether `self` of length `1.0` or not. |
| 504 | /// |
| 505 | /// Uses a precision threshold of `1e-6`. |
| 506 | #[inline] |
| 507 | #[must_use] |
| 508 | pub fn is_normalizedrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]is_normalized().(self) -> bool { |
| 509 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).is_normalizedrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]is_normalized().() |
| 510 | } |
| 511 | |
| 512 | #[inline] |
| 513 | #[must_use] |
| 514 | pub fn is_near_identityrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]is_near_identity().(self) -> bool { |
| 515 | // Based on https://github.com/nfrechette/rtm `rtm::quat_near_identity` |
| 516 | let threshold_angle = 0.002_847_144_6; |
| 517 | // Because of floating point precision, we cannot represent very small rotations. |
| 518 | // The closest f32 to 1.0 that is not 1.0 itself yields: |
| 519 | // 0.99999994.acos() * 2.0 = 0.000690533954 rad |
| 520 | // |
| 521 | // An error threshold of 1.e-6 is used by default. |
| 522 | // (1.0 - 1.e-6).acos() * 2.0 = 0.00284714461 rad |
| 523 | // (1.0 - 1.e-7).acos() * 2.0 = 0.00097656250 rad |
| 524 | // |
| 525 | // We don't really care about the angle value itself, only if it's close to 0. |
| 526 | // This will happen whenever quat.w is close to 1.0. |
| 527 | // If the quat.w is close to -1.0, the angle will be near 2*PI which is close to |
| 528 | // a negative 0 rotation. By forcing quat.w to be positive, we'll end up with |
| 529 | // the shortest path. |
| 530 | let positive_w_angle = mathrust-analyzer cargo glam 0.27.0 f32/math/::acos_approxrust-analyzer cargo glam 0.27.0 f32/math/std_math/acos_approx().(mathrust-analyzer cargo glam 0.27.0 f32/math/::absrust-analyzer cargo glam 0.27.0 f32/math/std_math/abs().(self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w.)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().2.0; |
| 531 | positive_w_angle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().threshold_angle |
| 532 | } |
| 533 | |
| 534 | /// Returns the angle (in radians) for the minimal rotation |
| 535 | /// for transforming this quaternion into another. |
| 536 | /// |
| 537 | /// Both quaternions must be normalized. |
| 538 | /// |
| 539 | /// # Panics |
| 540 | /// |
| 541 | /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. |
| 542 | #[inline] |
| 543 | #[must_use] |
| 544 | pub fn angle_betweenrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]angle_between().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]) -> f32 { |
| 545 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized() && rhs.is_normalized()); |
| 546 | mathrust-analyzer cargo glam 0.27.0 f32/math/::acos_approxrust-analyzer cargo glam 0.27.0 f32/math/std_math/acos_approx().(mathrust-analyzer cargo glam 0.27.0 f32/math/::absrust-analyzer cargo glam 0.27.0 f32/math/std_math/abs().(self.dotrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]dot().(rhs))) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().2.0 |
| 547 | } |
| 548 | |
| 549 | /// Returns true if the absolute difference of all elements between `self` and `rhs` |
| 550 | /// is less than or equal to `max_abs_diff`. |
| 551 | /// |
| 552 | /// This can be used to compare if two quaternions contain similar elements. It works |
| 553 | /// best when comparing with a known value. The `max_abs_diff` that should be used used |
| 554 | /// depends on the values being compared against. |
| 555 | /// |
| 556 | /// For more see |
| 557 | /// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). |
| 558 | #[inline] |
| 559 | #[must_use] |
| 560 | pub fn abs_diff_eqrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]abs_diff_eq().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat], max_abs_diff: f32) -> bool { |
| 561 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self).abs_diff_eqrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4]abs_diff_eq().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(rhs), max_abs_diff) |
| 562 | } |
| 563 | |
| 564 | /// Performs a linear interpolation between `self` and `rhs` based on |
| 565 | /// the value `s`. |
| 566 | /// |
| 567 | /// When `s` is `0.0`, the result will be equal to `self`. When `s` |
| 568 | /// is `1.0`, the result will be equal to `rhs`. |
| 569 | /// |
| 570 | /// # Panics |
| 571 | /// |
| 572 | /// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. |
| 573 | #[doc(alias = "mix")] |
| 574 | #[inline] |
| 575 | #[must_use] |
| 576 | pub fn lerprust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]lerp().(self, end: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat], s: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 577 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized()); |
| 578 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(end.is_normalized()); |
| 579 | |
| 580 | const NEG_ZEROrust-analyzer cargo glam 0.27.0 f32/sse2/quat/NEG_ZERO.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0; 4]); |
| 581 | let start = self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.; |
| 582 | let end = end.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.; |
| 583 | unsafe { |
| 584 | let dot = dot4_into_m128rust-analyzer cargo glam 0.27.0 sse2/dot4_into_m128().(start, end); |
| 585 | // Calculate the bias, if the dot product is positive or zero, there is no bias |
| 586 | // but if it is negative, we want to flip the 'end' rotation XYZW components |
| 587 | let bias = _mm_and_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_and_ps().(dot, NEG_ZEROrust-analyzer cargo glam 0.27.0 f32/sse2/quat/NEG_ZERO.); |
| 588 | let interpolated = _mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().( |
| 589 | _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(_mm_sub_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_sub_ps().(_mm_xor_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_xor_ps().(end, bias), start), _mm_set_ps1rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_set_ps1().(s)), |
| 590 | start, |
| 591 | ); |
| 592 | Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#(interpolated).normalizerust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]normalize().() |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | /// Performs a spherical linear interpolation between `self` and `end` |
| 597 | /// based on the value `s`. |
| 598 | /// |
| 599 | /// When `s` is `0.0`, the result will be equal to `self`. When `s` |
| 600 | /// is `1.0`, the result will be equal to `end`. |
| 601 | /// |
| 602 | /// # Panics |
| 603 | /// |
| 604 | /// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. |
| 605 | #[inline] |
| 606 | #[must_use] |
| 607 | pub fn slerprust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]slerp().(self, mut end: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat], s: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 608 | // http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/ |
| 609 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized()); |
| 610 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(end.is_normalized()); |
| 611 | |
| 612 | const DOT_THRESHOLDrust-analyzer cargo glam 0.27.0 f32/sse2/quat/DOT_THRESHOLD.: f32 = 0.9995; |
| 613 | |
| 614 | // Note that a rotation can be represented by two quaternions: `q` and |
| 615 | // `-q`. The slerp path between `q` and `end` will be different from the |
| 616 | // path between `-q` and `end`. One path will take the long way around and |
| 617 | // one will take the short way. In order to correct for this, the `dot` |
| 618 | // product between `self` and `end` should be positive. If the `dot` |
| 619 | // product is negative, slerp between `self` and `-end`. |
| 620 | let mut dot = self.dotrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]dot().(end); |
| 621 | if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]lt().0.0 { |
| 622 | end = -rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Neg]neg().end; |
| 623 | dot = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().dot; |
| 624 | } |
| 625 | |
| 626 | if dot rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]gt().DOT_THRESHOLDrust-analyzer cargo glam 0.27.0 f32/sse2/quat/DOT_THRESHOLD. { |
| 627 | // assumes lerp returns a normalized quaternion |
| 628 | self.lerprust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]lerp().(end, s) |
| 629 | } else { |
| 630 | let theta = mathrust-analyzer cargo glam 0.27.0 f32/math/::acos_approxrust-analyzer cargo glam 0.27.0 f32/math/std_math/acos_approx().(dot); |
| 631 | |
| 632 | let x = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().s; |
| 633 | let y = s; |
| 634 | let z = 1.0; |
| 635 | |
| 636 | unsafe { |
| 637 | let tmp = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(_mm_set_ps1rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_set_ps1().(theta), _mm_set_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_set_ps().(0.0, z, y, x)); |
| 638 | let tmp = m128_sinrust-analyzer cargo glam 0.27.0 sse2/m128_sin().(tmp); |
| 639 | |
| 640 | let scale1 = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(tmp, tmp, 0b00_00_00_00); |
| 641 | let scale2 = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(tmp, tmp, 0b01_01_01_01); |
| 642 | let theta_sin = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(tmp, tmp, 0b10_10_10_10); |
| 643 | |
| 644 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat](_mm_div_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_div_ps().( |
| 645 | _mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().(_mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0., scale1), _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(end.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0., scale2)), |
| 646 | theta_sin, |
| 647 | )) |
| 648 | } |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | /// Multiplies a quaternion and a 3D vector, returning the rotated vector. |
| 653 | /// |
| 654 | /// # Panics |
| 655 | /// |
| 656 | /// Will panic if `self` is not normalized when `glam_assert` is enabled. |
| 657 | #[inline] |
| 658 | #[must_use] |
| 659 | pub fn mul_vec3rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_vec3().(self, rhs: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3# { |
| 660 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized()); |
| 661 | |
| 662 | self.mul_vec3arust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_vec3a().(rhs.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 663 | } |
| 664 | |
| 665 | /// Multiplies two quaternions. If they each represent a rotation, the result will |
| 666 | /// represent the combined rotation. |
| 667 | /// |
| 668 | /// Note that due to floating point rounding the result may not be perfectly normalized. |
| 669 | /// |
| 670 | /// # Panics |
| 671 | /// |
| 672 | /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. |
| 673 | #[inline] |
| 674 | #[must_use] |
| 675 | pub fn mul_quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_quat().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 676 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(self.is_normalized()); |
| 677 | glam_assertrust-analyzer cargo glam 0.27.0 macros/glam_assert!!(rhs.is_normalized()); |
| 678 | |
| 679 | // Based on https://github.com/nfrechette/rtm `rtm::quat_mul` |
| 680 | const CONTROL_WZYXrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_WZYX.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0, 1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0]); |
| 681 | const CONTROL_ZWXYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_ZWXY.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([1.0, 1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0]); |
| 682 | const CONTROL_YXWZrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_YXWZ.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0, 1.0, 1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0]); |
| 683 | |
| 684 | let lhs = self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.; |
| 685 | let rhs = rhs.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.; |
| 686 | |
| 687 | unsafe { |
| 688 | let r_xxxx = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(lhs, lhs, 0b00_00_00_00); |
| 689 | let r_yyyy = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(lhs, lhs, 0b01_01_01_01); |
| 690 | let r_zzzz = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(lhs, lhs, 0b10_10_10_10); |
| 691 | let r_wwww = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(lhs, lhs, 0b11_11_11_11); |
| 692 | |
| 693 | let lxrw_lyrw_lzrw_lwrw = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(r_wwww, rhs); |
| 694 | let l_wzyx = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(rhs, rhs, 0b00_01_10_11); |
| 695 | |
| 696 | let lwrx_lzrx_lyrx_lxrx = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(r_xxxx, l_wzyx); |
| 697 | let l_zwxy = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(l_wzyx, l_wzyx, 0b10_11_00_01); |
| 698 | |
| 699 | let lwrx_nlzrx_lyrx_nlxrx = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(lwrx_lzrx_lyrx_lxrx, CONTROL_WZYXrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_WZYX.); |
| 700 | |
| 701 | let lzry_lwry_lxry_lyry = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(r_yyyy, l_zwxy); |
| 702 | let l_yxwz = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(l_zwxy, l_zwxy, 0b00_01_10_11); |
| 703 | |
| 704 | let lzry_lwry_nlxry_nlyry = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(lzry_lwry_lxry_lyry, CONTROL_ZWXYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_ZWXY.); |
| 705 | |
| 706 | let lyrz_lxrz_lwrz_lzrz = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(r_zzzz, l_yxwz); |
| 707 | let result0 = _mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().(lxrw_lyrw_lzrw_lwrw, lwrx_nlzrx_lyrx_nlxrx); |
| 708 | |
| 709 | let nlyrz_lxrz_lwrz_wlzrz = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(lyrz_lxrz_lwrz_lzrz, CONTROL_YXWZrust-analyzer cargo glam 0.27.0 f32/sse2/quat/CONTROL_YXWZ.); |
| 710 | let result1 = _mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().(lzry_lwry_nlxry_nlyry, nlyrz_lxrz_lwrz_wlzrz); |
| 711 | |
| 712 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat](_mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().(result0, result1)) |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | /// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. |
| 717 | #[inline] |
| 718 | #[must_use] |
| 719 | pub fn from_affine3rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_affine3().(a: &craterust-analyzer cargo glam 0.27.0 crate/::Affine3Arust-analyzer cargo glam 0.27.0 f32/affine3a/Affine3A#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat] { |
| 720 | #[allow(clippy::useless_conversion)] |
| 721 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]::from_rotation_axesrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_rotation_axes().( |
| 722 | a.matrix3rust-analyzer cargo glam 0.27.0 f32/affine3a/Affine3A#matrix3..x_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#x_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 723 | a.matrix3rust-analyzer cargo glam 0.27.0 f32/affine3a/Affine3A#matrix3..y_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#y_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 724 | a.matrix3rust-analyzer cargo glam 0.27.0 f32/affine3a/Affine3A#matrix3..z_axisrust-analyzer cargo glam 0.27.0 f32/sse2/mat3a/Mat3A#z_axis..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 725 | ) |
| 726 | } |
| 727 | |
| 728 | /// Multiplies a quaternion and a 3D vector, returning the rotated vector. |
| 729 | #[inline] |
| 730 | #[must_use] |
| 731 | pub fn mul_vec3arust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_vec3a().(self, rhs: Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#) -> Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A# { |
| 732 | unsafe { |
| 733 | const TWOrust-analyzer cargo glam 0.27.0 f32/sse2/quat/TWO.: __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# = m128_from_f32x4rust-analyzer cargo glam 0.27.0 sse2/m128_from_f32x4().([2.0; 4]); |
| 734 | let w = _mm_shuffle_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_shuffle_ps().(self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0., self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0., 0b11_11_11_11); |
| 735 | let b = self.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.; |
| 736 | let b2 = dot3_into_m128rust-analyzer cargo glam 0.27.0 sse2/dot3_into_m128().(b, b); |
| 737 | Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#(_mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().( |
| 738 | _mm_add_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_add_ps().( |
| 739 | _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(rhs.0rust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#0., _mm_sub_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_sub_ps().(_mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(w, w), b2)), |
| 740 | _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(b, _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(dot3_into_m128rust-analyzer cargo glam 0.27.0 sse2/dot3_into_m128().(rhs.0rust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#0., b), TWOrust-analyzer cargo glam 0.27.0 f32/sse2/quat/TWO.)), |
| 741 | ), |
| 742 | _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#(b).crossrust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/impl#[Vec3A]cross().(rhs).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(w, TWOrust-analyzer cargo glam 0.27.0 f32/sse2/quat/TWO.)), |
| 743 | )) |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | #[inline] |
| 748 | #[must_use] |
| 749 | pub fn as_dquatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]as_dquat().(self) -> DQuatrust-analyzer cargo glam 0.27.0 f64/dquat/DQuat# { |
| 750 | DQuatrust-analyzer cargo glam 0.27.0 f64/dquat/DQuat#::from_xyzwrust-analyzer cargo glam 0.27.0 f64/dquat/impl#[DQuat]from_xyzw().(self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x. as f64, self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y. as f64, self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z. as f64, self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w. as f64) |
| 751 | } |
| 752 | |
| 753 | #[inline] |
| 754 | #[must_use] |
| 755 | #[deprecated(since = "0.24.2", note = "Use as_dquat() instead")] |
| 756 | pub fn as_f64rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]as_f64().(self) -> DQuatrust-analyzer cargo glam 0.27.0 f64/dquat/DQuat# { |
| 757 | self.as_dquatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]as_dquat().() |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | #[cfg(not(target_arch = "spirv"))] |
| 762 | impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 763 | fn fmtrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Debug]fmt().(&self, fmt: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 764 | fmt.debug_tuplerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_tuple().(stringifyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/stringify!!(Quat)) |
| 765 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x.) |
| 766 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y.) |
| 767 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z.) |
| 768 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]field().(&self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w.) |
| 769 | .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugTuple<'a, 'b>`]finish().() |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | #[cfg(not(target_arch = "spirv"))] |
| 774 | impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 775 | fn fmtrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 776 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(p) = f.precisionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]precision().() { |
| 777 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 778 | f, |
| 779 | "[{:.*}, {:.*}, {:.*}, {:.*}]", |
| 780 | p, self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x., p, self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y., p, self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z., p, self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w. |
| 781 | ) |
| 782 | } else { |
| 783 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "[{}, {}, {}, {}]", self.xrust-analyzer cargo glam 0.27.0 deref/Vec4#x., self.yrust-analyzer cargo glam 0.27.0 deref/Vec4#y., self.zrust-analyzer cargo glam 0.27.0 deref/Vec4#z., self.wrust-analyzer cargo glam 0.27.0 deref/Vec4#w.) |
| 784 | } |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | impl Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 789 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]; |
| 790 | /// Adds two quaternions. |
| 791 | /// |
| 792 | /// The sum is not guaranteed to be normalized. |
| 793 | /// |
| 794 | /// Note that addition is not the same as combining the rotations represented by the |
| 795 | /// two quaternions! That corresponds to multiplication. |
| 796 | #[inline] |
| 797 | fn addrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]add().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`] { |
| 798 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]::from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self) rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Add<Self>`]add().+rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Add<Self>`]add(). rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Add<Self>`]add().Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(rhs)) |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | impl Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 803 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`]; |
| 804 | /// Subtracts the `rhs` quaternion from `self`. |
| 805 | /// |
| 806 | /// The difference is not guaranteed to be normalized. |
| 807 | #[inline] |
| 808 | fn subrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`]sub().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`] { |
| 809 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sub<Self>`]::from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self) rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Sub<Self>`]sub().-rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Sub<Self>`]sub(). rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Sub<Self>`]sub().Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(rhs)) |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<f32> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 814 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]; |
| 815 | /// Multiplies a quaternion by a scalar value. |
| 816 | /// |
| 817 | /// The product is not guaranteed to be normalized. |
| 818 | #[inline] |
| 819 | fn mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]mul().(self, rhs: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`] { |
| 820 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]::from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self) rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Mul<f32>`]mul().*rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Mul<f32>`]mul(). rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Mul<f32>`]mul().rhs) |
| 821 | } |
| 822 | } |
| 823 | |
| 824 | impl Divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#<f32> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 825 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Div<f32>`]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Div<f32>`]; |
| 826 | /// Divides a quaternion by a scalar value. |
| 827 | /// The quotient is not guaranteed to be normalized. |
| 828 | #[inline] |
| 829 | fn divrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Div<f32>`]div().(self, rhs: f32) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Div<f32>`] { |
| 830 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Div<f32>`]::from_vec4rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]from_vec4().(Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(self) rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Div<f32>`]div()./rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Div<f32>`]div(). rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`Div<f32>`]div().rhs) |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 835 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]; |
| 836 | /// Multiplies two quaternions. If they each represent a rotation, the result will |
| 837 | /// represent the combined rotation. |
| 838 | /// |
| 839 | /// Note that due to floating point rounding the result may not be perfectly |
| 840 | /// normalized. |
| 841 | /// |
| 842 | /// # Panics |
| 843 | /// |
| 844 | /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. |
| 845 | #[inline] |
| 846 | fn mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]mul().(self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`] { |
| 847 | self.mul_quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_quat().(rhs) |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | impl MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 852 | /// Multiplies two quaternions. If they each represent a rotation, the result will |
| 853 | /// represent the combined rotation. |
| 854 | /// |
| 855 | /// Note that due to floating point rounding the result may not be perfectly |
| 856 | /// normalized. |
| 857 | /// |
| 858 | /// # Panics |
| 859 | /// |
| 860 | /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. |
| 861 | #[inline] |
| 862 | fn mul_assignrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`MulAssign<Self>`]mul_assign().(&mut self, rhs: Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`MulAssign<Self>`]) { |
| 863 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = self.mul_quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_quat().(rhs); |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 868 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3>`]Output# = Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#; |
| 869 | /// Multiplies a quaternion and a 3D vector, returning the rotated vector. |
| 870 | /// |
| 871 | /// # Panics |
| 872 | /// |
| 873 | /// Will panic if `self` is not normalized when `glam_assert` is enabled. |
| 874 | #[inline] |
| 875 | fn mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3>`]mul().(self, rhs: Vec3rust-analyzer cargo glam 0.27.0 f32/vec3/Vec3#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# { |
| 876 | self.mul_vec3rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_vec3().(rhs) |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | impl Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 881 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Neg]Output# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Neg]; |
| 882 | #[inline] |
| 883 | fn negrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Neg]neg().(self) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Neg] { |
| 884 | self rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]mul().*rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]mul(). rust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<f32>`]mul().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0 |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 889 | #[inline] |
| 890 | fn defaultrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Default]default().() -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Default] { |
| 891 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Default]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY. |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 896 | #[inline] |
| 897 | fn eqrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`PartialEq<Self>`]eq().(&self, rhs: &Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`PartialEq<Self>`]) -> bool { |
| 898 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).eqrust-analyzer cargo glam 0.27.0 f32/sse2/vec4/impl#[Vec4][`PartialEq<Self>`]eq().(&Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().rhs)) |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | #[cfg(not(target_arch = "spirv"))] |
| 903 | impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[f32; 4]> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 904 | #[inline] |
| 905 | fn as_refrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`AsRef<[f32; 4]>`]as_ref().(&self) -> &[f32; 4] { |
| 906 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`AsRef<[f32; 4]>`] as *const [f32; 4]) } |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | impl Sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Sum#<Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`]> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 911 | fn sumrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`]sum().<I>(iter: I) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`] |
| 912 | where |
| 913 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`]>, |
| 914 | { |
| 915 | iter.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`]::ZEROrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]ZERO., Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<Self>`]::addrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]add().) |
| 916 | } |
| 917 | } |
| 918 | |
| 919 | impl<'a> Sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Sum#<&'a Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`]> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 920 | fn sumrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`]sum().<I>(iter: I) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`] |
| 921 | where |
| 922 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &'a Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`]>, |
| 923 | { |
| 924 | iter.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`]::ZEROrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]ZERO., |a, &b| Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Sum<&'a Quat>`]::addrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Add<Self>`]add().(a, b)) |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | impl Productrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Product# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 929 | fn productrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<Self>`]product().<I>(iter: I) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<Self>`] |
| 930 | where |
| 931 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<Self>`]>, |
| 932 | { |
| 933 | iter.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<Self>`]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY., Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<Self>`]::mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]mul().) |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | impl<'a> Productrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Product#<&'a Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`]> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 938 | fn productrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`]product().<I>(iter: I) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`] |
| 939 | where |
| 940 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &'a Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`]>, |
| 941 | { |
| 942 | iter.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`]::IDENTITYrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]IDENTITY., |a, &b| Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Product<&'a Quat>`]::mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Self>`]mul().(a, b)) |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#> for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 947 | type Outputrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3A>`]Output# = Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#; |
| 948 | #[inline] |
| 949 | fn mulrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3A>`]mul().(self, rhs: Vec3Arust-analyzer cargo glam 0.27.0 f32/sse2/vec3a/Vec3A#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][`Mul<Vec3A>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# { |
| 950 | self.mul_vec3arust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat]mul_vec3a().(rhs) |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4# { |
| 955 | #[inline] |
| 956 | fn fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(q: Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`] { |
| 957 | Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`](q.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0.) |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for (f32, f32, f32, f32) { |
| 962 | #[inline] |
| 963 | fn fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[`(f32, f32, f32, f32)`][`From<Quat>`]from().(q: Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[`(f32, f32, f32, f32)`][`From<Quat>`] { |
| 964 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(q).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for [f32; 4] { |
| 969 | #[inline] |
| 970 | fn fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[`[f32; 4]`][`From<Quat>`]from().(q: Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[`[f32; 4]`][`From<Quat>`] { |
| 971 | Vec4rust-analyzer cargo glam 0.27.0 f32/sse2/vec4/Vec4#::fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Vec4][`From<Quat>`]from().(q).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 972 | } |
| 973 | } |
| 974 | |
| 975 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#> for __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128# { |
| 976 | #[inline] |
| 977 | fn fromrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[__m128][`From<Quat>`]from().(q: Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#) -> Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[__m128][`From<Quat>`] { |
| 978 | q.0rust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat#0. |
| 979 | } |
| 980 | } |
| 981 | |
| 982 | impl Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 983 | type Targetrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Deref]Target# = craterust-analyzer cargo glam 0.27.0 crate/::derefrust-analyzer cargo glam 0.27.0 deref/::Vec4rust-analyzer cargo glam 0.27.0 deref/Vec4#<f32>; |
| 984 | #[inline] |
| 985 | fn derefrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Deref]deref().(&self) -> &Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Deref]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# { |
| 986 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][Deref]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | impl DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for Quatrust-analyzer cargo glam 0.27.0 f32/sse2/quat/Quat# { |
| 991 | #[inline] |
| 992 | fn deref_mutrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][DerefMut]deref_mut().(&mut self) -> &mut Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][DerefMut]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# { |
| 993 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo glam 0.27.0 f32/sse2/quat/impl#[Quat][DerefMut]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().() } |
| 994 | } |
| 995 | } |