void assertEqualsExact(Geometry g1, Geometry g2, String msg) { Geometry g1Clone = (Geometry) g1.clone(); Geometry g2Clone = (Geometry) g2.clone(); g1Clone.normalize(); g2Clone.normalize(); assertTrue(g1Clone.equalsExact(g2Clone), msg); }
void checkTransformation(String geomStr) throws IOException, ParseException, NoninvertibleTransformationException { Geometry geom = rdr.read(geomStr); AffineTransformation trans = AffineTransformation.rotationInstance(Math.PI / 2); AffineTransformation inv = trans.getInverse(); Geometry transGeom = (Geometry) geom.clone(); transGeom.apply(trans); // System.out.println(transGeom); transGeom.apply(inv); // check if transformed geometry is equal to original boolean isEqual = geom.equalsExact(transGeom, 0.0005); assertTrue(isEqual); }