Struct graphene::Quaternion
source · 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
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>,
unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>
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>,
unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>
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>,
unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>
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>,
unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>
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>,
unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>
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>,
unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>
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
.