Debian Codegraph @

debian/missing-sources/glam-0.23.0/src/f32/sse2/quat.rs

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