yellowstonegames / SquidLib

Useful tools for roguelike, role-playing, strategy, and other grid-based games in Java. Feedback is welcome!
Other
454 stars 46 forks source link

Added the following methods to Zone: translate(Coord), translate(int,… #183

Closed smelc closed 7 years ago

smelc commented 7 years ago

… int), extend(), and getExternalBorder(). API change: replace use of Rectange.Impl::expand8Way by Zone::extend()

tommyettinger commented 7 years ago

Interesting; these seem close to some existing methods for GreasedRegion and CoordPacker (extend is like expand, and getExternalBorder is like fringe), but they have different return types, so the different names work out fine. I think I can merge this without issues, and I'll add some code after that so GreasedRegion uses expand() on a copy of itself to implement extend(), and similarly for getExternalBorder().

tommyettinger commented 7 years ago

Hm, the docs don't specify how adjacency is determined for extend() and getExternalBorder(). I had thought they would use 4-way orthogonal-only adjacency, but checking the code it looks like they use 8-way adjacency, including diagonal. I'll add a note to the docs.

smelc commented 7 years ago

Indeed they use 8-way adjacency.