Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

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 det(), and setIdentity().

Referenced by Inkscape::UI::PathManipulator::_externalChange(), Inkscape::UI::ClipboardManagerImpl::_pasteDocument(), Inkscape::UI::PathManipulator::_updateDragPoint(), do_trace(), Inkscape::UI::TransformHandle::dragged(), file_import(), Inkscape::Filters::FilterUnits::get_matrix_display2pb(), Inkscape::Filters::FilterUnits::get_matrix_pb2display(), Geom::intersect_polish_root(), sp_flood_do_flood_fill(), sp_item_adjust_paint_recursive(), sp_item_dt2i_affine(), sp_item_write_transform(), sp_selection_apply_affine(), and sp_selection_set_mask().

                             {
    Matrix d;

    Geom::Coord const determ = det();
    // the numerical precision of the determinant must be significant
    if (fabs(determ) > 1e-18) {
        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;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index