Debian Codegraph @

debian/missing-sources/glam-0.27.0/src/f64/dquat.rs

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