This repository was archived by the owner on Dec 24, 2023. It is now read-only.
This repository was archived by the owner on Dec 24, 2023. It is now read-only.
Direct cosine matrix helper functions #6
Open
Description
Several functions to help in the creation of direct cosine matrices, as these are still often used for analysis.
Proposed signatures
Axis enum
This will be used to create DCMs from the Euler angles provided.
pub enum Axis {
X,
Y,
Z
}
Anise would also provide const
s for all permutations ((3,3,2), (3,3,1), ...) as demo'd in the playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4fc2d3cc1657df0264fbf3f2bf956f44 .
DCM from Euler angles
Note: I think we should provide Matrix3
as a top level export of nalgebra's SMatrix<f64, 3, 3>
, a statically allocated matrix.
/// Example usage (all equivalent):
/// let dcm = Matrix3::from( (45.0, 20.0, 19.0), EULER_321);
/// let dcm = Matrix3::from_euler_angles( (45.0, 20.0, 19.0), EULER_321);
/// let dcm = Matrix3::from_euler_angles( (45.0, 20.0, 19.0), (Axis::Z, Axis::Y, Axis::X));
/// let dcm = Matrix3::from_angles( (Axis::Z, 45.0) , (Axis::Y, 20.0), (Axis::X, 19.0));
impl Matrix3 {
pub fn from_euler_angles(angles_deg: (f64, f64, f64), rotation_group: (Axis, Axis, Axis)) {}
}
(...)
impl From<( (f64, f64, f64), (Axis, Axis, Axis))> for Matrix3 {}
Note that an implementation of From
necessarily also implements an Into
, which might lead to confusing code being valid like the following.
let euler: ( (f64, f64, f64), (Axis, Axis, Axis) ) = my_dcm.into();