package cse1030.drawing; public class TestScale { public static void main(String[] args) { SimpleDrawing3.setPenRadius(0.01); Point2D p1 = new Point2D(-0.5, 0.5); Point2D p2 = new Point2D(-0.5, -0.5); Point2D p3 = new Point2D(0.5, -0.5); Point2D p4 = new Point2D(0.5, 0.5); double sx = 0.75; double sy = 1.25; double delta = 0.05; double[] x = new double[4]; double[] y = new double[4]; while (true) { Scale s = new Scale("Scale", sx, sy); Point2D q1 = s.apply(p1); Point2D q2 = s.apply(p2); s.transform(p3); s.transform(p4); Point2D q3 = p3; Point2D q4 = p4; x[0] = q1.getX(); x[1] = q2.getX(); x[2] = q3.getX(); x[3] = q4.getX(); y[0] = q1.getY(); y[1] = q2.getY(); y[2] = q3.getY(); y[3] = q4.getY(); SimpleDrawing3.clear(); SimpleDrawing3.setPenColor(SimpleDrawing3.RED); SimpleDrawing3.filledPolygon(x, y); SimpleDrawing3.show(15); sx += delta; sy -= delta; if (sx > 2. || sx < 0.5 || sy > 2. || sy < 0.5) { delta = -delta; } p3 = new Point2D(0.5, -0.5); p4 = new Point2D(0.5, 0.5); } } }