Android: how do I do the opposite of "Matrix.mapPoints (float [] points)"?

If I have a point and a matrix:

float point[] = new float[]{x,y};
Matrix matrix = new Matrix();

and call:

matrix.mapPoints(point);

How can I undo the effects that it matrix.mapPoints(point)has on point?

This is not the actual application for which I will use the answer, but the answer for this will work for what I need.

Thanks for any help.

+4
source share
1 answer

If you do not want to yourMatrixchange

 Matrix inverseCopy = new Matrix();
 if(yourMatrix.invert(inverseCopy)){
      inverseCopy.mapPoints(transformedPoint);
      //Now transformedPoint is reverted to original state.
 }

If you want to yourMatrixchange

 if(yourMatrix.invert(null)){
      yourMatrix.mapPoints(transformedPoint);
      //Now transformedPoint is reverted to original state.
 }

matrix.invert()returns falseif matrixcannot be inverted. If your matrixcannot be inverted, there is no way to return your points to their original state.

+7

All Articles