use na::{Real, U2, U3, U4, Rotation3, Vector3, Unit, UnitComplex}; use aliases::{Vec, Mat}; pub fn orientation(normal: &Vec, up: &Vec) -> Mat { if let Some(r) = Rotation3::rotation_between(normal, up) { r.to_homogeneous() } else { Mat::::identity() } } pub fn rotate2(v: &Vec, angle: N) -> Vec { UnitComplex::new(angle) * v } pub fn rotate(v: &Vec, angle: N, normal: &Vec) -> Vec { Rotation3::from_axis_angle(&Unit::new_normalize(*normal), angle) * v } pub fn rotate4(v: &Vec, angle: N, normal: &Vec) -> Vec { Rotation3::from_axis_angle(&Unit::new_normalize(*normal), angle).to_homogeneous() * v } pub fn rotateX(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::x_axis(), angle) * v } pub fn rotateX4(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::x_axis(), angle).to_homogeneous() * v } pub fn rotateY(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::y_axis(), angle) * v } pub fn rotateY4(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::y_axis(), angle).to_homogeneous() * v } pub fn rotateZ(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::z_axis(), angle) * v } pub fn rotateZ4(v: &Vec, angle: N) -> Vec { Rotation3::from_axis_angle(&Vector3::z_axis(), angle).to_homogeneous() * v } pub fn slerp(x: &Vec, y: &Vec, a: N) -> Vec { unimplemented!() }