Android: how do I do the opposite of 'Matrix.mapPoints(float[] points)'?
If you don't want yourMatrix
to change
Matrix inverseCopy = new Matrix();
if(yourMatrix.invert(inverseCopy)){
inverseCopy.mapPoints(transformedPoint);
//Now transformedPoint is reverted to original state.
}
If you want yourMatrix
to change
if(yourMatrix.invert(yourMatrix)){
yourMatrix.mapPoints(transformedPoint);
//Now transformedPoint is reverted to original state.
}
matrix.invert()
returns false
if the matrix
cannot be inverted. If your matrix
cannot be inverted there is no way to revert your points to original state.