pub struct Quaternion<T> {
pub s: T,
pub v: Vector3<T>,
}
Expand description
A quaternion, composed
of a scalar and a Vector3
.
Fields§
§s: T
§v: Vector3<T>
Implementations§
Source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
Sourcepub const fn new(w: T, xi: T, yj: T, zk: T) -> Quaternion<T>
pub const fn new(w: T, xi: T, yj: T, zk: T) -> Quaternion<T>
Constructs a Quaternion from one scalar and three imaginary components.
Sourcepub fn from_sv(s: T, v: Vector3<T>) -> Quaternion<T>
pub fn from_sv(s: T, v: Vector3<T>) -> Quaternion<T>
Constructs a Quaternion from a scalar and a vector.
Source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
Sourcepub fn from_axis_angle(axis: Vector3<T>, angle: T) -> Self
pub fn from_axis_angle(axis: Vector3<T>, angle: T) -> Self
Constructs the rotation as a rotation along an axis.
Source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
Source§impl<T> Quaternion<T>where
T: Clone,
impl<T> Quaternion<T>where
T: Clone,
Trait Implementations§
Source§impl<T> Add for Quaternion<T>where
T: Add<T, Output = T>,
impl<T> Add for Quaternion<T>where
T: Add<T, Output = T>,
Source§type Output = Quaternion<T>
type Output = Quaternion<T>
The resulting type after applying the
+
operator.Source§fn add(self, rhs: Quaternion<T>) -> Self
fn add(self, rhs: Quaternion<T>) -> Self
Performs the
+
operation. Read moreSource§impl<T: Clone> Clone for Quaternion<T>
impl<T: Clone> Clone for Quaternion<T>
Source§fn clone(&self) -> Quaternion<T>
fn clone(&self) -> Quaternion<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for Quaternion<T>where
T: Debug,
impl<T> Debug for Quaternion<T>where
T: Debug,
Source§impl<'de, T> Deserialize<'de> for Quaternion<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Quaternion<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Div<T> for Quaternion<T>
impl<T> Div<T> for Quaternion<T>
Source§impl<T> DivAssign<T> for Quaternion<T>
impl<T> DivAssign<T> for Quaternion<T>
Source§fn div_assign(&mut self, scalar: T)
fn div_assign(&mut self, scalar: T)
Performs the
/=
operation. Read moreSource§impl<T> From<Euler<T>> for Quaternion<T>
impl<T> From<Euler<T>> for Quaternion<T>
Source§fn from(euler: Euler<T>) -> Quaternion<T>
fn from(euler: Euler<T>) -> Quaternion<T>
Converts to this type from the input type.
Source§impl<T> From<Orthonormal<T, 3>> for Quaternion<T>
impl<T> From<Orthonormal<T, 3>> for Quaternion<T>
Source§fn from(orthonormal: Orthonormal<T, 3>) -> Self
fn from(orthonormal: Orthonormal<T, 3>) -> Self
Converts to this type from the input type.
Source§impl<T> From<Quaternion<T>> for Matrix3<T>
impl<T> From<Quaternion<T>> for Matrix3<T>
Source§fn from(quat: Quaternion<T>) -> Self
fn from(quat: Quaternion<T>) -> Self
Converts to this type from the input type.
Source§impl<T> From<Quaternion<T>> for Matrix4<T>
impl<T> From<Quaternion<T>> for Matrix4<T>
Source§fn from(quat: Quaternion<T>) -> Self
fn from(quat: Quaternion<T>) -> Self
Converts to this type from the input type.
Source§impl<T> InnerSpace for Quaternion<T>
impl<T> InnerSpace for Quaternion<T>
Source§fn magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
Returns the squared length of the value.
Source§fn reflect(self, surface_normal: Unit<Self>) -> Self
fn reflect(self, surface_normal: Unit<Self>) -> Self
Returns the reflection
of the current vector with respect to the given surface normal. The
surface normal must be of length 1 for the return value to be
correct. The current vector is interpreted as pointing toward the
surface, and does not need to be normalized.
Source§impl<T> MetricSpace for Quaternion<T>
impl<T> MetricSpace for Quaternion<T>
Source§impl<T> Mul<T> for Quaternion<T>
impl<T> Mul<T> for Quaternion<T>
Source§impl<T> Mul<Vector3<T>> for Quaternion<T>
impl<T> Mul<Vector3<T>> for Quaternion<T>
Source§impl<T> Mul for Quaternion<T>
impl<T> Mul for Quaternion<T>
Source§type Output = Quaternion<T>
type Output = Quaternion<T>
The resulting type after applying the
*
operator.Source§fn mul(self, rhs: Quaternion<T>) -> Self
fn mul(self, rhs: Quaternion<T>) -> Self
Performs the
*
operation. Read moreSource§impl<T> MulAssign<T> for Quaternion<T>
impl<T> MulAssign<T> for Quaternion<T>
Source§fn mul_assign(&mut self, scalar: T)
fn mul_assign(&mut self, scalar: T)
Performs the
*=
operation. Read moreSource§impl<T> Neg for Quaternion<T>where
T: Neg<Output = T>,
impl<T> Neg for Quaternion<T>where
T: Neg<Output = T>,
Source§impl<T> One for Quaternion<T>where
T: One,
impl<T> One for Quaternion<T>where
T: One,
Source§impl<A, B> PartialEq<Quaternion<B>> for Quaternion<A>
impl<A, B> PartialEq<Quaternion<B>> for Quaternion<A>
Source§impl<T> Rotation3 for Quaternion<T>
impl<T> Rotation3 for Quaternion<T>
Source§impl<T> Serialize for Quaternion<T>where
T: Serialize,
impl<T> Serialize for Quaternion<T>where
T: Serialize,
Source§impl<T> Sub for Quaternion<T>where
T: Sub<T, Output = T>,
impl<T> Sub for Quaternion<T>where
T: Sub<T, Output = T>,
Source§type Output = Quaternion<T>
type Output = Quaternion<T>
The resulting type after applying the
-
operator.Source§fn sub(self, rhs: Quaternion<T>) -> Self
fn sub(self, rhs: Quaternion<T>) -> Self
Performs the
-
operation. Read moreSource§impl<T> VectorSpace for Quaternion<T>
impl<T> VectorSpace for Quaternion<T>
Source§impl<T> Zero for Quaternion<T>where
T: Zero,
impl<T> Zero for Quaternion<T>where
T: Zero,
impl<T: Copy> Copy for Quaternion<T>
impl<T> Eq for Quaternion<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for Quaternion<T>where
T: Freeze,
impl<T> RefUnwindSafe for Quaternion<T>where
T: RefUnwindSafe,
impl<T> Send for Quaternion<T>where
T: Send,
impl<T> Sync for Quaternion<T>where
T: Sync,
impl<T> Unpin for Quaternion<T>where
T: Unpin,
impl<T> UnwindSafe for Quaternion<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more