public static void shear(final Shape shape, final double x, final double y) {
if (shape instanceof Point) {
Point point = (Point) shape;
point.set(point.getX() + x * point.getY(), point.getY() + y * point.getX());
} else if (shape instanceof Line) {
Line line = (Line) shape;
line.setStart(line.getX1() + x * line.getY1(), line.getY1() + y * line.getX1());
line.setEnd(line.getX2() + x * line.getY2(), line.getY2() + y * line.getX2());
} else if (shape instanceof Polygon) {
Polygon polygon = (Polygon) shape;
final int size = polygon.getSize();
for (int i = 0; i < size; i++) {
polygon.setVertex(i, polygon.getX(i) + x * polygon.getY(i), polygon.getY(i) + y * polygon.getX(i));