Struct Quaternion
#[repr(C)]pub struct Quaternion {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
Expand description
Unit quaternion to represent 3D rotations.
See also Quaternion
in the Godot documentation.
§Godot docs
Fields§
§x: f32
§y: f32
§z: f32
§w: f32
Implementations§
§impl Quaternion
impl Quaternion
pub fn new(x: f32, y: f32, z: f32, w: f32) -> Quaternion
pub fn from_axis_angle(axis: Vector3, angle: f32) -> Quaternion
pub fn from_axis_angle(axis: Vector3, angle: f32) -> Quaternion
pub fn angle_to(self, to: Quaternion) -> f32
pub fn dot(self, with: Quaternion) -> f32
pub fn to_exp(self) -> Quaternion
pub fn from_euler(euler: Vector3) -> Quaternion
pub fn get_angle(self) -> f32
pub fn get_axis(self) -> Vector3
pub fn to_euler(self, order: EulerOrder) -> Vector3
pub fn inverse(self) -> Quaternion
pub fn is_finite(self) -> bool
pub fn is_normalized(self) -> bool
pub fn length(self) -> f32
pub fn length_squared(self) -> f32
pub fn log(self) -> Quaternion
pub fn normalized(self) -> Quaternion
pub fn normalized(self) -> Quaternion
§Panics
If the quaternion has length of 0.
pub fn slerp(self, to: Quaternion, weight: f32) -> Quaternion
pub fn slerp(self, to: Quaternion, weight: f32) -> Quaternion
§Panics
If either quaternion is not normalized.
pub fn slerpni(self, to: Quaternion, weight: f32) -> Quaternion
pub fn slerpni(self, to: Quaternion, weight: f32) -> Quaternion
§Panics
If either quaternion is not normalized.
pub fn spherical_cubic_interpolate(
self,
b: Quaternion,
pre_a: Quaternion,
post_b: Quaternion,
weight: f32,
) -> Quaternion
pub fn spherical_cubic_interpolate( self, b: Quaternion, pre_a: Quaternion, post_b: Quaternion, weight: f32, ) -> Quaternion
§Panics
If any quaternions are not normalized.
pub fn spherical_cubic_interpolate_in_time(
self,
b: Quaternion,
pre_a: Quaternion,
post_b: Quaternion,
weight: f32,
b_t: f32,
pre_a_t: f32,
post_b_t: f32,
) -> Quaternion
pub fn spherical_cubic_interpolate_in_time( self, b: Quaternion, pre_a: Quaternion, post_b: Quaternion, weight: f32, b_t: f32, pre_a_t: f32, post_b_t: f32, ) -> Quaternion
§Panics
If any quaternions are not normalized.
Trait Implementations§
§impl Add for Quaternion
impl Add for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
+
operator.§fn add(self, other: Quaternion) -> Quaternion
fn add(self, other: Quaternion) -> Quaternion
Performs the
+
operation. Read more§impl AddAssign for Quaternion
impl AddAssign for Quaternion
§fn add_assign(&mut self, other: Quaternion)
fn add_assign(&mut self, other: Quaternion)
Performs the
+=
operation. Read more§impl ApproxEq for Quaternion
impl ApproxEq for Quaternion
fn approx_eq(&self, other: &Quaternion) -> bool
§impl Clone for Quaternion
impl Clone for Quaternion
§fn clone(&self) -> Quaternion
fn clone(&self) -> Quaternion
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 more§impl Debug for Quaternion
impl Debug for Quaternion
§impl Default for Quaternion
impl Default for Quaternion
§fn default() -> Quaternion
fn default() -> Quaternion
Returns the “default value” for a type. Read more
§impl Display for Quaternion
impl Display for Quaternion
§impl Div<f32> for Quaternion
impl Div<f32> for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
/
operator.§fn div(self, other: f32) -> Quaternion
fn div(self, other: f32) -> Quaternion
Performs the
/
operation. Read more§impl DivAssign<f32> for Quaternion
impl DivAssign<f32> for Quaternion
§fn div_assign(&mut self, other: f32)
fn div_assign(&mut self, other: f32)
Performs the
/=
operation. Read more§impl Export for Quaternion
impl Export for Quaternion
§fn export_hint() -> PropertyHintInfo
fn export_hint() -> PropertyHintInfo
The export info to use for an exported field of this type, if no other export info is specified.
§impl FromGodot for Quaternion
impl FromGodot for Quaternion
§fn try_from_godot(
via: <Quaternion as GodotConvert>::Via,
) -> Result<Quaternion, ConvertError>
fn try_from_godot( via: <Quaternion as GodotConvert>::Via, ) -> Result<Quaternion, ConvertError>
Converts the Godot representation to this type, returning
Err
on failure.§fn from_godot(via: Self::Via) -> Self
fn from_godot(via: Self::Via) -> Self
⚠️ Converts the Godot representation to this type. Read more
§fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
Performs the conversion from a
Variant
, returning Err
on failure.§fn from_variant(variant: &Variant) -> Self
fn from_variant(variant: &Variant) -> Self
§impl GodotConvert for Quaternion
impl GodotConvert for Quaternion
§type Via = Quaternion
type Via = Quaternion
The type through which
Self
is represented in Godot.§impl Mul<Vector3> for Quaternion
impl Mul<Vector3> for Quaternion
§impl Mul<f32> for Quaternion
impl Mul<f32> for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
*
operator.§fn mul(self, other: f32) -> Quaternion
fn mul(self, other: f32) -> Quaternion
Performs the
*
operation. Read more§impl Mul for Quaternion
impl Mul for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
*
operator.§fn mul(self, other: Quaternion) -> Quaternion
fn mul(self, other: Quaternion) -> Quaternion
Performs the
*
operation. Read more§impl MulAssign<f32> for Quaternion
impl MulAssign<f32> for Quaternion
§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
Performs the
*=
operation. Read more§impl MulAssign for Quaternion
impl MulAssign for Quaternion
§fn mul_assign(&mut self, other: Quaternion)
fn mul_assign(&mut self, other: Quaternion)
Performs the
*=
operation. Read more§impl Neg for Quaternion
impl Neg for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
-
operator.§fn neg(self) -> Quaternion
fn neg(self) -> Quaternion
Performs the unary
-
operation. Read more§impl ParamType for Quaternion
impl ParamType for Quaternion
§fn owned_to_arg<'v>(self) -> <Quaternion as ParamType>::Arg<'v>
fn owned_to_arg<'v>(self) -> <Quaternion as ParamType>::Arg<'v>
Converts an owned value to the canonical argument type, which can be passed to
impl AsArg<T>
. Read more§impl PartialEq for Quaternion
impl PartialEq for Quaternion
§impl Sub for Quaternion
impl Sub for Quaternion
§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
-
operator.§fn sub(self, other: Quaternion) -> Quaternion
fn sub(self, other: Quaternion) -> Quaternion
Performs the
-
operation. Read more§impl SubAssign for Quaternion
impl SubAssign for Quaternion
§fn sub_assign(&mut self, other: Quaternion)
fn sub_assign(&mut self, other: Quaternion)
Performs the
-=
operation. Read more§impl ToGodot for Quaternion
impl ToGodot for Quaternion
§type ToVia<'v> = <Quaternion as GodotConvert>::Via
type ToVia<'v> = <Quaternion as GodotConvert>::Via
§fn to_godot(&self) -> <Quaternion as ToGodot>::ToVia<'_>
fn to_godot(&self) -> <Quaternion as ToGodot>::ToVia<'_>
Converts this type to the Godot type by reference, usually by cloning.
§fn to_variant(&self) -> Variant
fn to_variant(&self) -> Variant
Converts this type to a Variant.
§impl Var for Quaternion
impl Var for Quaternion
fn get_property(&self) -> <Quaternion as GodotConvert>::Via
fn set_property(&mut self, value: <Quaternion as GodotConvert>::Via)
§fn var_hint() -> PropertyHintInfo
fn var_hint() -> PropertyHintInfo
Specific property hints, only override if they deviate from
GodotType::property_info
, e.g. for enums/newtypes.impl ArrayElement for Quaternion
impl AsArg<Quaternion> for Quaternion
impl Copy for Quaternion
impl GodotType for Quaternion
impl StructuralPartialEq for Quaternion
Auto Trait Implementations§
impl Freeze for Quaternion
impl RefUnwindSafe for Quaternion
impl Send for Quaternion
impl Sync for Quaternion
impl Unpin for Quaternion
impl UnwindSafe for Quaternion
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