package cse1030.drawing; public class TestRotation { 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 h = 0.5; double delta = 0.05; double[] x = new double[4]; double[] y = new double[4]; while (true) { Rotation r = new Rotation("Rotation", h); Point2D q1 = r.apply(p1); Point2D q2 = r.apply(p2); r.transform(p3); r.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); h += delta; if (Math.abs(h) > 1.) { delta = -delta; } p3 = new Point2D(0.5, -0.5); p4 = new Point2D(0.5, 0.5); } } }