use crate::base::Rotation;
pub(crate) fn is_layer_block_form(rotation: &Rotation) -> bool {
rotation[(0, 2)] == 0
&& rotation[(1, 2)] == 0
&& rotation[(2, 0)] == 0
&& rotation[(2, 1)] == 0
&& rotation[(2, 2)].abs() == 1
}
#[cfg(test)]
mod tests {
use nalgebra::matrix;
use super::is_layer_block_form;
#[test]
fn test_layer_block_form_predicate() {
assert!(is_layer_block_form(&matrix![1, 0, 0; 0, 1, 0; 0, 0, 1]));
assert!(is_layer_block_form(&matrix![0, -1, 0; 1, 0, 0; 0, 0, 1]));
assert!(is_layer_block_form(&matrix![1, 0, 0; 0, 1, 0; 0, 0, -1]));
assert!(!is_layer_block_form(&matrix![0, 0, 1; 1, 0, 0; 0, 1, 0]));
assert!(!is_layer_block_form(&matrix![1, 0, 1; 0, 1, 0; 0, 0, 1]));
assert!(!is_layer_block_form(&matrix![1, 0, 0; 0, 1, 0; 0, 0, 0]));
}
}