@Test public void testCreateLineFromPointsHorz() { BitMask bm = BitMaskFactory.createLine(Vectors.create(-5, 1), Vectors.create(-1, 1)); bm.trim(); assertEquals(new BoundingBox(1, -5, 1, -1), bm.getBounds()); assertEquals(0xF800000000000000l, bm.getSubmaskElement(0, 0)); }
@Test public void testCreateOtherCircle() { BitMask bm = BitMaskFactory.createCircle(10.001); bm.trim(); assertEquals(new BoundingBox(0, 0, 20, 21), bm.getBounds()); assertEquals(0x0030000000000000l, bm.getSubmaskElement(0, 0)); assertEquals(0xFFFFF80000000000l, bm.getSubmaskElement(6, 0)); assertEquals(0x0070000000000000l, bm.getSubmaskElement(20, 0)); }
@Test public void testCreateThirdCircle() { BitMask bm = BitMaskFactory.createCircle(9.999); bm.trim(); assertEquals(new BoundingBox(0, 0, 19, 20), bm.getBounds()); assertEquals(0x0060000000000000l, bm.getSubmaskElement(0, 0)); assertEquals(0xFFFFF80000000000l, bm.getSubmaskElement(6, 0)); assertEquals(0x07FF000000000000l, bm.getSubmaskElement(19, 0)); }
@Test public void testCreateUnitCircle() { BitMask bm = BitMaskFactory.createCircle(1.0); bm.trim(); assertEquals(new BoundingBox(0, 0, 2, 2), bm.getBounds()); assertEquals(0x4000000000000000l, bm.getSubmaskElement(0, 0)); assertEquals(0xE000000000000000l, bm.getSubmaskElement(1, 0)); assertEquals(0x4000000000000000l, bm.getSubmaskElement(2, 0)); }