Struct Quat

Source
pub struct Quat { /* private fields */ }
Expand description

A structure that holds an array of unit quaternions

Implementations§

Source§

impl Quat

Source

pub fn new(size: usize) -> Quat

Creates an array of zeros for the initial unit quaternion when data is not fed into it

Source

pub fn new_init(ori: Array2<f64>) -> Quat

Creates a unit quaternion type with the supplied data as long as the supplied data is in the following format shape (4, nelems), memory order = fortran/column major. If it doesn’t fit those standards it will fail.

Source

pub fn ori_view(&self) -> ArrayView2<'_, f64>

Return a ndarray view of the orientation data

Source

pub fn ori_view_mut(&mut self) -> ArrayViewMut2<'_, f64>

Return a ndarray mutable view of the orientation data

Source

pub fn par_conjugate(&self) -> Quat

Returns a new Quat that is equal to the conjugate/inverse of the unit quaternion which is simply the negative of the vector portions of the unit quaternion.

Source

pub fn par_conjugate_inplace(&mut self)

Performs in place the conjugate/inverse of the unit quaternion which is simply the negative of the vector portions of the unit quaternion. The inverse is said to be the same here because for unit quaternions that is the case. If we didn’t have unit quaternions that would not be the case.

Source

pub fn par_product(&self, quat2: &Quat) -> Quat

Performs a quaternion product operation between two unit quaternions -> q_new = (q_01q_02 - q_1.q_2, q_01q_2 +q_02*q_1 + q_1 x q_2) where q_1 and q_2 are the vector components of the quaternion. The result returned is a new quaternion. Also, if the conjugate/inverse is used for the first quaternion one can obtain the relative orientation/rotation between quaternion 1 and quaternion 2. This function requires the number of elements in self to be either 1. The quat2 field might also contain either 1 or nelems number of elements. If this condition is not met the function will error out. quat2 - the quaternion to be rotated must have dimensions 4xnelems or 4x1. Output - the quaternion product and has dimensions 4xnelems.

Source

pub fn par_product_mut(&self, quat2: &Quat, quat_prod: &mut Quat)

Performs a quaternion product operation between two unit quaternions -> q_new = (q_01q_02 - q_1.q_2, q_01q_2 +q_02*q_1 + q_1 x q_2) where q_1 and q_2 are the vector components of the quaternion. The result is stored in a supplied quaternion field. Also, if the conjugate/inverse is used for the first quaternion one can obtain the relative orientation/rotation between quaternion 1 and quaternion 2. This function requires the number of elements in self to be either 1. The quat2 field might also contain either 1 or nelems number of elements. The quat_prod field must contain nelems number of elements. If this condition is not met the function will error out. quat2 - the quaternion to be rotated must have dimensions 4xnelems or 4x1. quat_prod - the quaternion product that was supplied that we are going to store data in must have dims 4xnelems

Trait Implementations§

Source§

impl Clone for Quat

Source§

fn clone(&self) -> Quat

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Quat

Source§

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

Formats the value using the given formatter. Read more
Source§

impl ParallelOriConv for Quat

The orientation conversions of a series of unit quaternions to a number of varying different orientation representations commonly used in material orientation processing.

Source§

fn par_to_bunge(&self) -> Bunge

Converts the unit quaternion representation over to Bunge angles which has the following properties shape (3, nelems), memory order = fortran/column major.

Source§

fn par_to_rmat(&self) -> RMat

Converts the unit quaternion representation over to rotation matrix which has the following properties shape (3, 3, nelems), memory order = fortran/column major.

Source§

fn par_to_ang_axis(&self) -> AngAxis

Converts the unit quaternion representation over to angle-axis representation which has the following properties shape (3, nelems), memory order = fortran/column major.

Source§

fn par_to_ang_axis_comp(&self) -> AngAxisComp

Converts the unit quaternion over to a compact angle-axis representation which has the following properties shape (3, nelems), memory order = fortran/column major.

Source§

fn par_to_rod_vec(&self) -> RodVec

Converts the unit quaternion over to a Rodrigues vector representation which has the following properties shape (4, nelems), memory order = fortran/column major.

Source§

fn par_to_rod_vec_comp(&self) -> RodVecComp

Converts the unit quaternion over to a compact Rodrigues vector representation which has the following properties shape (3, nelems), memory order = fortran/column major.

Source§

fn par_to_quat(&self) -> Quat

This returns a clone of the original unit quaternion structure

Source§

fn par_to_homochoric(&self) -> Homochoric

Converts the quaternion representation over to a homochoric representation which has the following properties shape (4, nelems), memory order = fortran/column major.

Source§

fn par_to_bunge_inplace(&self, bunge: &mut Bunge)

Converts the unit quaternion representation over to Bunge angles which has the following properties shape (3, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_rmat_inplace(&self, rmat: &mut RMat)

Converts the unit quaternion representation over to rotation matrix which has the following properties shape (3, 3, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_ang_axis_inplace(&self, ang_axis: &mut AngAxis)

Converts the unit quaternion over to a angle-axis representation which has the following properties shape (4, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_ang_axis_comp_inplace(&self, ang_axis_comp: &mut AngAxisComp)

Converts the unit quaternion over to a compact angle-axis representation which has the following properties shape (3, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_rod_vec_inplace(&self, rod_vec: &mut RodVec)

Converts the unit quaternion over to a Rodrigues vector representation which has the following properties shape (4, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_rod_vec_comp_inplace(&self, rod_vec_comp: &mut RodVecComp)

Converts the unit quaternion over to a compact Rodrigues vector representation which has the following properties shape (3, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

fn par_to_quat_inplace(&self, quat: &mut Quat)

This returns a clone of the original unit quaternion structure This operation is done inplace and does not create a new structure

Source§

fn par_to_homochoric_inplace(&self, homochoric: &mut Homochoric)

Converts the quaternion representation over to a homochoric representation which has the following properties shape (4, nelems), memory order = fortran/column major. This operation is done inplace and does not create a new structure

Source§

impl ParallelRotVector for Quat

A series of commonly used operations to rotate vector data by a given rotation

Source§

fn par_rot_vector(&self, vec: ArrayView2<'_, f64>) -> Array2<f64>

rot_vector takes in a 2D array view of a series of vectors. It then rotates these vectors using the given Quaternion. The newly rotated vectors are then returned. This function requires the number of elements in the Quaternion to be either 1. The unrotated vector might also contain either 1 or nelems number of elements. If this condition is not met the function will error out. vec - the vector to be rotated must have dimensions 3xnelems or 3x1. Output - the rotated vector and has dimensions 3xnelems.

Source§

fn par_rot_vector_mut( &self, vec: ArrayView2<'_, f64>, rvec: ArrayViewMut2<'_, f64>, )

rot_vector_mut takes in a 2D array view of a series of vectors and a mutable 2D ArrayView of the rotated vector. It then rotates these vectors using the given Quaternion. The newly rotated vectors are assigned to the supplied rotated vector, rvec. This function requires the number of elements in the Quaternion to be either 1 or nelems. The unrotated vector might also contain either 1 or nelems number of elements. It also requires the number of elements in rvec and vec to be equal. If these conditions are not met the function will error out. vec - the vector to be rotated must have dimensions 3xnelems or 3x1. rvec - the rotated vector and has dimensions 3xnelems.

Source§

fn par_rot_vector_inplace(&self, vec: ArrayViewMut2<'_, f64>)

rot_vector_inplace takes in a mutable 2D array view of a series of vectors. It then rotates these vectors using the given Quaternion. The newly rotated vectors are assigned to original vector. This function requires the number of elements in the Quaternion to be either 1 or nelems where vec has nelems in it. If this condition is not met the function will error out. vec - the vector to be rotated must have dimensions 3xnelems.

Auto Trait Implementations§

§

impl Freeze for Quat

§

impl RefUnwindSafe for Quat

§

impl Send for Quat

§

impl Sync for Quat

§

impl Unpin for Quat

§

impl UnwindSafe for Quat

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: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.