UNPKG

@rickosborne/hexgrid

Version:

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

40 lines (39 loc) 1.79 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 axial_line_draw_exports = {}; __export(axial_line_draw_exports, { axialLineDraw: () => axialLineDraw }); module.exports = __toCommonJS(axial_line_draw_exports); var import_axial_add = require("./axial-add.cjs"); var import_axial_lerp = require("./axial-lerp.cjs"); var import_axial_round = require("./axial-round.cjs"); var import_axial = require("./axial.cjs"); var import_hex_distance = require("./hex-distance.cjs"); const axialLineDraw = /* @__PURE__ */ __name((left, right) => { const points = []; const distance = (0, import_hex_distance.hexDistance)(left, right); const start = (0, import_axial_add.axialAdd)(left, import_axial.AXIAL_EPSILON); for (let i = 0; i <= distance; i++) { points.push((0, import_axial_round.axialRound)((0, import_axial_lerp.axialLerp)(start, right, i / distance))); } return points; }, "axialLineDraw"); //# sourceMappingURL=axial-line-draw.cjs.map