use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method run.
void run(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
final Point p0 = new PointDoubleXY(p0x, p0y);
final Point p1 = new PointDoubleXY(p1x, p1y);
final Point p2 = new PointDoubleXY(p2x, p2y);
final Point pp0 = new PointDoubleXY(pp0x, pp0y);
final Point pp1 = new PointDoubleXY(pp1x, pp1y);
final Point pp2 = new PointDoubleXY(pp2x, pp2y);
final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
final AffineTransformation trans = atb.getTransformation();
assertEqualPoint(pp0, trans.transform(p0));
assertEqualPoint(pp1, trans.transform(p1));
assertEqualPoint(pp2, trans.transform(p2));
}
use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method runSingular.
void runSingular(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
final Point p0 = new PointDoubleXY(p0x, p0y);
final Point p1 = new PointDoubleXY(p1x, p1y);
final Point p2 = new PointDoubleXY(p2x, p2y);
final Point pp0 = new PointDoubleXY(pp0x, pp0y);
final Point pp1 = new PointDoubleXY(pp1x, pp1y);
final Point pp2 = new PointDoubleXY(pp2x, pp2y);
final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
final AffineTransformation trans = atb.getTransformation();
assertEquals(trans, null);
}
use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method testTransform1.
public void testTransform1() {
final AffineTransformation trans = new AffineTransformation();
trans.rotate(1);
trans.translate(10, 10);
trans.scale(2, 2);
runTransform(trans, this.ctl0, this.ctl1, this.ctl2);
}
use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method testTransform2.
public void testTransform2() {
final 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, this.ctl0, this.ctl1, this.ctl2);
}
use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationFunctions method translateToOrigin.
public static Geometry translateToOrigin(final Geometry g) {
final Point lowerLeft = envelopeLowerLeft(g);
final AffineTransformation trans = AffineTransformation.translationInstance(-lowerLeft.getX(), -lowerLeft.getY());
return trans.transform(g);
}
Aggregations