@Test public void testIntersects() { System.out.println("Intersects a copy of itself (expected true)"); FreedomPolygon source = new FreedomPolygon(); source.append(new FreedomPoint(0, 0)); source.append(new FreedomPoint(100, 0)); source.append(new FreedomPoint(100, 50)); source.append(new FreedomPoint(0, 50)); FreedomPolygon target = new FreedomPolygon(); target.append(new FreedomPoint(0, 0)); target.append(new FreedomPoint(100, 0)); target.append(new FreedomPoint(100, 50)); target.append(new FreedomPoint(0, 50)); boolean expResult = true; boolean result = TopologyUtils.intersects(source, target); assertEquals(expResult, result); }
public static boolean intersects(FreedomPolygon source, FreedomPolygon target) { for (FreedomPoint edge : source.getPoints()) { if (contains(target, edge)) { return true; } } for (FreedomPoint edge : target.getPoints()) { if (contains(source, edge)) { return true; } } return false; }
TopologyUtils { public static boolean intersects(FreedomPolygon source, FreedomPolygon target) { for (FreedomPoint edge : source.getPoints()) { if (contains(target, edge)) { return true; } } for (FreedomPoint edge : target.getPoints()) { if (contains(source, edge)) { return true; } } return false; } }
TopologyUtils { public static boolean intersects(FreedomPolygon source, FreedomPolygon target) { for (FreedomPoint edge : source.getPoints()) { if (contains(target, edge)) { return true; } } for (FreedomPoint edge : target.getPoints()) { if (contains(source, edge)) { return true; } } return false; } private  TopologyUtils(); }
TopologyUtils { public static boolean intersects(FreedomPolygon source, FreedomPolygon target) { for (FreedomPoint edge : source.getPoints()) { if (contains(target, edge)) { return true; } } for (FreedomPoint edge : target.getPoints()) { if (contains(source, edge)) { return true; } } return false; } 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 boolean intersects(FreedomPolygon source, FreedomPolygon target) { for (FreedomPoint edge : source.getPoints()) { if (contains(target, edge)) { return true; } } for (FreedomPoint edge : target.getPoints()) { if (contains(source, edge)) { return true; } } return false; } 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);  }