use na::{Real, UnitComplex}; use traits::Number; use aliases::{TMat3, TVec2}; /// Builds a 2D rotation matrix from an angle and right-multiply it to `m`. pub fn rotate2d(m: &TMat3, angle: N) -> TMat3 { m * UnitComplex::new(angle).to_homogeneous() } /// Builds a 2D scaling matrix and right-multiply it to `m`. pub fn scale2d(m: &TMat3, v: &TVec2) -> TMat3 { m.prepend_nonuniform_scaling(v) } /// Builds a translation matrix and right-multiply it to `m`. pub fn translate2d(m: &TMat3, v: &TVec2) -> TMat3 { m.prepend_translation(v) }