@Test public void testRotate() { System.out.println("Rotate a polygon"); FreedomPolygon input = new FreedomPolygon(); input.append(new FreedomPoint(0, 0)); input.append(new FreedomPoint(100, 0)); input.append(new FreedomPoint(100, 50)); input.append(new FreedomPoint(0, 50)); int degrees = 90; FreedomPolygon expResult = new FreedomPolygon(); expResult.append(new FreedomPoint(0, 0)); expResult.append(new FreedomPoint(0, 100)); expResult.append(new FreedomPoint(-50, 100)); expResult.append(new FreedomPoint(-50, 0)); FreedomPolygon result = TopologyUtils.rotate(input, degrees); assertEquals(expResult.toString(), result.toString()); }
public static FreedomPolygon rotate(FreedomPolygon input, int degrees) { FreedomPoint pivot = input.getPoints().get(0); FreedomPolygon output = new FreedomPolygon(); for (FreedomPoint point : input.getPoints()) { output.append(rotatePoint(point, pivot, degrees)); } return output; }
TopologyUtils { public static FreedomPolygon rotate(FreedomPolygon input, int degrees) { FreedomPoint pivot = input.getPoints().get(0); FreedomPolygon output = new FreedomPolygon(); for (FreedomPoint point : input.getPoints()) { output.append(rotatePoint(point, pivot, degrees)); } return output; } }
TopologyUtils { public static FreedomPolygon rotate(FreedomPolygon input, int degrees) { FreedomPoint pivot = input.getPoints().get(0); FreedomPolygon output = new FreedomPolygon(); for (FreedomPoint point : input.getPoints()) { output.append(rotatePoint(point, pivot, degrees)); } return output; } private  TopologyUtils(); }
TopologyUtils { public static FreedomPolygon rotate(FreedomPolygon input, int degrees) { FreedomPoint pivot = input.getPoints().get(0); FreedomPolygon output = new FreedomPolygon(); for (FreedomPoint point : input.getPoints()) { output.append(rotatePoint(point, pivot, degrees)); } return output; } private  TopologyUtils(); static Shape convertToAWT(FreedomShape input); static Shape convertToAWT(FreedomShape input, double xScale, double yScale); static Color convertColorToAWT(FreedomColor color); static FreedomPolygon translate(FreedomShape input, int xoffset, int yoffset); static FreedomPolygon rotate(FreedomPolygon input, int degrees); static boolean intersects(FreedomPolygon source, FreedomPolygon target); static boolean contains(FreedomShape fShape, FreedomPoint fPoint); }
TopologyUtils { public static FreedomPolygon rotate(FreedomPolygon input, int degrees) { FreedomPoint pivot = input.getPoints().get(0); FreedomPolygon output = new FreedomPolygon(); for (FreedomPoint point : input.getPoints()) { output.append(rotatePoint(point, pivot, degrees)); } return output; } private  TopologyUtils(); static Shape convertToAWT(FreedomShape input); static Shape convertToAWT(FreedomShape input, double xScale, double yScale); static Color convertColorToAWT(FreedomColor color); static FreedomPolygon translate(FreedomShape input, int xoffset, int yoffset); static FreedomPolygon rotate(FreedomPolygon input, int degrees); static boolean intersects(FreedomPolygon source, FreedomPolygon target); static boolean contains(FreedomShape fShape, FreedomPoint fPoint);  }