MCPcopy
hub / github.com/tdewolff/canvas / Inv

Method Inv

util.go:730–744  ·  view source on GitHub ↗

Inv returns the matrix inverse.

()

Source from the content-addressed store, hash-verified

728
729// Inv returns the matrix inverse.
730func (m Matrix) Inv() Matrix {
731 det := m.Det()
732 if Equal(det, 0.0) {
733 panic("determinant of affine transformation matrix is zero")
734 }
735 return Matrix{{
736 m[1][1] / det,
737 -m[0][1] / det,
738 -(m[1][1]*m[0][2] - m[0][1]*m[1][2]) / det,
739 }, {
740 -m[1][0] / det,
741 m[0][0] / det,
742 -(-m[1][0]*m[0][2] + m[0][0]*m[1][2]) / det,
743 }}
744}
745
746// Eigen returns the matrix eigenvalues and eigenvectors. The first eigenvalue is related to the first eigenvector, and so for the second pair. Eigenvectors are normalized.
747func (m Matrix) Eigen() (float64, float64, Point, Point) {

Callers 6

TestMatrixFunction · 0.80
TransformMethod · 0.80
TileRectangleFunction · 0.80
TileMethod · 0.80
SetTextPositionMethod · 0.80
RenderPathMethod · 0.80

Calls 2

DetMethod · 0.95
EqualFunction · 0.85

Tested by 1

TestMatrixFunction · 0.64