pub struct Matrix {
pub a: f32,
pub b: f32,
pub c: f32,
pub d: f32,
pub e: f32,
pub f: f32,
}Expand description
アフィン変換行列 [a b c d e f]。
Fields§
§a: f32§b: f32§c: f32§d: f32§e: f32§f: f32Implementations§
Source§impl Matrix
impl Matrix
pub fn identity() -> Self
pub fn translate(tx: f32, ty: f32) -> Self
pub fn scale(sx: f32, sy: f32) -> Self
Sourcepub fn rotate(rad: f32) -> Self
pub fn rotate(rad: f32) -> Self
角度はラジアン。正の角度で「x 軸から y 軸へ」回る(Canvas の既定は y 軸が下向きなので、画面上は時計回りに見える)。
Sourcepub fn multiply(&self, m: &Matrix) -> Matrix
pub fn multiply(&self, m: &Matrix) -> Matrix
self に m を右から掛ける(self * m)。
Canvas の ctx.transform(...) の意味論。後から積んだ変換ほど
点に対して先に効く。
Sourcepub fn determinant(&self) -> f32
pub fn determinant(&self) -> f32
行列式。0 なら退化(逆行列を持たない)。
Trait Implementations§
impl Copy for Matrix
impl StructuralPartialEq for Matrix
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnsafeUnpin for Matrix
impl UnwindSafe for Matrix
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