geometryAT = new AffineTransformation(1, 0, -sourceRegion.x, 0, 1, -sourceRegion.y); geometryAT.scale(xScale, yScale); LOGGER.fine( "Adapting overview's geometry to current image, using transformation: " + geometryAT.toString()); new AffineTransformation( at.getScaleX(), at.getShearX(),
public void testComposeRotation1() { AffineTransformation t0 = AffineTransformation.rotationInstance(1, 10, 10); AffineTransformation t1 = AffineTransformation.translationInstance(-10, -10); t1.rotate(1); t1.translate(10, 10); checkTransformation(t0, t1); }
public void testRotate1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.rotationInstance(Math.PI/2); checkTransformation(10, 0, t, 0, 10); checkTransformation(0, 10, t, -10, 0); checkTransformation(-10, -10, t, 10, -10); }
public void testTransform2() { AffineTransformation trans = new AffineTransformation(); trans.rotate(3); trans.translate(10, 10); trans.scale(2, 10); trans.shear(5, 2); trans.reflect(5, 8, 10, 2); runTransform(trans, ctl0, ctl1, ctl2); }
public void testTransform1() { AffineTransformation trans = new AffineTransformation(); trans.rotate(1); trans.translate(10, 10); trans.scale(2, 2); runTransform(trans, ctl0, ctl1, ctl2); }
Geometry rescaled; AffineTransformation geometryAT = new AffineTransformation( at.getScaleX(), at.getShearX(),
public void testTranslateRotate1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.translationInstance(3, 3) .rotate(Math.PI/2); checkTransformation(10, 0, t, -3, 13); checkTransformation(-10, -10, t, 7, -7); }
public void testCompose2() { AffineTransformation t0 = AffineTransformation.reflectionInstance(0, 0, 1, 0); t0.reflect(0, 0, 0, -1); AffineTransformation t1 = AffineTransformation.rotationInstance(Math.PI); checkTransformation(t0, t1); }
public void testCompose3() { AffineTransformation t0 = AffineTransformation.reflectionInstance(0, 10, 10, 0); t0.translate(-10, -10); AffineTransformation t1 = AffineTransformation.reflectionInstance(0, 0, -1, 1); checkTransformation(t0, t1); }
private double[] getTranslationFactors(Polygon reference, Polygon displaced) { // compare the two envelopes Envelope re = reference.getEnvelopeInternal(); Envelope de = displaced.getEnvelopeInternal(); double dw = Math.abs(re.getWidth() - de.getWidth()); double dh = Math.abs(re.getHeight() - de.getHeight()); if (dw > EPS * re.getWidth() || dh > EPS * re.getWidth()) { // this was not just a translation return null; } // compute the translation double dx = de.getMinX() - re.getMinX(); double dy = de.getMinY() - re.getMinY(); Polygon cloned = (Polygon) displaced.copy(); cloned.apply(AffineTransformation.translationInstance(-dx, -dy)); if (1 - new HausdorffSimilarityMeasure().measure(cloned, reference) > EPS) { return null; } else { return new double[] {dx, dy}; } }
public void testScale1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.scaleInstance(2, 3); checkTransformation(10, 0, t, 20, 0); checkTransformation(0, 10, t, 0, 30); checkTransformation(-10, -10, t, -20, -30); }
public void testReflectXY1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.reflectionInstance(1, 1); checkTransformation(10, 0, t, 0, 10); checkTransformation(0, 10, t, 10, 0); checkTransformation(-10, -10, t, -10, -10); checkTransformation(-3, -4, t, -4, -3); }
@DescribeProcess( title = "Polygonize", description = "Creates a set of polygons from linestrings delineating them. The linestrings must be correctly noded (i.e. touch only at endpoints)." ) @DescribeResult(description = "The collection of created polygons") public static Geometry polygonize( @DescribeParameter(name = "geom", description = "Linework to polygonize") Geometry geom) { @SuppressWarnings("rawtypes") List lines = LineStringExtracter.getLines(geom); Polygonizer polygonizer = new Polygonizer(); polygonizer.add(lines); @SuppressWarnings("rawtypes") Collection polys = polygonizer.getPolygons(); Polygon[] polyArray = GeometryFactory.toPolygonArray(polys); return geom.getFactory().createGeometryCollection(polyArray); }
public void testShear1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.shearInstance(2, 3); checkTransformation(10, 0, t, 10, 30); }
final ListFeatureCollection featureCollection = new ListFeatureCollection(featureType); final AffineTransformation jtsTransformation = new AffineTransformation( mt2D.getScaleX(), mt2D.getShearX(),
public void testRotate2() throws IOException, ParseException { AffineTransformation t = AffineTransformation.rotationInstance(1, 0); checkTransformation(10, 0, t, 0, 10); checkTransformation(0, 10, t, -10, 0); checkTransformation(-10, -10, t, 10, -10); }
public void testReflectXYXY1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.reflectionInstance(0, 5, 5, 0); checkTransformation(5, 0, t, 5, 0); checkTransformation(0, 0, t, 5, 5); checkTransformation(-10, -10, t, 15, 15); }
public void testRotateAroundPoint1() throws IOException, ParseException { AffineTransformation t = AffineTransformation.rotationInstance(Math.PI/2, 1, 1); checkTransformation(1, 1, t, 1, 1); checkTransformation(10, 0, t, 2, 10); checkTransformation(0, 10, t, -8, 0); checkTransformation(-10, -10, t, 12, -10); }
public void testReflectXY2() throws IOException, ParseException { AffineTransformation t = AffineTransformation.reflectionInstance(1, -1); checkTransformation(10, 0, t, 0, -10); checkTransformation(0, 10, t, -10, 0); checkTransformation(-10, -10, t, 10, 10); checkTransformation(-3, -4, t, 4, 3); }
public void testRotateAroundPoint2() throws IOException, ParseException { AffineTransformation t = AffineTransformation.rotationInstance(1, 0, 1, 1); checkTransformation(1, 1, t, 1, 1); checkTransformation(10, 0, t, 2, 10); checkTransformation(0, 10, t, -8, 0); checkTransformation(-10, -10, t, 12, -10); }