@Override public Zone extend() { return new CoordPackerZone(CoordPacker.expand(shorts, 1, 256, 256, true)); }
@Override public CoordPackerZone expand8way(int distance) { return new CoordPackerZone(CoordPacker.expand(shorts, distance, 256, 256, true)); }
@Override public CoordPackerZone expand(int distance) { return new CoordPackerZone(CoordPacker.expand(shorts, distance, 256, 256)); }
/** * Finds the area consisting of the "on" positions in packed that are within the specified depth distance of an * "off" position or the edge of the map. This essentially finds the part of packed that is close to its edge. * Returns a new packed short[] and does not modify packed. * @param packed a short[] returned by pack() or one of the sub-arrays in what is returned by packMulti() * @param depth the positive (square) radius, in cells, to go inward from an "off" cell into the "in" cells * @param width the maximum width; if a cell would move to x at least equal to width, it stops at width - 1 * @param height the maximum height; if a cell would move to y at least equal to height, it stops at height - 1 * @param eightWay true if the retraction should be both diagonal and orthogonal; false for just orthogonal * @return a short[] that encodes "on" for cells that were "on" in packed and were close enough to an "off" cell */ public static short[] surface(short[] packed, int depth, int width, int height, boolean eightWay) { return intersectPacked(packed, expand(negatePacked(packed), depth, width, height, eightWay)); } /**
/** * Finds the area made by removing the "on" positions in packed that are within the specified retraction distance of * an "off" position or the edge of the map. This essentially finds a shrunken version of packed. * Returns a new packed short[] and does not modify packed. * @param packed a short[] returned by pack() or one of the sub-arrays in what is returned by packMulti() * @param retraction the positive (square) radius, in cells, to pull each cell in by * @param width the maximum width; cells outside this are considered "off" for this method's purposes * @param height the maximum height; cells outside this are considered "off" for this method's purposes * @param eightWay true if the retraction should be both diagonal and orthogonal; false for just orthogonal * @return a packed array that encodes "on" for packed and cells that expanded from cells that were "on" in packed */ public static short[] retract(short[] packed, int retraction, int width, int height, boolean eightWay) { return differencePacked(packed, expand(negatePacked(packed), retraction, width, height, eightWay)); } /*
/** * Finds the area consisting of the "on" positions in packed that are within the specified depth distance of an * "off" position or the edge of the map. This essentially finds the part of packed that is close to its edge. * Uses 8-way movement (Chebyshev distance) unless the overload of this function that takes a boolean argument * eightWay is used and that argument is false. * Returns a new packed short[] and does not modify packed. * @param packed a short[] returned by pack() or one of the sub-arrays in what is returned by packMulti() * @param depth the positive (square) radius, in cells, to go inward from an "off" cell into the "in" cells * @param width the maximum width; if a cell would move to x at least equal to width, it stops at width - 1 * @param height the maximum height; if a cell would move to y at least equal to height, it stops at height - 1 * @return a short[] that encodes "on" for cells that were "on" in packed and were close enough to an "off" cell */ public static short[] surface(short[] packed, int depth, int width, int height) { return intersectPacked(packed, expand(negatePacked(packed), depth, width, height, true)); } /*{
/** * Finds the area made by removing the "on" positions in packed that are within the specified retraction distance of * an "off" position or the edge of the map. This essentially finds a shrunken version of packed. * Uses 8-way movement (Chebyshev distance) unless the overload of this function that takes a boolean argument * eightWay is used and that argument is false. * Returns a new packed short[] and does not modify packed. * @param packed a short[] returned by pack() or one of the sub-arrays in what is returned by packMulti() * @param retraction the positive (square) radius, in cells, to pull each cell in by * @param width the maximum width; if a cell would move to x at least equal to width, it stops at width - 1 * @param height the maximum height; if a cell would move to y at least equal to height, it stops at height - 1 * @return a short[] that encodes "on" for cells that were "on" in packed and were far enough from an "off" cell */ public static short[] retract(short[] packed, int retraction, int width, int height) { return differencePacked(packed, expand(negatePacked(packed), retraction, width, height, true)); } /* public static short[] retract(short[] packed, int retraction, int width, int height)
for (short[] r : allRegions) { if (CoordPacker.count(r) > 5) { region = CoordPacker.expand(r, 1, width, height, false); if(CoordPacker.isEmpty(region)) continue;
return expand(packed, expansion, width, height); if(packed == null || packed.length <= 1)