Debian Codegraph @

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