Logo Search packages:      
Sourcecode: inkscape version File versions

Matrix Geom::Matrix::inverse (  )  const

Attempts to calculate the inverse of a matrix. This is a Matrix such that m * m.inverse() is very near (hopefully < epsilon difference) the identity Matrix. {The Identity Matrix is returned if the matrix has no inverse.}

Returns:
The inverse of the Matrix if defined, otherwise the Identity Matrix.

Definition at line 178 of file matrix.cpp.

References _c, det(), and setIdentity().

Referenced by Inkscape::UI::ClipboardManagerImpl::_pasteDocument(), do_trace(), file_import(), Geom::intersect_polish_root(), sp_item_adjust_paint_recursive(), sp_item_dt2i_affine(), sp_item_write_transform(), sp_nodepath_new(), sp_selection_apply_affine(), and sp_selection_set_mask().

                             {
    Matrix d;

    Geom::Coord const determ = det();
    if (!are_near(determ, 0.0)) {
        Geom::Coord const ideterm = 1.0 / determ;

        d._c[0] =  _c[3] * ideterm;
        d._c[1] = -_c[1] * ideterm;
        d._c[2] = -_c[2] * ideterm;
        d._c[3] =  _c[0] * ideterm;
        d._c[4] = -_c[4] * d._c[0] - _c[5] * d._c[2];
        d._c[5] = -_c[4] * d._c[1] - _c[5] * d._c[3];
    } else {
        d.setIdentity();
    }

    return d;
}


Generated by  Doxygen 1.6.0   Back to index