diff --git a/plugins/regions.user.js b/plugins/regions.user.js index 4c2ec44b..cd897abb 100644 --- a/plugins/regions.user.js +++ b/plugins/regions.user.js @@ -120,6 +120,31 @@ window.plugin.regions.search = function(query) { }); } +// rot and d2xy from Wikipedia +window.plugin.regions.rot = function(n, x, y, rx, ry) { + if(ry == 0) { + if(rx == 1) { + x = n-1 - x; + y = n-1 - y; + } + + return [y, x]; + } + return [x, y]; +} +window.plugin.regions.d2xy = function(n, d) { + var rx, ry, s, t = d, xy = [0, 0]; + for(s=1; s