/** * Checks that a transformation produces the expected result * * @param x the input pt x * @param y the input pt y * @param trans the transformation * @param xp the expected output x * @param yp the expected output y */ void checkTransformation(double x, double y, AffineTransformation trans, double xp, double yp) { Coordinate p = new Coordinate(x, y); Coordinate p2 = new Coordinate(); trans.transform(p, p2); assertEquals(xp, p2.x, .00005); assertEquals(yp, p2.y, .00005); // if the transformation is invertible, test the inverse try { AffineTransformation invTrans = trans.getInverse(); Coordinate pInv = new Coordinate(); invTrans.transform(p2, pInv); assertEquals(x, pInv.x, .00005); assertEquals(y, pInv.y, .00005); double det = trans.getDeterminant(); double detInv = invTrans.getDeterminant(); assertEquals(det, 1.0 / detInv, .00005); } catch (NoninvertibleTransformationException ex) { } }