Search in sources :

Example 21 with AffineTransformation

use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.

the class AffineTransformationFunctions method rotate.

public static Geometry rotate(final Geometry g, final double angle) {
    final Point centre = envelopeCentre(g);
    final AffineTransformation trans = AffineTransformation.rotationInstance(angle, centre.getX(), centre.getY());
    return trans.transform(g);
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) Point(com.revolsys.geometry.model.Point)

Example 22 with AffineTransformation

use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.

the class AffineTransformationFunctions method reflectInY.

public static Geometry reflectInY(final Geometry g) {
    final Point centre = envelopeCentre(g);
    final AffineTransformation trans = AffineTransformation.scaleInstance(-1, 1, centre.getX(), centre.getY());
    return trans.transform(g);
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) Point(com.revolsys.geometry.model.Point)

Example 23 with AffineTransformation

use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.

the class AffineTransformationFunctions method reflectInX.

public static Geometry reflectInX(final Geometry g) {
    final Point centre = envelopeCentre(g);
    final AffineTransformation trans = AffineTransformation.scaleInstance(1, -1, centre.getX(), centre.getY());
    return trans.transform(g);
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) Point(com.revolsys.geometry.model.Point)

Example 24 with AffineTransformation

use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.

the class AffineTransformationBuilderTest method runTransform.

private void runTransform(final AffineTransformation trans, final Point p0, final Point p1, final Point p2) {
    final Point pp0 = trans.transform(p0);
    final Point pp1 = trans.transform(p1);
    final Point pp2 = trans.transform(p2);
    final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
    final AffineTransformation atbTrans = atb.getTransformation();
    assertEqualPoint(pp0, atbTrans.transform(p0));
    assertEqualPoint(pp1, atbTrans.transform(p1));
    assertEqualPoint(pp2, atbTrans.transform(p2));
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) AffineTransformationBuilder(com.revolsys.geometry.model.util.AffineTransformationBuilder) Point(com.revolsys.geometry.model.Point)

Example 25 with AffineTransformation

use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.

the class AffineTransformationTest method testReflectXY1.

public void testReflectXY1() throws IOException, ParseException {
    final 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);
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation)

Aggregations

AffineTransformation (com.revolsys.geometry.model.util.AffineTransformation)29 Point (com.revolsys.geometry.model.Point)13 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)4 AffineTransformationBuilder (com.revolsys.geometry.model.util.AffineTransformationBuilder)3 Geometry (com.revolsys.geometry.model.Geometry)2 BoundingBox (com.revolsys.geometry.model.BoundingBox)1 NoninvertibleTransformationException (com.revolsys.geometry.model.util.NoninvertibleTransformationException)1