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);
}
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);
}
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);
}
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));
}
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);
}
Aggregations