Divides this matrix by
mtx
and returns the result, or
NULL
if
mtx
has no inverse.
Multiplying
mtx
and the result returned by
dividematrix
using
concatmatrix
yields a matrix with fields that, except for small floating
point errors, match the fields in this 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 = num.dividematrix(denom);
printf(" num=%s\n", Dump(num));
printf(" denom=%s\n", Dump(denom));
printf("num/denom=%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}
num/denom={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 illustrates how
dividematrix
can be used to extract a matrix that later be combined with the
denominator using
concatmatrix
to reproduce the numerator.
| | |
| Return: |
Matrix
| | |
| See Also: |
concat,
concatmatrix,
currentmatrix,
dtransform,
Graphics,
identmatrix,
idtransform,
initmatrix,
invertmatrix,
itransform,
maptopixel,
rotate,
scale,
setmatrix,
shear,
transform,
translate
|
|