pub struct Matrix3x2<T> {
pub e11: T,
pub e12: T,
pub e21: T,
pub e22: T,
pub e31: T,
pub e32: T,
}Expand description
A struct representing a 3x2 matrix.
This struct is used to store the transformation matrix for transforming a 2D vector into a 3D vector.
Namely, it is used in the tilt_flat_position
method to tilt a 2D position into 3D, using the orbital parameters.
Each element is named eXY, where X is the row and Y is the column.
§Example
use keplerian_sim::Matrix3x2;
let matrix: Matrix3x2<f64> = Matrix3x2 {
e11: 1.0, e12: 0.0,
e21: 0.0, e22: 1.0,
e31: 0.0, e32: 0.0,
};
let vec = (1.0, 2.0);
let result = matrix.dot_vec(vec);
assert_eq!(result, (1.0, 2.0, 0.0));Fields§
§e11: T§e12: T§e21: T§e22: T§e31: T§e32: TImplementations§
Source§impl<T: Copy> Matrix3x2<T>
impl<T: Copy> Matrix3x2<T>
Sourcepub fn filled_with(element: T) -> Matrix3x2<T>
pub fn filled_with(element: T) -> Matrix3x2<T>
Create a new Matrix3x2 instance where each element is initialized with the same value.
§Example
use keplerian_sim::Matrix3x2;
let matrix = Matrix3x2::filled_with(0.0);
assert_eq!(matrix, Matrix3x2 {
e11: 0.0, e12: 0.0,
e21: 0.0, e22: 0.0,
e31: 0.0, e32: 0.0,
});Source§impl<T> Matrix3x2<T>
impl<T> Matrix3x2<T>
Sourcepub fn dot_vec(&self, vec: (T, T)) -> (T, T, T)
pub fn dot_vec(&self, vec: (T, T)) -> (T, T, T)
Computes a dot product between this matrix and a 2D vector.
§Example
use keplerian_sim::Matrix3x2;
let matrix: Matrix3x2<f64> = Matrix3x2 {
e11: 1.0, e12: 0.0,
e21: 0.0, e22: 1.0,
e31: 1.0, e32: 1.0,
};
let vec = (1.0, 2.0);
let result = matrix.dot_vec(vec);
assert_eq!(result, (1.0, 2.0, 3.0));Trait Implementations§
impl<T: Copy> Copy for Matrix3x2<T>
impl<T: Eq> Eq for Matrix3x2<T>
impl<T> StructuralPartialEq for Matrix3x2<T>
Auto Trait Implementations§
impl<T> Freeze for Matrix3x2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Matrix3x2<T>where
T: RefUnwindSafe,
impl<T> Send for Matrix3x2<T>where
T: Send,
impl<T> Sync for Matrix3x2<T>where
T: Sync,
impl<T> Unpin for Matrix3x2<T>where
T: Unpin,
impl<T> UnwindSafe for Matrix3x2<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more