Returns the inverse of this matrix or
NULL
if there is no inverse.
Multiplying this matrix by its inverse using
concatmatrix
produces the identity matrix.
| |
| Example: |
The program,
import yoix.*.*;
Dump(Matrix m) {
return(strfmt(
"{%.2f, %.2f, %.2f, %.2f, %.2f, %.2f}",
m.sx, m.shx, m.tx, m.sy, m.shy, m.ty
));
}
final Matrix DEFAULTMATRIX = {
double sx = 1.5;
double sy = 2.0;
};
Matrix num = DEFAULTMATRIX.currentmatrix();
Matrix denom = DEFAULTMATRIX.currentmatrix();
Matrix div;
num.scale(2, 4).translate(200, 100).rotate(30);
div = denom.invertmatrix().concatmatrix(num);
printf(" num=%s\n", Dump(num));
printf(" denom=%s\n", Dump(denom));
printf(" inverse=%s\n", Dump(denom.invertmatrix()));
printf("inverse*num=%s\n", Dump(div));
printf(" denom*div=%s\n", Dump(denom.concatmatrix(div)));
prints
num={2.60, -1.50, 600.00, 6.93, 4.00, 800.00}
denom={1.50, 0.00, 0.00, 2.00, 0.00, 0.00}
inverse={0.67, 0.00, 0.00, 0.50, 0.00, 0.00}
inverse*num={1.73, -1.00, 400.00, 3.46, 2.00, 400.00}
denom*div={2.60, -1.50, 600.00, 6.93, 4.00, 800.00}
on standard output, which shows how
invertmatrix
can be used to duplicate the behavior of
dividematrix.
| | |
| Return: |
Matrix
| | |
| See Also: |
concat,
concatmatrix,
currentmatrix,
dividematrix,
dtransform,
Graphics,
identmatrix,
idtransform,
initmatrix,
itransform,
maptopixel,
rotate,
scale,
setmatrix,
shear,
transform,
translate
|
|