protected void transformSpace(ga_Rectangle r) { if (edgeAction == ZERO) { r.position.x -= (int) xAmplitude; r.width += (int) (2 * xAmplitude); r.position.y -= (int) yAmplitude; r.height += (int) (2 * yAmplitude); } }
public void testIntersection() { ga_Rectangle a = new ga_Rectangle(100, 100, 100, 100); ga_Rectangle b = new ga_Rectangle(80, 80, 100, 100); ga_Rectangle i = a.intersect(b); assertEquals(new ga_Rectangle(100, 100, 80, 80), i); b = new ga_Rectangle(80, 80, 20, 20); i = a.intersect(b); assertTrue(i.getPerimeter() == 0); b.width = 10; i = a.intersect(b); assertNull(i); b = new ga_Rectangle(180, 180, 30, 50); i = a.intersect(b); assertEquals(new ga_Rectangle(180, 180, 20, 20), i); }