UNPKG

@rickosborne/hexgrid

Version:

Rick Osborne's collection of hexagonal grid-related code.

37 lines (36 loc) 1.6 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var double_distance_exports = {}; __export(double_distance_exports, { doubleHeightDistance: () => doubleHeightDistance, doubleWidthDistance: () => doubleWidthDistance }); module.exports = __toCommonJS(double_distance_exports); const doubleHeightDistance = /* @__PURE__ */ __name((left, right) => { const dCol = left.col - right.col; const dRow = left.row - right.row; return dCol + Math.max(0, (dRow - dCol) / 2); }, "doubleHeightDistance"); const doubleWidthDistance = /* @__PURE__ */ __name((left, right) => { const dCol = left.col - right.col; const dRow = left.row - right.row; return dRow + Math.max(0, (dCol - dRow) / 2); }, "doubleWidthDistance"); //# sourceMappingURL=double-distance.cjs.map