pub struct Quaternion { /* private fields */ }
Expand description
A quaternion.
The contents of the Quaternion
structure are private
and should never be accessed directly.
GLib type: Inline allocated boxed type with stack copy semantics.
Implementations§
Source§impl Quaternion
impl Quaternion
pub fn as_ptr(&self) -> *mut graphene_quaternion_t
Sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const graphene_quaternion_t,
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const graphene_quaternion_t, ) -> &'a Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut graphene_quaternion_t,
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut graphene_quaternion_t, ) -> &'a mut Self
Borrows the underlying C value mutably.
Source§impl Quaternion
impl Quaternion
Sourcepub fn add(&self, b: &Quaternion) -> Quaternion
pub fn add(&self, b: &Quaternion) -> Quaternion
Sourcepub fn dot(&self, b: &Quaternion) -> f32
pub fn dot(&self, b: &Quaternion) -> f32
Sourcepub fn invert(&self) -> Quaternion
pub fn invert(&self) -> Quaternion
Inverts a Quaternion
, and returns the conjugate
quaternion of self
.
§Returns
§res
return location for the inverted quaternion
Sourcepub fn multiply(&self, b: &Quaternion) -> Quaternion
pub fn multiply(&self, b: &Quaternion) -> Quaternion
Sourcepub fn normalize(&self) -> Quaternion
pub fn normalize(&self) -> Quaternion
Sourcepub fn scale(&self, factor: f32) -> Quaternion
pub fn scale(&self, factor: f32) -> Quaternion
Scales all the elements of a Quaternion
self
using
the given scalar factor.
§factor
a scaling factor
§Returns
§res
the result of the operation
Sourcepub fn slerp(&self, b: &Quaternion, factor: f32) -> Quaternion
pub fn slerp(&self, b: &Quaternion, factor: f32) -> Quaternion
Sourcepub fn to_angle_vec3(&self) -> (f32, Vec3)
pub fn to_angle_vec3(&self) -> (f32, Vec3)
Sourcepub fn to_angles(&self) -> (f32, f32, f32)
pub fn to_angles(&self) -> (f32, f32, f32)
Converts a Quaternion
to its corresponding rotations
on the Euler angles
on each axis.
§Returns
§deg_x
return location for the rotation angle on the X axis (yaw), in degrees
§deg_y
return location for the rotation angle on the Y axis (pitch), in degrees
§deg_z
return location for the rotation angle on the Z axis (roll), in degrees
Sourcepub fn to_matrix(&self) -> Matrix
pub fn to_matrix(&self) -> Matrix
Converts a quaternion into a transformation matrix expressing
the rotation defined by the Quaternion
.
§Returns
§m
a Matrix
Sourcepub fn to_radians(&self) -> (f32, f32, f32)
pub fn to_radians(&self) -> (f32, f32, f32)
Converts a Quaternion
to its corresponding rotations
on the Euler angles
on each axis.
§Returns
§rad_x
return location for the rotation angle on the X axis (yaw), in radians
§rad_y
return location for the rotation angle on the Y axis (pitch), in radians
§rad_z
return location for the rotation angle on the Z axis (roll), in radians
Source§impl Quaternion
impl Quaternion
Sourcepub fn from_angle_vec3(angle: f32, axis: &Vec3) -> Self
pub fn from_angle_vec3(angle: f32, axis: &Vec3) -> Self
Initializes a Quaternion
using an angle
on a
specific axis
.
§angle
the rotation on a given axis, in degrees
§axis
the axis of rotation, expressed as a vector
§Returns
the initialized quaternion
Sourcepub fn from_angles(deg_x: f32, deg_y: f32, deg_z: f32) -> Self
pub fn from_angles(deg_x: f32, deg_y: f32, deg_z: f32) -> Self
Initializes a Quaternion
using the values of
the Euler angles
on each axis.
See also: from_euler()
§deg_x
rotation angle on the X axis (yaw), in degrees
§deg_y
rotation angle on the Y axis (pitch), in degrees
§deg_z
rotation angle on the Z axis (roll), in degrees
§Returns
the initialized quaternion
Sourcepub fn from_euler(e: &Euler) -> Self
pub fn from_euler(e: &Euler) -> Self
Sourcepub fn from_matrix(m: &Matrix) -> Self
pub fn from_matrix(m: &Matrix) -> Self
Initializes a Quaternion
using the rotation components
of a transformation matrix.
§m
a Matrix
§Returns
the initialized quaternion
Sourcepub fn from_radians(rad_x: f32, rad_y: f32, rad_z: f32) -> Self
pub fn from_radians(rad_x: f32, rad_y: f32, rad_z: f32) -> Self
Initializes a Quaternion
using the values of
the Euler angles
on each axis.
See also: from_euler()
§rad_x
rotation angle on the X axis (yaw), in radians
§rad_y
rotation angle on the Y axis (pitch), in radians
§rad_z
rotation angle on the Z axis (roll), in radians
§Returns
the initialized quaternion
Sourcepub fn new_identity() -> Self
pub fn new_identity() -> Self
pub fn x(&self) -> f32
pub fn y(&self) -> f32
pub fn z(&self) -> f32
pub fn w(&self) -> f32
Trait Implementations§
Source§impl Clone for Quaternion
impl Clone for Quaternion
Source§impl Debug for Quaternion
impl Debug for Quaternion
Source§impl HasParamSpec for Quaternion
impl HasParamSpec for Quaternion
type ParamSpec = ParamSpecBoxed
Source§type SetValue = Quaternion
type SetValue = Quaternion
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, Quaternion>
fn param_spec_builder() -> Self::BuilderFn
Source§impl PartialEq for Quaternion
impl PartialEq for Quaternion
Source§impl StaticType for Quaternion
impl StaticType for Quaternion
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Copy for Quaternion
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
Source§impl<T> PropertyGet for Twhere
T: HasParamSpec,
impl<T> PropertyGet for Twhere
T: HasParamSpec,
Source§impl<T> StaticTypeExt for Twhere
T: StaticType,
impl<T> StaticTypeExt for Twhere
T: StaticType,
Source§fn ensure_type()
fn ensure_type()
Source§impl<T> ToSendValue for T
impl<T> ToSendValue for T
Source§fn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
SendValue
clone of self
.