use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationFunctions method transformByBaseline.
public static Geometry transformByBaseline(final Geometry g, final Geometry destBaseline) {
final BoundingBox env = g.getBoundingBox();
final Point src0 = new PointDoubleXY(env.getMinX(), env.getMinY());
final Point src1 = new PointDoubleXY(env.getMaxX(), env.getMinY());
final Point[] destPts = CoordinatesListUtil.getPointArray(destBaseline);
final Point dest0 = destPts[0];
final Point dest1 = destPts[1];
final AffineTransformation trans = AffineTransformationFactory.newFromBaseLines(src0, src1, dest0, dest1);
return trans.transform(g);
}
use of com.revolsys.geometry.model.util.AffineTransformation in project com.revolsys.open by revolsys.
the class AffineTransformationFunctions method scale.
public static Geometry scale(final Geometry g, final double scale) {
final Point centre = envelopeCentre(g);
final AffineTransformation trans = AffineTransformation.scaleInstance(scale, scale, 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 translateCentreToOrigin.
public static Geometry translateCentreToOrigin(final Geometry g) {
final Point centre = envelopeCentre(g);
final AffineTransformation trans = AffineTransformation.translationInstance(-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 rotateByPiMultiple.
public static Geometry rotateByPiMultiple(final Geometry g, final double multipleOfPi) {
final Point centre = envelopeCentre(g);
final AffineTransformation trans = AffineTransformation.rotationInstance(multipleOfPi * Math.PI, 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 transformByVectors.
public static Geometry transformByVectors(final Geometry g, final Geometry control) {
final int nControl = control.getGeometryCount();
final Point[] src = new Point[nControl];
final Point[] dest = new Point[nControl];
for (int i = 0; i < nControl; i++) {
final Geometry contComp = control.getGeometry(i);
final Point[] pts = CoordinatesListUtil.getPointArray(contComp);
src[i] = pts[0];
dest[i] = pts[1];
}
final AffineTransformation trans = AffineTransformationFactory.newFromControlVectors(src, dest);
System.out.println(trans);
return trans.transform(g);
}
Aggregations