pub struct Quat { /* private fields */ }Expand description
A structure that holds an array of unit quaternions
Implementations§
Source§impl Quat
impl Quat
Sourcepub fn new(size: usize) -> Quat
pub fn new(size: usize) -> Quat
Creates an array of zeros for the initial unit quaternion when data is not fed into it
Sourcepub fn new_init(ori: Array2<f64>) -> Quat
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.
Sourcepub fn ori_view(&self) -> ArrayView2<'_, f64>
pub fn ori_view(&self) -> ArrayView2<'_, f64>
Return a ndarray view of the orientation data
Sourcepub fn ori_view_mut(&mut self) -> ArrayViewMut2<'_, f64>
pub fn ori_view_mut(&mut self) -> ArrayViewMut2<'_, f64>
Return a ndarray mutable view of the orientation data
Sourcepub fn par_conjugate(&self) -> Quat
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.
Sourcepub fn par_conjugate_inplace(&mut self)
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.
Sourcepub fn par_product(&self, quat2: &Quat) -> Quat
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.
Sourcepub fn par_product_mut(&self, quat2: &Quat, quat_prod: &mut Quat)
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 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.
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
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
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
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
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
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
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
fn par_to_quat(&self) -> Quat
This returns a clone of the original unit quaternion structure
Source§fn par_to_homochoric(&self) -> Homochoric
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)
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)
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)
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)
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)
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)
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)
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)
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
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>
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>,
)
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>)
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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