pub struct Rotation(_);Expand description
A Signed Permutation Matrix 1 encoded in a byte.
Encoding
The encoding follows the MagicaVoxel ROTATION type.
for example :
let R = [
[0, 1, 0],
[0, 0, -1],
[-1, 0, 0],
];
let _r: u8 = (1 << 0) | (2 << 2) | (0 << 4) | (1 << 5) | (1 << 6);| bit | value | descripton |
|---|---|---|
| 0-1 | 1 | Index of the non-zero entry in the first row |
| 2-3 | 2 | Index of the non-zero entry in the second row |
| 4 | 0 | The sign in the first row (0 - positive; 1 - negative) |
| 5 | 1 | The sign in the second row (0 - positive; 1 - negative) |
| 6 | 1 | The sign in the third row (0 - positive; 1 - negative) |
A
Signed Permutation Matrixis a square binary matrix that has exactly one entry of ±1 in each row and each column and 0s elsewhere. ↩
Implementations
sourceimpl Rotation
impl Rotation
pub const IDENTITY: Self = _
pub fn from_byte(byte: u8) -> Self
sourcepub fn to_quat_scale(&self) -> ([f32; 4], [f32; 3])
pub fn to_quat_scale(&self) -> ([f32; 4], [f32; 3])
Decompose the Signed Permutation Matrix into a rotation component, represented by a Quaternion, and a flip component, represented by a Vec3 which is either Vec3::ONE or -Vec3::ONE.
pub fn to_cols_array_2d(&self) -> [[f32; 3]; 3]
Trait Implementations
impl Copy for Rotation
Auto Trait Implementations
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnwindSafe for Rotation
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more