Esempio n. 1
0
 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);
 }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
  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);
  }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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);
 }