@rickosborne/hexgrid
Version:
Rick Osborne's collection of hexagonal grid-related code.
18 lines (17 loc) • 617 B
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const hexDistance = /* @__PURE__ */ __name((left, right) => {
const q = left.q - right.q;
const r = left.r - right.r;
return Math.max(Math.abs(q), Math.abs(r), Math.abs(q + r));
}, "hexDistance");
const hexEuclidDistance = /* @__PURE__ */ __name((left, right) => {
const q = left.q - right.q;
const r = left.r - right.r;
return Math.sqrt(q * q + r * r + q * r);
}, "hexEuclidDistance");
export {
hexDistance,
hexEuclidDistance
};
//# sourceMappingURL=hex-distance.mjs.map