Debian Codegraph @

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