Struct godot::builtin::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.

Fields§

§x: f32§y: f32§z: f32§w: f32

Implementations§

§

impl Quaternion

pub fn new(x: f32, y: f32, z: f32, w: f32) -> Quaternion

pub fn from_axis_angle(axis: Vector3, angle: f32) -> Quaternion

Creates a quaternion from a Vector3 and an angle.

§Panics

If the vector3 is not normalized.

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

§Panics

If the quaternion has length of 0.

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

§Panics

If either quaternion is not normalized.

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

§Panics

If any quaternions are not normalized.

Trait Implementations§

§

impl Add for Quaternion

§

type Output = Quaternion

The resulting type after applying the + operator.
§

fn add(self, other: Quaternion) -> Quaternion

Performs the + operation. Read more
§

impl AddAssign for Quaternion

§

fn add_assign(&mut self, other: Quaternion)

Performs the += operation. Read more
§

impl ApproxEq for Quaternion

§

fn approx_eq(&self, other: &Quaternion) -> bool

§

impl Clone for Quaternion

§

fn clone(&self) -> Quaternion

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Quaternion

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Quaternion

§

fn default() -> Quaternion

Returns the “default value” for a type. Read more
§

impl Display for Quaternion

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Div<f32> for Quaternion

§

type Output = Quaternion

The resulting type after applying the / operator.
§

fn div(self, other: f32) -> Quaternion

Performs the / operation. Read more
§

impl DivAssign<f32> for Quaternion

§

fn div_assign(&mut self, other: f32)

Performs the /= operation. Read more
§

impl Export for Quaternion

§

fn default_export_info() -> PropertyHintInfo

The export info to use for an exported field of this type, if no other export info is specified.
§

impl FromGodot for Quaternion

§

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

⚠️ Converts the Godot representation to this type. Read more
§

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

⚠️ Performs the conversion from a Variant. Read more
§

impl GodotConvert for Quaternion

§

type Via = Quaternion

The type through which Self is represented in Godot.
§

impl Mul<f32> for Quaternion

§

type Output = Quaternion

The resulting type after applying the * operator.
§

fn mul(self, other: f32) -> Quaternion

Performs the * operation. Read more
§

impl Mul for Quaternion

§

type Output = Quaternion

The resulting type after applying the * operator.
§

fn mul(self, other: Quaternion) -> Quaternion

Performs the * operation. Read more
§

impl MulAssign<f32> for Quaternion

§

fn mul_assign(&mut self, other: f32)

Performs the *= operation. Read more
§

impl MulAssign for Quaternion

§

fn mul_assign(&mut self, other: Quaternion)

Performs the *= operation. Read more
§

impl Neg for Quaternion

§

type Output = Quaternion

The resulting type after applying the - operator.
§

fn neg(self) -> Quaternion

Performs the unary - operation. Read more
§

impl PartialEq for Quaternion

§

fn eq(&self, other: &Quaternion) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Sub for Quaternion

§

type Output = Quaternion

The resulting type after applying the - operator.
§

fn sub(self, other: Quaternion) -> Quaternion

Performs the - operation. Read more
§

impl SubAssign for Quaternion

§

fn sub_assign(&mut self, other: Quaternion)

Performs the -= operation. Read more
§

impl ToGodot for Quaternion

§

fn to_godot(&self) -> <Quaternion as GodotConvert>::Via

Converts this type to the Godot type by reference, usually by cloning.
§

fn into_godot(self) -> <Quaternion as GodotConvert>::Via

Converts this type to the Godot type. Read more
§

fn to_variant(&self) -> Variant

Converts this type to a Variant.
§

impl TypeStringHint for Quaternion

§

fn type_string() -> String

Returns the representation of this type as a type string. Read more
§

impl Var for Quaternion

§

impl ArrayElement for Quaternion

§

impl Copy for Quaternion

§

impl GodotType for Quaternion

§

impl StructuralPartialEq for Quaternion

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.