local ____lualib = require("lualib_bundle")
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local ____exports = {}
local ____hexGrid = require("grid.hexGrid")
local HexGrid = ____hexGrid.HexGrid
local PointyHexGrid = __TS__Class()
PointyHexGrid.name = "PointyHexGrid"
__TS__ClassExtends(PointyHexGrid, HexGrid)
function PointyHexGrid.prototype.____constructor(self, ...)
    HexGrid.prototype.____constructor(self, ...)
    self.positionToGrid = function(____, point)
        local q = (math.sqrt(3) / 3 * point.x - 1 / 3 * point.y) / self.size
        local r = 2 / 3 * point.y / self.size
        return {q = q, r = r}
    end
    self.gridToPosition = function(____, coord)
        local x = self.size * (math.sqrt(3) * coord.q + math.sqrt(3) / 2 * coord.r)
        local y = self.size * (3 / 2 * coord.r)
        return {x = x, y = y}
    end
end
function PointyHexGrid.prototype.toOffset(self, coord)
    local q = coord.q + (coord.r - self:oddValue(coord.r)) / 2
    local r = coord.r
    return {q = q, r = r}
end
function PointyHexGrid.prototype.toAxial(self, coord)
    local q = coord.q - (coord.r - self:oddValue(coord.r)) / 2
    local r = coord.r
    return {q = q, r = r}
end
____exports.default = PointyHexGrid
return ____exports
